feat/led deck commands and reboot service - #866
Conversation
|
Thanks for cleaning up your PR!
|
|
Hi Professor, 1. Reboot: One problem I see with adding a reboot service is that it has unexpected side effects: the drone will be reset and the “commands” written in crazyflies.yaml—setting parameters and configuring logging—will be lost after the reboot. It may be possible to execute this logic after a reboot, similarly to what happens when initially starting crazyflie_server, but when I experimented with that in the past, it caused firmware crashes due to race conditions. I have been using this reboot functionality locally for more than two years and have tested it with both the Crazyflie 2.1 and the Crazyflie Brushless. 2. Connection fix: Could you describe again what happens without your changes? In particular, it is unclear to me how the radio-statistics changes would fix a connectivity issue. There are two separate issues, and my original PR description did not distinguish them clearly enough. [C24] Unexpected number of broadcast packets. The crazyflie_server would hang here and never initialize. The first status callback then calculated: Because the previous values were indeterminate, the first computed delta could be invalid. I therefore initialized the counters and connection-statistics objects: I also added a first-sample flag. On the first status callback, the current cumulative counters are stored as the baseline, and no delta is calculated (this makes the lines , The last output is: When I skip I am still investigating why the memory TOC request does not complete with this firmware and deck configuration, and how to properly solve that. I also do not yet know why installing the deck made the uninitialized-counter issue visible. The variables were already uninitialized regardless of the deck. My current hypothesis is that the deck changes the firmware startup timing, the available TOCs, or the timing of the first status callback, thereby exposing an existing bug. I do not yet have evidence for a specific causal mechanism. The decks are relatively new, and we previously encountered a separate firmware compatibility issue involving the Crazyflie Brushless and the hardware batch we received. Bitcraze replaced those decks after identifying the issue. I mention this only as context; I cannot yet conclude that the current memory TOC problem has the same cause. 3. LED command topic: The new cmd_led topic seems to be a convenience function that converts a string to a uint32, followed by setting one parameter. Perhaps this belongs in the crazyflie_py layer rather than the server? I added the topic to the C++ server for two reasons: That said, I agree that a string containing a hexadecimal color is primarily a convenience interface. A more general solution might be to expose a typed LED message, a service, or a generic parameter-setting interface, while implementing convenience wrappers in the Python layer. I am happy to implement any of those if you could provide me with more guidance on what the best option is. I also have a standalone Python example that connects to one Crazyflie and controls the LED deck. I can commit it if an example of that form would be useful, although it cannot run concurrently with crazyflie_server if both attempt to own the same radio connection. Please let me know which parts you would prefer me to keep in this PR. I am happy to separate the independent fixes into smaller PRs—for example, one for initializing the statistics correctly and another for LED control. Thank you again for your feedback. This is my first contribution an open-source project, so I am still becoming familiar with the contribution and review process. I appreciate your guidance and am excited to improve the PR accordingly. |
|
Thanks for the detailed response! Moving forward, I suggest the following:
Com issues: Which radio and firmware are you using? I have seen this problems as well (they are caused by a longstanding bug in the firmware), but I was not able to reproduce such issues with Crazyradio2 and the latest firmware anymore. |
|
Thank you again for the feedback.
Moreover, I understand that the reboot service and the LED command topic may be too specific for my application. Regarding the Com issue: I am using the Crazyradio2 and the latest firmware, but I only encountered the issue after attaching the LED deck and fixing the stats issue. |
Hello. Now, I crated the PR using the original main branch as the base. I added two features: the LED deck commands topic and a service to reboot the CFs.
When attaching the LEDs to the drones, I noticed that the crazyflie_server wouldn't stablish connection with them due to a highest information exchange, which would increas the latency. To fix that, I added lines 175 to 180, commented out line 550, and added lines 1009 to 1016.