flipping the motor direction in the firmware.

Post here to get support
Post Reply
cafeciaojoe
Member
Posts: 83
Joined: Mon Jun 18, 2018 2:37 am

flipping the motor direction in the firmware.

Post by cafeciaojoe »

Hi,

I am looking to reverse the direction of the motors such that the motors can be mounted upside down, but the chassis remains the same.

From this old post viewtopic.php?p=16079#p16079 Tobias flipped the signs in the powerDistribution function definition.
tobias wrote: Fri Feb 01, 2019 11:07 am I gave it a quick shot and it this worked.

Then since it is now up-side-down I flipped M1.M4 and M2,M3 in power distribution

Code: Select all

void powerDistribution(const control_t *control)
{
...    
    motorPower.m4 = limitThrust(control->thrust - r + p + control->yaw);
    motorPower.m3 = limitThrust(control->thrust - r - p - control->yaw);
    motorPower.m2 =  limitThrust(control->thrust + r - p + control->yaw);
    motorPower.m1 =  limitThrust(control->thrust + r + p - control->yaw);
...
I also tried

Code: Select all

    
    motorPower.m4 = limitThrust(-control->thrust - r + p + control->yaw);
    motorPower.m3 = limitThrust(-control->thrust - r - p - control->yaw);
    motorPower.m2 =  limitThrust(-control->thrust + r - p + control->yaw);
    motorPower.m1 =  limitThrust(-control->thrust + r + p - control->yaw);    
This did not work, probably because the problem in this post was also flipping the whole chassis.

NOTE: I can use stock firmware and just reverse polarity of the motors, flip them upside down, then keeping the props facing the same direction. But i would prefer to do it in the firmware than always be flipping the polarity of the plugs.
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: flipping the motor direction in the firmware.

Post by kristoffer »

What about swapping the propellers?
cafeciaojoe
Member
Posts: 83
Joined: Mon Jun 18, 2018 2:37 am

Re: flipping the motor direction in the firmware.

Post by cafeciaojoe »

that does get the drone off the ground, but the yaw is uncontrollable. it spins really fast then crashes.
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
wydmynd
Member
Posts: 87
Joined: Thu Dec 06, 2018 9:25 am

Re: flipping the motor direction in the firmware.

Post by wydmynd »

I think you need to flip something in the IMU too
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: flipping the motor direction in the firmware.

Post by kristoffer »

I did a quick test and it actually works pretty well :-)
I flipped the motor mounts up-side down (and flipped the propellers to keep the convex side up) and swapped the A and B propellers.

Since the motors are spinning in the other direction you have to change the sign of the yaw in the power distribution

motorPower.m1 = limitThrust(control->thrust - r + p - control->yaw);
motorPower.m2 = limitThrust(control->thrust - r - p + control->yaw);
motorPower.m3 = limitThrust(control->thrust + r - p - control->yaw);
motorPower.m4 = limitThrust(control->thrust + r + p + control->yaw);

If you put the battery under the CF you move the center of mass down to a better position which makes the platform more stable

This was fun!
cafeciaojoe
Member
Posts: 83
Joined: Mon Jun 18, 2018 2:37 am

Re: flipping the motor direction in the firmware.

Post by cafeciaojoe »

:oops:

Well yes that makes a lot of sense Thanks for that!
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
Post Reply