The aim of this article is to show a procedure to visualize the current position of a moving body and comparing it with a prescribed/reference trajectory.
The example described in this article is very generic and simplified. However the methodology can be used as it is for more realistic scenarios. One of these could be a manoeuvering hull where the current position is compared with the ideal or reference trajectory.
Let's consider a simple body moved by a prescribed motion defined by the velocities field functions
Vx = 2*${PI}*cos(${PI}*$Time)
Vy = ${PI}/2*cos(${PI}/2*$Time)
Vz = 0
In order to get the prescribed trajectory (or the reference trajectory in a marine case as described above) we need to define the field functions that describe the position as function of time. These field functions can be obtained by integrating ${Vx}, ${Vy} and ${Vz}:
Tx = 2*sin(${PI}*$Time)
Ty = sin(${PI}/2*$Time)
Tz = 0
In this particular case, the motion occurs on the XY plane. The prescribed trajectory can be then visualized via a XY plot.
In order to do that it is necessary to import a csv table (named "01" in this example) where the field functions ${Tx}, ${Ty} and ${Tz} have been computed as function of time
At this point the XY plot (named "Trajectory" in this case) can be generated
where it is important to associate the Tx column of the table to the X Column of the plot, and the Ty column of the table to the Y column of the plot.
The image below shows the trajectory along which the body should move.
At this point we need to add to this plot the information about current position of the body during the run.
In order to achieve that, we need to create a probe point that moves together with the body:
Maximum Reports for computing the values of Position[X] and Position[Y] are needed to compute the coordinates of the probe point (= moving body) at each timestep.
Now the Trajectory Plot can be updated by inserting the current position of the probe point. This can be done by choosing the probe point as input part of the plot
and making sure that "Scalar Function" is selected for both X Type and Y Type.
The scalar functions to use will be Maximum Reports just created for computing the current X and Y positions.
The Trajectory Plot will now appear like this
where the blue dot represents the current position of the probe point attached to the moving body.
The Images below show the different positions of the body and the comparison with respect the reference trajectory, at 4 different time steps.
see also:
Can I add table data to an existing monitor plot?How to define complex motion paths