Setting and Updating Velocity

Topics related to the Lighthouse positioning system, configuration and use
Post Reply
Posts: 6
Joined: Tue Dec 01, 2020 5:03 pm

Setting and Updating Velocity

Post by crazyfordrones »

Hello and Happy New Year!

I'm currently using a Crazyflie 2.1 with the lighthouse deck and positioning system. I have limited python knowledge (I'm still learning!) and have been looking for a way to use the Python API to accomplish my goal. I'm trying to implement a control law (shown below) which sets each velocity component to a gain multiplied by the tracking error of the drone, or the current position minus the desired position.

An example of this would be such as: Velocity_x = -(gain)*(x_current - x_desired)

My main question is how to set the velocity using Python. I know how to obtain the Crazyflie's current position but how does one set the velocity in the x, y and z directions using the Python API? This velocity would need to be continually updated throughout the flight as the crazyflie's current position is changing.

Thank you for any assistance you can provide.
Posts: 748
Joined: Fri Jul 06, 2018 11:13 am

Re: Setting and Updating Velocity

Post by kimberly »

Hi! Thanks and happy new year too you too!

You can use the motion commander with start_linear_motion, as here. One step down to the commander class you could probably use this. Currently no example of it but maybe you will be able to figure it out how to get this to work. It needs to be send in a loop though constantly.

By the way, the first example is featured in this tutorial.
Post Reply