PX4-Autopilot icon indicating copy to clipboard operation
PX4-Autopilot copied to clipboard

crsf_rc: add bind command

Open benjinne opened this issue 1 year ago • 4 comments

Solved Problem

Ability to bind using the crsf protocol

Fixes https://github.com/PX4/PX4-Autopilot/issues/23281

Solution

  • based on spectrum bind method in rc_input and bind packet from betaflight source code
  • adds capability to the crsf_rc module using cli or vehicle_command

Changelog Entry

For release notes:

crsf_rc: add bind command

Alternatives

Add to rc_input module if needed

Test coverage

  • [x] todo test on hardware

I assume vehicle command to bind comes from QGC and we may need to update QGC's UI

benjinne avatar Jun 18 '24 14:06 benjinne

@dagar I've tested and verified that this works. I verified both crsf_rc bind and using the spectrum bind button in QGC works although any spectrum option will work and it's a bit confusing. We'll need to update QGC to have a generic bind for crossfire and ELRS receivers.

benjinne avatar Jun 25 '24 17:06 benjinne

The https://mavlink.io/en/messages/common.html#MAV_CMD_START_RX_PAIR message that this hooks into assumes you're going to specify a type of RC. If it is possible to have multiple radios that might pair on a vehicle then you should add ELRS as an option to https://mavlink.io/en/messages/common.html#RC_TYPE and check the command for the type being set.

hamishwillee avatar Aug 21 '24 23:08 hamishwillee

QGC assumes Spektrum RC because that is the only thing that is supported by the message. Do you plan to update that section of QGC to allow ELRS to to be configured too? If not, how were you expecting this to be called?

Either way, we should document that this can be used and how in https://docs.px4.io/main/en/config/radio.html#additional-radio-setup

hamishwillee avatar Aug 21 '24 23:08 hamishwillee

The https://mavlink.io/en/messages/common.html#MAV_CMD_START_RX_PAIR message that this hooks into assumes you're going to specify a type of RC. If it is possible to have multiple radios that might pair on a vehicle then you should add ELRS as an option to https://mavlink.io/en/messages/common.html#RC_TYPE and check the command for the type being set.

Yeah I agree. Right now it accepts any bind message since most vehicles just have one RC receiver, but I can imagine having multiple. Not sure when I'll get around to it

QGC assumes Spektrum RC because that is the only thing that is supported by the message. Do you plan to update that section of QGC to allow ELRS to to be configured too? If not, how were you expecting this to be called?

Either way, we should document that this can be used and how in https://docs.px4.io/main/en/config/radio.html#additional-radio-setup

Either with the command-line or with a QGC button. Currently the spektrum bind button works, but it's a little confusing. I'm also not sure when I'll get around to it

benjinne avatar Aug 22 '24 17:08 benjinne

@hamishwillee could you take another look at these changes? I think I addressed all your concerns

benjinne avatar Nov 05 '24 18:11 benjinne

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-nov-27-2024/42604/1

DronecodeBot avatar Nov 27 '24 17:11 DronecodeBot