Offboard total thrust and torque control mode #594
Replies: 2 comments 3 replies
-
What frequency did you achieve on the radio? With a single CF, I think it should be possible to up to 400 Hz (but if you also send mocap updates, the radio is shared for these packets as well). The standard approach is to model the UAV as a double integrator and then use full_state_setpoint to send the resulting position, velocity, and acceleration commands. For "regular" flight this is more than sufficient; for aggressive maneuvers an on-board controller is required, IMO. Crazyswarm2 also comes with a simulator that has the basic Newton-Euler equations implemented, so in principle you could do what you propose (not sure if that would create a significant benefit over a double integrator model, though). It is possible to run inference for a RL model directly on-board, see https://sites.google.com/view/sim-to-multi-quad for paper and code. The key idea is to convert the model to C-code. |
Beta Was this translation helpful? Give feedback.
-
@whoenig I recently came across this toolbox which seems to allow for deployment of NNs onto any STM32. From reading the quick start guide, it does seem a promising direction, assuming all the weights fit in the memory. I am curious to learn more about this. If there are any more resources that enables automatic NN code generation, please do let me know. |
Beta Was this translation helpful? Give feedback.
-
For my project, I aim to control the Crazyflie using total thrust and torques as inputs. These signals are generated by a deep reinforcement learning (RL) model that is too large to be implemented onboard, similar to the approach used in TinyMPC.
To achieve this, I attempted to create a custom thrust-torque setpoint in both cflib and crazyflie-firmware. However, I encountered a significant bottleneck: the Crazyradio seems unable to transmit these commands at the rate required for the stabilizer to function effectively.
I would like to know if there are any existing examples or implementations that support this type of control mode off-board. Alternatively, is there a way to "emulate" the Crazyflie dynamics off-board to generate a higher-level setpoint (e.g., position or velocity) that closely follows the original control signals' intention?
Any insights, suggestions, or examples would be greatly appreciated.
By "emulation," I mean using an approximate dynamics model of the Crazyflie to perform an RK4 update at its current state, using the total thrust and torques generated by the neural network. The resulting position, velocity, attitude, etc., would then be sent to the Crazyflie as setpoints via cmd_full_state_changed (from Crazyswarm2) or send_full_state_setpoint (from cflib), but at a lower frequency, such as 50Hz.
What do you think of this approach? While it feels somewhat like a hack, I’m open to suggestions or alternatives for achieving off-board control effectively.
PS: I have raised the same discussion on the bitcraze forum. I am raising it here as well to see if the changes in the way the cpp backend communicate can help solve the radio bottlenecks (RF communication is black magic to me right now).
Beta Was this translation helpful? Give feedback.
All reactions