Software > Software

question about gotta the differential drive robot moving in a curve or circular

(1/1)

letmoon:
Hello,
I am planning to implement a essential path for a drifferential drive robot to move.
Firstly, I need to get it moving in a basic path, curve or circular, for example.
Then, I have some equations to generate this path. But those equations doesn't work very well, and I have modified for several times. But it seems that my work not that efficient. So, I need a help. I know you guys are experts in this problem.

My question is about the condition that I specified two different values to the angular velocity of each wheel. Generally, I checked the result by measuring the distance between the coordinates of each wheel at each time. For example, the right wheel 's coordinate is (xrt0, yrt0) at time t0, and (xlt0,ylt0) for the left one.
Then calculate the distance between two coordinates. It should be the value of b (distance between the two wheels) if the result is correct.
However, my simulation program in matlab has a right result for the condition that I specified two same values to each wheel. But it is incorrect while I specified two different values to two wheels.
I don't whether the method of calculating theta is incorrect or the way to calculate the coordinates of two wheels is incorrect.

Here s my equation.

--- Code: ---vr = wr*r;
vl =  wl*r;
wr and wl are angular velocities of two wheels
r is the radius of each wheel
vr and vl are linear velocities of two wheels

dr = vr*sampleT;
dl = vl*sampleT;
dr and dl are distances that the wheel passed in time sampleT

then calculate the orientation angle of the robot for each time
where b is the distance between two wheels
if(vr>vl)
theta= theta+ dr/(2*PI*(dl*b/(dr-dl)+b);

if(vr<vl)
theta = theta+2*PI-dl/(2*PI*(dr*b/(dl-dr)+b));

then calculate the coordinates of each wheel for each time
if (vr==vl)
{
xl = xl+dl*cos(theta);
yl = yl+dl*sin(theta);
xr = xr+dr*cos(theta);
yr = yr+dr*sin(theta);
}

if (vr!=vl)
{
xl = xl+dl*cos(theta);
yl = yl+dl*sin(theta);
xr = xr+dr*cos(theta);
yr = yr+dr*sin(theta);
}

--- End code ---