Servers by jDrones

Motor direction, differential drive


(flavia) #1

Hi, I would like to build a catamaran without a steering servo but rather with 2 motors (left+right) for the steering, like a differential drive.

I have got a pxfmini with a raspberry pi3.

I executed and compiled this code and everything works fine, now I want to change the code to control two motors instead of a motor and a servo.

I would like to change the class ErleRoverManager so I can use two motors. Do you think it’s a good idea add a method, for example that allow the catamaran to turn left or right thanks to differential drive? (void ErleRoverManager::turnLeft() could set a velocity and a direction on the motorA and the same velocity but opposite direction on the motorB )
If both the wheels are driven in the same direction and speed, the robot will go in a straight line. If both wheels are turned with equal speed in opposite directions, the robot will rotate about the central point of the axis.
So how can I control the direction of the motors with APM planner or through the code?
And also, when I have to override the channels can I do this, since I don’t have any servo??

msg_override.channels[0] = erlerover_manager.getLinearVelocityA(); // motorA
msg_override.channels[1] = 0;
msg_override.channels[2] = erlerover_manager.getLinearVelocityB(); //motorB
msg_override.channels[3] = 0;
msg_override.channels[4] = 0;
msg_override.channels[5] = 0;
msg_override.channels[6] = 0;
msg_override.channels[7] = 0;


(gmorph) #2

If your using the Erle robotics code then your question should be posted on their forum as we don’t have that code in our system.

However, if you use the standard version of ArduPilot then supports what your after. We call it skid steering. The latest Rover release has improved how it works and some information is available at the bottom of the release notes here.
https://discuss.ardupilot.org/t/rover-3-2-0-rc1-is-available-for-beta-testing/20389

Thanks, Grant.