Non-blocking goto function

Firmware/software/electronics/mechanics
Post Reply
Naidala
Beginner
Posts: 14
Joined: Fri Dec 11, 2020 9:10 am

Non-blocking goto function

Post by Naidala »

Hi, I have a Vicon Wand and the idea is to send the current position of the wand as reference for the drone while flying, as a pursuit. This way, I cannot use anymore a sequence defined offline, and I cannot use the go_to() function inside PositionHlCommander, since it is blocking.
One idea is to use the start_forward, start_left commands in MotionCommander, which are non blocking, and wrap them into IFs to check whether the position is reached.
Are there any simpler goto-like commands that are non-blocking? Should I use the send_position_setpoint in Commander?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Non-blocking goto function

Post by arnaud »

Hi,

You can send goto commands to the high-level commander directly using the same function used in the go_to() method: https://github.com/bitcraze/crazyflie-l ... er.py#L247.

Each time the Crazyflie receives a go_to packet, it will plan a trajectory to reach the setpoint. If a new go_to is sent before the end of the trajectory, a new trajectory is planned stating from the current state to the new setpoint. So the Crazyflie supports changing setpoint mid-flight, I have previously used that as a nice way to easily make smooth trajectory, so I am surprised it is not possible in the lib out of the box anymore. This is likely something we should better expose in the lib. My assumption is that we tried to help the user by adding a sleep in the go_to() method on the python side.
Post Reply