Finding the position of a differential drive robot

In summary: T=(6-0)/3000;% the following three lines give original robot position coordinatesx(1)=55;y(1)=60;theta(1)=0;L=30; % distance between the wheelsvL=2; % left wheel speedvR=2.5; % right wheel speedfor k=1:3000 theta(k+1)=(((vL-vR)/L)).*deltaT+theta(k); x(k+1)=(vR*cos(theta(k))*deltaT
  • #1
PainterGuy
940
69
Data:
The speed of right wheel is considered to be 25 RPM.
The speed of left wheel is considered to be 20 RPM.
The distance, L, between wheels is 30 cm.
Also the radius, r, of each wheel is 6 cm.

Question:
Using the data above for a differential robot, find the following:

i: angular velocity of robot

ii: linear velocity of robot

iii: find location of the ICC/ICR

iv: Suppose the robot's original configuration is given by the coordinates
(55 cm, 60 cm, 0°). Find the position and orientation after 6 s.

I need help with part iv.

I tried to use Euler's approximation for part iv.

$$x(k+1)=\left[ \frac{v_{L}+v_{R}}{2}\cos \left\{ \theta (k\right\} \right] \Delta T+x(k)$$

$$y(k+1)=\left[ \frac{v_{L}+v_{R}}{2}\sin \left\{ \theta (k\right\} \right] \Delta T+y(k)$$

$$\theta (k+1)=\left[ \frac{v_{L}+v_{R}}{L}\right] \Delta T+\theta (k)$$

I tried to solve it here. Please jump to the part iv at the bottom. I tried to implement it in Matlab but it looks like something is wrong. I understand that there would be far better ways to write the code but I wanted to know if my method is okay. Could you please help me with it? The way I did it x(k+1) and y(k+1) give total distance moved but aren't x(k+1) and y(k+1) supposed to give coordinates of the point the robot is at after 6 seconds?

Matlab:
clear all; close all; clc;

k=linspace(0,6,200);
theta(1)=0;
deltaT=(6-0)/200;
x(1)=55;
y(1)=60;
L=30;
vL=2;
vR=2.5;

for k=1:200
    
    theta(k+1)=(((vL-vR)/L)).*deltaT+theta(k);
    x(k+1)=(((vL+vR)./2).*cos(theta(k)))*deltaT+x(k);
    y(k+1)=(((vL+vR)./2).*sin(theta(k)))*deltaT+y(k);
    
end

sum(x)
sum(y)
sum(theta)
 

Attachments

  • diff_drive_euler.jpg
    diff_drive_euler.jpg
    42.9 KB · Views: 241
Physics news on Phys.org
  • #2
Is this a homework problem?

The robot will take a circular path. Knowing the separation and RPM of the two wheels you can linearly extrapolate to the centre of the circular path.
 
  • Like
Likes PainterGuy
  • #3
Thank you!

I'd say you can call it homework.

You are correct that the robot will take circular path around ICR point assuming same angular velocity along the circular path.

The angular velocity I found is:
ω=1. 6668×10⁻² rad/s ; or, in degress 1. 6668×10⁻²×57.3= 0.95508°

So, in 6 seconds angular distance traveled is almost 3.4×10⁻² rad/s or 6°. I hope I have it correct.

I think that the following code is better. There is clearly something wrong. I'm not sure about the values of "x" and y but the value of theta cannot be " -0.1000" as given in the output. Could you please helpe?

Matlab:
clear all; close all; clc;

k=linspace(0,6,3000);
theta(1)=0;
deltaT=(6-0)/3000;
x(1)=55;
y(1)=60;
L=30;
vL=2;
vR=2.5;

for k=1:3000
   
    theta(k+1)=(((vL-vR)/L)).*deltaT+theta(k);
    x(k+1)=(((vL+vR)./2).*cos(theta(k)))*deltaT+x(k);
    y(k+1)=(((vL+vR)./2).*sin(theta(k)))*deltaT+y(k);
   
end

x(3000)
y(3000)
theta(3000)

Output:
Matlab:
ans =

   68.4730ans =

   59.3262ans =

  -0.1000
 
  • #4
The Minus sign is easy. Look at vL & vR in lines 9, 10; then look at how they are used in line 14.

Cheers,
Tom
 
  • #5
Thanks!

But it looks wrong.

The original statement is follows:
iv: Suppose the robot's original configuration is given by the coordinates
(55 cm, 60 cm, 0°). Find the position and orientation after 6 s.

The right wheel has greater speed than the left wheel therefore the robot rotates clockwise. It would mean that the value of "x" should decrease and value of "y" should increase. But the output shows the value of "x" going up and value of "y" going down.
 
  • #6
First, the convention for angles needs to be defined. Are you defining angle of robot orientation to increase in the clockwise or counter-clockwise direction?

See if you can find a tapered bottle, or anything that approaches a cone. Roll up and tape a sheet of paper if you can't find anything else. Lay it on its side on a flat surface in front of you with the large end to the right. Now roll it away from you (forward direction).

The different diameters of the cone are equivalent to the different wheel speeds, i.e. the big end, on the right, travels more distance in unit time than the small end travels.

Which output and lines-of-code represent which things asked for in the problem?

Cheers,
Tom
 
  • Like
Likes Lnewqban and PainterGuy
  • #7
Thanks.

Tom.G said:
First, the convention for angles needs to be defined. Are you defining angle of robot orientation to increase in the clockwise or counter-clockwise direction?

Counterclockwise.

Tom.G said:
The different diameters of the cone are equivalent to the different wheel speeds, i.e. the big end, on the right, travels more distance in unit time than the small end travels.

Agreed. The right wheel would travel more distance as its speed is greater.

Tom.G said:
Which output and lines-of-code represent which things asked for in the problem?

Matlab:
clear all; close all; clc;

k=linspace(0,6,3000); % dividing 6s time interval into 3000 steps
deltaT=(6-0)/3000;

% the following three lines give original robot position coordinates
x(1)=55;
y(1)=60;
theta(1)=0;

L=30; % distance between the wheels
vL=2; % left wheel speed
vR=2.5; % right wheel speed

for k=1:3000
  
    theta(k+1)=(((vL-vR)/L)).*deltaT+theta(k);
    x(k+1)=(((vL+vR)./2).*cos(theta(k)))*deltaT+x(k);
    y(k+1)=(((vL+vR)./2).*sin(theta(k)))*deltaT+y(k);
  
end

x(3000) % I think x(3000) represent end x-coordinated after 6s
y(3000)
theta(3000)

Matlab:
ans =

   68.4730  % x coordinateans =

   59.3262  % y coordinateans =

  -0.1000  % theta coordinate
 
  • #8
It seems that there is an error in the calculations of the angular velocity of each wheel, as rpm were converted to rad/s.
According to my calculations:

##\omega_L=2.094~rad/s##
##\omega_R=2.618~rad/s##

Arc described by each wheel should be 12.56 cm/s for left wheel and 15.70 cm/s for right one.

Radius of rotation around a common vertical axis should be 142.73 cm for left wheel and 172.73 cm for right one.

If all the above is true, the angular velocity of the robot about that vertical axis should be 0.089 rad/s.
In 6 seconds, it should sweep a counter-clockwise angle of 0.534 rad or 30.6° measured from the original position and orientation.
 
Last edited:
  • Like
Likes PainterGuy
  • #9
Lnewqban said:
It seems that there is an error in the calculations of the angular velocity of each wheel, as rpm were converted to rad/s.
According to my calculations:

ωL=2.094 rad/s
ωR=2.618 rad/s

Thank you for pointing out this mistake. I have fixed it and got the right answer after making some changes to the code.
 
  • Like
Likes Lnewqban
  • #10
You are welcome :smile:

Happy to help, just noted that error.
Sorry I can’t help you with ii, iii or iv.
 
  • Like
Likes PainterGuy

1. How does a differential drive robot determine its position?

A differential drive robot uses a combination of wheel encoders and inertial sensors to determine its position. The wheel encoders measure the rotation of each wheel, while the inertial sensors measure the robot's orientation and movement in space. By combining this information, the robot can calculate its position in a given environment.

2. What is the difference between odometry and localization in a differential drive robot?

Odometry refers to the use of wheel encoders to track the robot's movement and estimate its position. Localization, on the other hand, involves using external sensors and landmarks to accurately determine the robot's position in a given environment. While odometry is a simpler and more cost-effective method, it can lead to errors over time, whereas localization provides more accurate and reliable results.

3. How does a differential drive robot handle obstacles in its path?

A differential drive robot can use a variety of techniques to handle obstacles in its path. These include using sensors such as ultrasonic or LiDAR to detect obstacles and adjust its path accordingly, implementing a path planning algorithm to navigate around obstacles, or using a combination of both methods.

4. Can a differential drive robot accurately determine its position in any environment?

While a differential drive robot can accurately determine its position in most environments, there are certain factors that can affect its performance. These include uneven or slippery surfaces, uneven lighting conditions, and the presence of strong magnetic or electrical fields. In such cases, the robot may experience errors in its position estimation.

5. How can the accuracy of a differential drive robot's position be improved?

The accuracy of a differential drive robot's position can be improved by using more advanced sensors and algorithms, such as incorporating GPS or visual odometry, implementing sensor fusion techniques, and regularly calibrating the robot's sensors. Additionally, optimizing the robot's design and using high-quality components can also contribute to improved accuracy.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
10
Views
910
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Special and General Relativity
Replies
2
Views
608
  • Advanced Physics Homework Help
Replies
4
Views
938
  • Calculus and Beyond Homework Help
Replies
3
Views
497
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
538
  • Introductory Physics Homework Help
Replies
15
Views
292
Back
Top