-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crazyfly 2.0 on the current master does not connect with QGC #8924
Comments
Hi @barzanisar, I don't have one of these, but I might be able to help you debug and get it working again. Then we need to put something in place to keep it working. |
yes please, thank you! |
Would you like to discuss on the dev call or ping me on slack? |
Looks like there was a regression in the defconfig for this platform. |
Yes it works! Thank you! |
@dennisss There's one more issue, when I arm the motors, they don't rotate. Even when the arming speed "PWM_MIN" parameter is above 1000us. I tried 1100,1200,1400 us. Also, when I give some throttle and a bit of roll or pitch joystick command, the motors that are supposed to rotate with lower speed don't rotate at all. |
@barzanisar make sure that you are using the crazyflie airframe (SYS_AUTOSTART = 4900). The default settings should work and have PWM_MIN, PWM_DISARMED, PWM_MAX set to 0, 0, 255. |
@Denisss we would like to have the props spinning when armed - what is the best way to achieve that? Without it the flight stability is not optimal in extreme maneuvers |
@LorenzMeier if you are referring to spinning props at 0% throttle, then pick your choice of value for PWM_MIN between 0-255 and adjust the value constraints configured here: https://github.com/PX4/Firmware/blob/master/src/drivers/boards/crazyflie/board_config.h#L169 |
Great, thanks! @barzanisar let me know when you need support on that. |
Thanks @dennisss ! When I set PWM_MIN parameter in QGC or PWM_LOWEST_MIN value from Also, the cfbridge does not seem to properly communicate the joystick commands from QGC to CF2. When I use USB connection, joystick commands are sent properly and I can arm, disarm and change flight modes. However, when I use crazyradio PA with cfbridge, sometimes I am not able to arm/disarm. Also, I noticed that when I first connect QGC with CF2 via USB (to calibrate etc) and then unplug usb and connect via crazyradio PA + cfbridge, the following happens: In manual mode, when I arm using joystick, it denies the Arm command (eventhough throttle is zero from joystick). Then when I switch to altitude mode, it switches to LAND and ARMED mode, the motors start spinning fast. I disarm the motors using joystick button, which QGC reads and disarms the motors. This doesn't happen when I reflash the firmware and only connect QGC and CF2 via crazyradio PA and cfbridge, i.e. without using the USB connection. In short, if I flash the firmware, use USB connection and then unplug and use crazyradio PA, QGC is not able to communicate properly with CF2 and I observe the same pattern everytime so it is not a connection lost problem. |
Also, when I first built cfbridge and tried "make run" command, it failed to find the radio. Then I followed the steps in https://github.com/bitcraze/crazyflie-lib-python#setting-udev-permissions to set udev permissions and restarted my computer. cfbridge could then find the radio and radio connected. |
There's a delay of communication between crazyradio and CF2 and it seems like some messages are being dropped and sent late. |
@barzanisar I have noticed the disarm issue in manual flight modes as well, but I am unsure of the exact cause of it. I usually stick to offboard modes, where it is a non-issue for me. Radio loss is a known issue which I believe is due to the Crazyradio PA only being able to receive 31 bytes at a time, so large packets are split. Adding better packet sequencing to the protocol would probably help with this, although right now being conservative with message sending is the best solution I've found so far. |
@bkueng @barzanisar should discuss in the afternoon. I think it needs some cleverness on both sides. |
Update: @LorenzMeier @bkueng @dennisss There were two issues:
Sending less Joystick commands per second allows space for MAV_CMD_COMPONENT_ARM_DISARM command to be sent.
We tried switching to "custom" mode Mavlink from "osd" in https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/rcS#L603 and set the rate to 1000. This was done to ensure that CF2 sends minimal data to QGC and hence the link has enough space for ACK message. "mavlink status" shows that the link has enough bandwidth for ACK message to be sent, yet the cfbridge doesn't receive it. Now the next step I guess is to debug the bitcraze/crazyradio-firmware to see if it receives the ACK message? Any other suggestions? |
Ideas
|
Update: Issue1: COMMAND_ACK sent from CF2 is received into QGC but discarded Observation: After digging into the lower level i.e. in syslink module, I found out that some bytes sent by the Syslink::send_message, are randomly not received by the cfbridge. I printed the bytes received in cfbridge by printing this buffer. For example, vehicle's heartbeat payload (of length 9 bytes) sent from CF2 to QGC is dropped sometimes and only header(10 bytes) and checksum(2 bytes) is received. And if the Ack message is unfortunately sent just after this bad hearbeat message, QGC keeps reading the Ack message thinking of it as the payload of the bad heartbeat in MAVLinkProtocol::receiveBytes and then discards forwarding the message to Vehicle::_mavlinkMessageReceived since the Ack message header is larger than the payload expected for the bad heartbeat. Another possible issue: If some bytes are randomly dropped, it is possible that some bytes of the Ack message are also dropped sometimes. Though I never observed this and only observed payload dropping from heartbeat messages, since of course heartbeat message is more frequently sent. Issue 2: COMMAND_LONG encoding MAV_CMD_COMPONENT_ARM_DISARM sent from QGC is either received partially or not received at all in CF2 Observation: Some messages sent from QGC and then cfbridge are sometimes not received in CF2 (they are dropped). Hence, the arm/disarm command message (that is longer then 32 bytes and hence is split into two messages in UdpClient::read is either not received at all in CF2 (i.e. both messages are dropped) or received partially (one of the messages is dropped) and this behavior appears to be random. |
Discussed in PX4#8924
Solved, see document updated |
@dennisss I have the same problem as in issue #7624 with the current master.
I followed the steps for flashing PX4 on crazyflie 2 from this link: https://docs.px4.io/en/flight_controller/crazyflie2.html
It finished flashing (erase, program, verify), but CF wasn’t able to connect with QGC, so I couldn't calibrate.
I tried the latest master, stable and beta (via QGroundControl as well), all of these finished flashing (erase, program, verify), but again CF wasn’t able to connect with QGC.
Then I did a binary search between the latest master and the commit ca82d36 described in the issue #7658, and found the last working commit: c82deaf Mon Sep 4 11:04:17 2017 that I can flash and connect with QGC, calibrate and so on.
The text was updated successfully, but these errors were encountered: