arplaboratory / learning-to-fly

Training transferable end-to-end quadrotor control policies on a laptop in 18 seconds.
MIT License
359 stars 35 forks source link

Different Trajectory #10

Open sesem738 opened 2 weeks ago

sesem738 commented 2 weeks ago

Hi,

If I want the Crazyflie to track different trajectories or waypoints, how do I go about it?

jonas-eschmann commented 2 weeks ago

Hi @sesem738, thanks for reaching out!

The easiest would be to add a new mode to the switch statement here: https://github.com/arplaboratory/learning_to_fly_controller/blob/d52b11a03caa1dadaf6b6bf02f328719b5bdd215/rl_tools_controller.c#L492 You can see how the FIGURE_EIGHT just defines the reference position and velocity depending on the time. So you could implement your own trajectory or waypoints there.

If you want to use setpoins from cflib the NORMAL mode should already work as it takes the data from the setpoint handed to the controller by the firmware: https://github.com/arplaboratory/learning_to_fly_controller/blob/d52b11a03caa1dadaf6b6bf02f328719b5bdd215/rl_tools_controller.c#L418

which are received from this function in cflib: https://github.com/bitcraze/crazyflie-lib-python/blob/c09bd869f1a823f26dbc2a3238444e018470a11e/cflib/crazyflie/commander.py#L70

I hope this helps, please let me know how it goes! Jonas

sesem738 commented 2 weeks ago

Thank you very much for your response.

So technically, if I run turn the autonomousSequence.py example with the rl_tools firmware, it would work?

https://github.com/bitcraze/crazyflie-lib-python/blob/c09bd869f1a823f26dbc2a3238444e018470a11e/examples/autonomy/autonomousSequence.py,