Replies: 6 comments
-
You can use allcfs.setParam to use broadcasts rather than unicast (unicast waits for receiving an ack). In Crazyswarm1, you should also disable logging if possible to reduce latency. I doubt using cflib has a lower latency (and it doesn't support broadcasts). Generally, what you want to achieve doesn't work well, due to the latency even of the state estimate. The on-board attitude controller runs at 250 Hz and any reduction causes visible vibrations. |
Beta Was this translation helpful? Give feedback.
-
I tried using allcfs.setParam instead, but it increased the latency setParam script output:
Crazyswarm output:
Script calling setParam
Script calling setParam
LoggingI disabled logging by setting
in hover_swarm.launch but I don't notice any improvement (I already had enable_logging: False before). Any idea why using broadcasting takes longer than unicasting? |
Beta Was this translation helpful? Give feedback.
-
In hover_launch.py set |
Beta Was this translation helpful? Give feedback.
-
I added the parameter broadcasting_num_repeats to hower_swarm.launch.
This lowered the broadcast response time, but only to ~50ms. There has to be more overhead. It doesn't make sense for the broadcast communication to take the same amount of time as unicast.
|
Beta Was this translation helpful? Give feedback.
-
This overhead might come from a ROS service call. At least the broadcast now takes a bit less time than the unicast. For other commands, we use ROS topics which should have lower latency. My recommendation would be to change the firmware to set the motor speed using one of the existing |
Beta Was this translation helpful? Give feedback.
-
@whoenig
How can it be faster? I thought they used the same communication method? |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am attempting to use a MPC controller computed on my laptop running Ubuntu 20.04 to control a single CrazyFlie 2.0. My controller takes the state of the cf from CrazySwarm using a Vicon tracker. This state is then sent to my MPC controller running as a ROS node which computes the control action as the activation of individual motors on the quadcopter [u1, u2, u3, u4] (The motor configuration on the cf matches my model inside MPC). The computed control action is then relayed using cf.setParam("motorPowerSet/m{i}", u[i]) to the CrazySwarm server (hover_swarm.launch).
The problem I encountered is that the time it takes for the CrazySwarm server to update the parameters is longer than I expected. The execution of the motorPowerSet method takes approximately 60ms. On the CrazySwarm side, each parameter update takes ~15ms.
`
[ INFO] [1678358488.277826005]: [cf4] Update parameters
[ INFO] [1678358488.296228588]: [cf4] Update parameters
[ INFO] [1678358488.311242723]: [cf4] Update parameters
[ INFO] [1678358488.325518071]: [cf4] Update parameters
[ INFO] [1678358488.339628882]: [cf4] Update parameters
[ INFO] [1678358488.359660311]: [cf4] Update parameters
`
This control frequency is too low to control the crazyflie, except for exceptionally slow and careful liftoff (the cf still crashes quickly). My question is whether there is any plausible solution to this problem. Is it reasonable to try to connect more than 1 Crazyradio PA and have each one handle setParam for 1 motor each? Or could latency be improved by using CFLib directly, instead of using CrazySwarm as the API?
I estimate I would need at least 50Hz control frequency to achieve adequate performance. Right now, i am at 16Hz. Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions