PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.41k stars 13.47k forks source link

Dshot 3d support missing #17364

Closed benjinne closed 3 years ago

benjinne commented 3 years ago

Describe the bug The dshot output does not work correctly when using blheli with 3d mode enabled. For example when using a blheli ESC for a rover mixer that supports a bi-directional esc, only pwm works currently. I think this is due to the bottom half of dshot commands being reversed.

I've found several explanations on how this works, and it just needs implemented to work correctly. Copied from here: https://www.swallenhardware.io/battlebots/2019/4/20/a-developers-guide-to-dshot-escs

DShot Bidirectional Motion (3D Mode)
If you enable 3D mode, the throttle ranges split in two.

Direction 1) 48 is the slowest, 1047 is the fastest

Direction 2) 1049 is the slowest, 2047 is the fastest

1048 does NOT stop the motor! Use command 0 for that.

This is working in betaflight. Wiki documentation: https://github.com/betaflight/betaflight/wiki/3D-Setup Small explanation in the betaflight code: https://github.com/betaflight/betaflight/blob/025ee87a7aca068e3659fd066b8a9afbed123361/src/main/drivers/dshot_command.h#L28

Suggested Behavior

  1. Add a DSHOT_3D boolean parameter that changes the dshot behavior as described above
  2. Add deadband parameters as described in the betaflight wiki

Potential Use Cases

  1. My use case is for a rover with 4 independent motors (no servos for steering)
  2. The typical rover with a PWM servo for steering and a dshot esc ( I'm not sure how the mixing would work)
  3. Copters can thrust downwards without flipping upside down, or fly upside down
benjinne commented 3 years ago

This is related to Support normal car ESC with reverse #11992. I have reversing working with a custom mixer mapping my RC controller pitch stick to the motor output (for centering purposes) and throttle set to zero to arm.

bkueng commented 3 years ago

You're right, this is currently not implementent, and the bottom half needs to be inverted. Can you do a PR with your suggesion?

benjinne commented 3 years ago

You're right, this is currently not implementent, and the bottom half needs to be inverted. Can you do a PR with your suggesion?

I would start working on this, but my use case is for a rover, and I don't have Dshot working at all on a Rover. See #17381