Page 1 of 1
simulate a differential with 2 motors
Posted: 20 Mar 2012, 21:30
by littletim979
I want to build a robot that workd similary to this one:
http://www.nxtprograms.com/NXT2/race_car/index.html you'll notice that it has 2 motors in the back and a steering motor in the front, when steering the 2 back motors turn at different speeds, simulating a differential, the only problem is that they have it pre programmed and it only goes three directions, left, right, straight, no "in between" so it's very jerky and unrealistic. i want to program a robot that would be controlled by a remote control and would have an "in between". how would i program the changing motor speeds?
Re: simulate a differential with 2 motors
Posted: 21 Mar 2012, 00:01
by mattallen37
Feed the steering value into an offset for the drive motors. Add the offset to one motor, and subtract it from the other. You will need to multiply or divide the steering value, based on your robot's physical design.
Re: simulate a differential with 2 motors
Posted: 21 Mar 2012, 00:01
by aswin0
You will have to get speed ratio as a function of steering angle. This is how to get this done.
Draw your car and fill in dimensions. studs or cm doesn't matter. Just be consequent. Front wheels in an angle. Draw lines through each of the axis. They will come together in one point. If not investigate Ackerman steering. Find formula that calculates speed ratio of the back wheels starting with motor encoder of the front steer. Follow these steps.
1 translate encoder to steering angle.
2 calculate radius of the turning circle for each of the wheels use steering angle, length and with of the wheel base.
3 the speed ratio between any pair of wheels is given by the deviding their radius.
4 set wheel speed according to speed ratio.
Re: simulate a differential with 2 motors
Posted: 21 Mar 2012, 08:33
by pepijndevos
Re: simulate a differential with 2 motors
Posted: 25 Mar 2012, 17:40
by littletim979
What i was really looking for was a equation to take the posision of the first motor and convert it to two motor speeds
Re: simulate a differential with 2 motors
Posted: 25 Mar 2012, 23:02
by aswin0
We can't give you the equation. It all depends on the geometry of your car. But above I explained how to get the equation. But if you post a drawing I'll help you further.
Re: simulate a differential with 2 motors
Posted: 26 Mar 2012, 02:03
by hassenplug
The simple solution would be something like what Matt said. Given the speed you want the motors to go (average), take the steering value, multiply it by some constant, and add it for one motor, subtract it for the other.
To find the exact constant, do the stuff aswin0 was explaining. Or guess.
If you number is too small, the robot won't turn well. If it's too large, it will try to turn too sharp.
Steve