-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
add support for RC in AP_Periph #23805
add support for RC in AP_Periph #23805
Conversation
Conversation from Discord:
|
|
Update from more convo on Discord: Peter has perhaps talked me off the ledge of arbitrary channel precision, with the justification that control channels, for practical purposes, may not need more than 11 (or 12?) bits. I'm unable to come up with a counter-example. My latest best-shot at what a config looks like may be something like this: struct Config {
/// Divide the update rate transmitted over the radio link by this. So, 1 means transmit every
/// RC packet received. 2 means transmit every other update, etc. 0 means don't transmit.
broadcast_ratio: u8,
/// Number of 12-bit channels, ie for control-channel-data
num_high_precision_channels: u8,
/// Number of 5-bit channels, eg for selecting from a number of options
num_5_bit_channels: u8,
num_4_bit_channels: u8,
/// Multi-position switches. For example, for setting flight mode
num_3_bit_channels: u8,
/// Eg 3-position switches
num_2_bit_channels: u8,
/// Eg 2-position switches
num_1_bit_channels: u8,
} Data would be transmitted in the order listed, with no padding. So, if configured for Here's more background chat where Hydra and I proposed a more flexible (and complicated) protocol: dronecan/DSDL#21 |
This is an example of a minimalist RC input packet. Notionally we could send 5 11 bit values in a single packet with this same format but nobody uses only 5 channels. edit: added num_valid_channels
|
how about this:
|
I think RSSI would be a better fit for a separate link stats packet type. It would include info like RSSI, % of recent packets received, signal strength, xmitter power, active antenna etc. |
So for 10 channels coming in:
... just a little too much? |
it is just as likely to be 12 or 16 channels |
maybe uint16 status, so we can support things like "STATUS_SUPPORTS_FRSKY" etc |
This is for an on-the-wire protocol, yes? Unless bandwidth is a major factor, why not just keep it simple and have an arbitrary number of 12-bit channels plus a header for random stuff? And I think we'd want to support diversity receivers, so two separate rssi values and an "active antenna" bit might make sense. |
After some thinking, an arbitrary num of 12-bit channels as Tridge proposed would be fine. Would be a bit heavy if some of the channels are for 2-bit switches, but maybe that's OK, and better from a simplicity perspective. Or agree on a packing protocol between FC firmware and Rx nodes as a backup. For a linkstats packet, thoughts on something like this? This is the CRSF one, which is a good baseline. #[derive(Default)]
/// https://www.expresslrs.org/3.0/info/signal-health/
pub struct LinkStats {
/// Timestamp these stats were recorded. (TBD format; processed locally; not part of packet from tx).
pub timestamp: u32,
/// Uplink - received signal strength antenna 1 (RSSI). RSSI dBm as reported by the RX. Values
/// vary depending on mode, antenna quality, output power and distance. Ranges from -128 to 0.
pub uplink_rssi_1: u8,
/// Uplink - received signal strength antenna 2 (RSSI). Second antenna RSSI, used in diversity mode
/// (Same range as rssi_1)
pub uplink_rssi_2: u8,
/// Uplink - link quality (valid packets). The number of successful packets out of the last
/// 100 from TX → RX
pub uplink_link_quality: u8,
/// Uplink - signal-to-noise ratio. SNR reported by the RX. Value varies mostly by radio chip
/// and gets lower with distance (once the agc hits its limit)
pub uplink_snr: i8,
/// Active antenna for diversity RX (0 - 1)
pub active_antenna: u8,
pub rf_mode: u8,
/// Uplink - transmitting power. See the `ElrsTxPower` enum and its docs for details.
pub uplink_tx_power: TxPower,
/// Downlink - received signal strength (RSSI). RSSI dBm of telemetry packets received by TX.
pub downlink_rssi: u8,
/// Downlink - link quality (valid packets). An LQ indicator of telemetry packets received RX → TX
/// (0 - 100)
pub downlink_link_quality: u8,
/// Downlink - signal-to-noise ratio. SNR reported by the TX for telemetry packets
pub downlink_snr: i8,
} |
This one does have a bunch of 12-bit values. Interesting point on the dual-rssi values - which RC protocols bare that information? |
e7d0ee8
to
2e306ac
Compare
Doesn't periph require sbus inverter? Very few periphs with H7 breakouts. |
Pretty sure CRSF (used by Crossfire and ELRS and maybe others) does. ELRS recently merged ExpressLRS/ExpressLRS#2143 |
2e306ac
to
6e6f838
Compare
6e6f838
to
f9175e1
Compare
f9175e1
to
32e39d9
Compare
I've flown this on a quadcopter today; MatekL431 node with a Turnigy iBus receiver hanging off it. |
8aef143
to
32ca8c1
Compare
32ca8c1
to
672faa8
Compare
672faa8
to
32ca8c1
Compare
35e2e53
to
7dcd121
Compare
7dcd121
to
69177d3
Compare
69177d3
to
8621bb6
Compare
@@ -563,6 +571,43 @@ const AP_Param::Info AP_Periph_FW::var_info[] = { | |||
GOBJECT(rpm_sensor, "RPM", AP_RPM), | |||
#endif | |||
|
|||
#ifdef HAL_PERIPH_ENABLE_RCIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put back dev call topic - I'd like to discuss creating sub-table in rc_in.cpp, which I think we should do for new features
This currently only allows for instantiation of RC in periph.
We still need a DroneCAN packet format, and an implementation of that both for AP_Periph (sending side) and
AP_RCProtocol_DroneCAN
(receiving side).