top of page
Yellow Stairs

Sense Motion using a Transform Sensor block

Grainy Surface

The overall idea of the Transform sensor is given in the below link. This is a sensor that assesses the spatial relationship between two frames in reference to one another. The main idea was to measure the angle between robot and the world.

https://uk.mathworks.com/help/sm/ref/transformsensor.html

Picture1.png

The relative spatial connection between the frames connected to the block's ports F and B is measured by the transform sensor block. The relative pose, velocity, and acceleration are among the recorded values. Connect the frame ports F and B of the block to the desired frame and the model's world frame, respectively, to determine the absolute translational or rotational quantities of the frame.

 

There are five options available for the Measurement Frame property of the Transform Sensor block: World, Base, Follower, Non-Rotating Base, and Non-Rotating Follower. All measurements are determined in the world frame when the Measurement Frame setting is set to World. If the associated base or follower frame rotates, centripetal and Coriolis terms are included in the resolved acceleration measurements when Measurement Frame is set to Base or Follower. The measurements do not meet the standard derivative relationship if the associated base or follower frame rotates when the Measurement Frame parameter is set to Non-Rotating Base or Non-Rotating Follower.

 

Here in the below, there is a good example to follow and get an exact idea about the Transform sensor. In this instance, the double pendulum is moved by the force of gravity. The links are moved out of balance, and then gravity is allowed to affect them. The double pendulum example is given below.

​

https://uk.mathworks.com/help/sm/ug/sense-double-pendulum-motion.html

​

The key concept is to use the example as a guide and adapt it to own automaton. To determine the lower link's translational location in relation to the world frame, transform the Sensor block. The position coordinates are outputted immediately to the model workspace, where they can then be plotted using Matlab commands. You can examine the lower-link motion under chaotic and quasi-periodic circumstances by changing the joint state goals.

Grainy Surface
Picture2.png

Figure 18: Double pendulum example.

In MATLAB Simulink and Simscape, the "smdoc_double_pendulum" command generates a model of a double pendulum system. The main code is given below which is an open loop kinematic chain. According to the figure 18, there are some main parts which is found from the library browser to build up the model in the simscape environment.

 The model includes all the functioning blocks that describe the dynamics of the system and how it evolves over time.

The double pendulum is a mechanical system consisting of two masses (or pendulums) that are connected to each other by a hinge.

The first mass is attached to a fixed point, and the second mass is attached to the first mass by another hinge. The motion of the pendulum is affected by gravity and the forces acting on the masses.

The Simscape model of the double pendulum includes several blocks that represent the different components of the system. The main blocks are:

  • Two rigid bodies: These blocks represent the two masses of the double pendulum. Each block has properties such as mass, centre of mass, and moments of inertia.

  • Revolute joints: These blocks represent the hinges that connect the two masses of the double pendulum. The revolute joint allows the masses to rotate around an axis.

  • Gravity: This block represents the gravitational force acting on the masses.

  • Transform sensor: This block measures the torque applied to the joints of the double pendulum.

  • Motion sensor: This block measures the position and velocity of the masses.

  • Connections - Pivot mount, Binary link A, Binary link A1

  • Gain - Radians to degrees (-180/3.14)

  • Scope – Indicate angle graph

By connecting these blocks together in the Simscape model, we can simulate the motion of the double pendulum and observe how it evolves over time. The model generates output signals that represent the angles and velocities of the masses, as well as the torque applied to the joints.

The Simscape model of the double pendulum as seen in figure 18 can be used to study the dynamics of the system, simulate different scenarios and initial conditions, and design control systems to stabilize or control the motion of the pendulum.

Grainy Surface
Picture3.png

Figure 19: Double pendulum simscape code

In Matlab Simscape, a "transform sensor" is a block that measures the position and orientation of a body in a three-dimensional space. The block takes in two inputs: the input signal that represents the motion of the body, and the reference frame that the motion is relative to.

 

The output of the transform sensor block is a 4-by-4 transformation matrix that represents the position and orientation of the body relative to the reference frame. This matrix includes information about translation (x, y, z) and rotation (roll, pitch, yaw) of the body.

 

The function of the transform sensor block is to provide information about the motion of a body in a 3D space to other components in a Simulink or Simscape model. This information can be used to analyse the dynamics of the system, simulate the motion of the body, and control the behaviour of the system.

 

All the measurements and have been shown in the figure 19. According the multibody the user can select what he needs to measure at the specific time. It can be;

  • Rotation

  • Angular velocity

  • Angular acceleration

  • Translation

  • Velocity

  • Acceleration

White Background

Figure 20: Transform sensor measurement

Picture4.png

The double pendulum model in Simscape is an example of a complex mechanical system that can exhibit chaotic behaviour. The simulation results can show how small changes in the initial conditions can result in vastly different trajectories and behaviours of the pendulum, highlighting the sensitivity of chaotic systems to initial conditions.

 

In the context of the double pendulum, a transform sensor block can be used to measure the angles and positions of the two masses of the double pendulum relative to a reference frame.

 

To use a transform sensor block in a Simscape model of the double pendulum, we would typically place the sensor block at the hinges that connect the two masses. The sensor block would take in two inputs: the input signal that represents the motion of the body (i.e., the angle of the mass), and the reference frame that the motion is relative to (i.e., the fixed point to which the first mass is attached).

 

The output of the transform sensor block is a 4-by-4 transformation matrix that represents the position and orientation of the body relative to the reference frame. This matrix includes information about translation (x, y, z) and rotation (roll, pitch, yaw) of the body.

 

By using transform sensor blocks in a Simscape model of the double pendulum, we can measure the angles and positions of the two masses and use this information to analyse the dynamics of the system and simulate its motion. This can be useful for studying the behaviour of the double pendulum under different conditions, designing control systems to stabilize or control the motion of the pendulum, and validating the model against experimental data.

White Background
Picture5.png

Figure 21: Right view of the double pendulum

Picture6.png

Figure 22: Isometric view of the double pendulum

One of the key outputs of the Simscape model is the angle graph of the double pendulum, which shows the angles of the two masses (in radians) as a function of time. This graph can be observed by running a simulation of the model and plotting the results.

 

The angle graph typically shows the motion of the two masses of the double pendulum over a certain period of time. The motion can be periodic or chaotic, depending on the initial conditions of the system and the parameters of the model. The graph may show multiple oscillations or swings of the pendulum, or it may show irregular, unpredictable behaviour.

 

 

The angle graph as seen in figure 23 can be used to study the dynamics of the double pendulum and understand how its motion is affected by different factors such as the length of the pendulum arms, the masses of the pendulum balls, and the initial conditions of the system. It can also be used to validate the Simscape model against experimental data or to design control systems to stabilize or control the motion of the pendulum. The angle graph of the double pendulum in the Simscape model provides a useful tool for understanding and analysing the behaviour of this complex mechanical system.

Light Backdrop
Picture8.png

Figure 23: Angle graph of the double pendulum

Paper Texture
Light Backdrop

To measure the angle between the main robot and the actual world frame, you will need to incorporate sensors into your system. Common sensors used in self-balancing robots include accelerometers, gyroscopes, and magnetometers.

 

Accelerometers measure the acceleration of the robot in different directions, which can be used to determine the orientation of the robot relative to the Earth's gravitational field. Gyroscopes measure the rotation of the robot around its different axes, which can be used to detect changes in the robot's angle. Magnetometers measure the magnetic field around the robot, which can be used to determine the robot's orientation relative to the Earth's magnetic field.

 

Once you have integrated the sensors into your system, you can use them to measure the angle between the main robot and the actual world frame. This can be done by calculating the orientation of the robot using the sensor data, and then comparing it to the orientation of the actual world frame.

 

To simulate the behaviour of a self-balancing robot system, one can create a Simscape model in Matlab that includes the various components of the system, such as the chassis, wheels, motors, sensors, and control system. Simulink can then be used to set up a simulation that includes the Simscape model, the necessary inputs and outputs, and any external disturbances or environmental factors that may affect the behaviour of the robot.

 

By running the simulation, you can observe the behaviour of the self-balancing robot system and analyse its performance under different conditions. Also can make adjustments to the control system and other components of the system to improve its stability and accuracy.

 

Overall, the combination of Simscape and Simulink provides a powerful tool for modelling and simulating complex mechanical systems such as self-balancing robots, and for analysing their behaviour and performance under different conditions.

bottom of page