I am trying to modify the Px4 firmware for a quadrotor that has bidirectional motors, to enable inverted flight (so that the quadrotor can fly upside down). The basic principle is that since the motors can operate in both directions, the scaling for the output PWM has changed. Normally, 1000 is the minimum PWM corresponding to no power, 2000 is the maximum PWM corresponding to full power. With the bidirectional motors, 1000 corresponds to full power in the reverse direction, and thus the middle value, 1500 results in no power. I have configured the ESC’s for the bidirectional capability using BLHeli, and now I’m trying to understand how to account for this in the firmware. I have been trying to understand the file mixer_multirotor.cpp, to see if I can modify the mapping of the outputs to the range [-1,1], and have not had much success. I’ve also looked through mc_att_control_main.cpp, pwm.cpp, pwm_limit.c and motor_ramp.cpp. It’s a bit confusing and I don’t fully understand the process to get from the controller to the commands actually sent to the actuators. If someone can clarify any of this or point me in the right direction it would be much appreciated.
Have you looked at
It should have all that you need.
No need to look at any .cpp files at all. Just write a new mixer (maybe create a new airframe because why not) and should be good to go (but make sure you test it safely ofc)
I am having a similar problem with a bidirectional motor. It clips the negative range [1000,1500), or when reversed, clips the positive range (1500, 2000]. I have read both documents but its not clear to me what is happening.
do you have any logs? When you say clips you mean it doesn’t output in that range when in a certain mode etc?
I have no experience with bidirectional robots, but I believe that all it requires is for the correct PWM to be sent to the motor or ESC. And if the mixer is properly built then it shouldn’t be an issue.
You two just need to figure out when do you want the the motor to reverse and write the respective mixer (the mixer writing part is in the links I sent explained).
I am having the same problem.
I am using a custom airframe - UGV - and have tried many different mixer combinations and continue to see that when negative values are given by the RC controller the PWM out does not reflect those values. This only happens on the throttle channel, other servos and channels respond as expected. I have tried multiple mixer control groups including the straight passthrough which also did the same thing.
I have also tried incorporating VTOL attitude control, specifically trying to get the VT_B_TRANS_THR parameter as in the text it says "3D ESCs assume 0 thrust at 50% throttle, positive (forward) thrust above 50% and negative thrust (reverse) below 50%. " and this is exactly the type ESC I am using. Note, no luck with this endeavor.
I am not sure where to go next in trying to troubleshoot this issue. I know I have put in about 20+ hours trying to troubleshoot the issue and would love to hear some other ideas.
I think coreysmiles has it right ->
It seems multiple people are encountering this issue, so any guidance and direction would be much appreciated.
If you succeed with your project let us know because I wonder how quad will behave if you put him upsidedown, I mean from physical point of view it would be very hard to stop motors and make them run to reverse so quickly that quadcopter will not fall few meters down or crush. Propeller and motor’s momentum is very high, so to stop such a force even if diameter and weight of it is small will influence rapidly bearing lifetime and inrush currents would be overloading everything -ESC, motor windings and battery.
Wouldn’t be better, simpler and more reilable to do the same propeller controller system like in the helicopter?
@Shea have you tried it on a non-throttle channel? I used control group 0 and ran my bidirectional ESC on the yaw channel by physically changing the hardware connection. I am able to get the expected response or rotors turning one direction and then the other. I do not know why it doesn’t seem to work on the throttle channel.
@BUZER, I agree. That’s sort of what I am wanting to look at. Using the bidirectional motor I expect would make this very feasible. I just don’t understand why the throttle channel appears to be treated differently and how this can be changed.
I was successful getting the full PWM range corresponding the RC using another channel. I swapped the wiring and was able to control the esc/motor as intended using the RC. Problem is running a Mission, which would be the next step. The esc/motor needs to be on channel 3 for throttle control and that is the channel I cannot get to work properly.
Good point. I don’t understand why the channels aren’t configured the same such that the user could define their behavior. Do you think this potentially qualifies a reportable bug in the firmware?
if you search for the omnicopter videos you will see how the motors change directions mid flight. However that system is overactuated so if one engine is down for an instant it doesnt really matter much. So I’m curious for this aswell. However I believe that the direction reversal is not as slow as you’d think