Page 1 of 1

Setting and Updating Velocity

Posted: Wed Jan 06, 2021 10:17 pm
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.

Re: Setting and Updating Velocity

Posted: Fri Jan 08, 2021 10:35 am
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.