Getting forward vector


#1

Hi,

I am learning the FlytAPI with FlytSim, particularly the Navigation API. I use position_set to navigate my drone over buildings. However, it always looks at the same direction when it moves. Accordingly, I am trying to figure out how to get the drone’s forward vector, so I can use the forward vector and the vector between its current position and the target position to calculate its rotation offset for setting the yaw value. Or are there other ways to make the drone always look at the direction where it is moving towards? Any help or hints would be appreciated, thanks!


#2

Hi,

If you use waypoints, drone’s heading automatically gets set towards next waypoint.
But if you are using position_set, you HAVE to set the drone’s yaw, otherwise it would maintain the current yaw.
To get drone’s current forward vector (which I assume you mean yaw), subscribe to drone’s attitude topic.


#3

Hi srv,
Thank you for the reply. I got it working!


#4