TransWikia.com

differential drive vehicle in screen coords

Engineering Asked by zed_eln on January 3, 2021

differential drive vehicle in world frame

what would change in the kinematic model of the differential drive vehicle if i wanted to simulate it
using pygame module in python ( pygame or opencv or any other one )

x_dot = (vl+vr)/2*cos(theta)

y_dot = (vl+vr)/2*sin(theta)

theta_dot = (vr-vl)/w

vr is the velocity of the right wheel

vl is the velocity of the left wheel

theta is the heading angle

it uses a screen coords system which start at the top left corner of the screen insted of the lower left
my initial guess is since only the y axis is inverted then i should invert the sign of the y_dot

i hope i explained my question clearly the picture is in the link above

One Answer

The kinematics equation should remain the same. The only problem I see is with the third equation which should be

theta_dot = (vr-vl)/W

What you need to consider on top of those equations since you are working with screen pixels is:

  • relationship of x and y with screen pixels (units should be $frac{text{x units}}{pixel}$, $frac{text{y units}}{pixel}$ or the inverse).
  • you'd need to add variables for monitoring the position (preferably floats). e.g:
x = 0.0 
y = 0.0 
  • you'd need to integrate in time with respect to the position
x = x+ x_dot*dt
y = y+ y_dot*dt
theta = theta+ theta_dot*dt

where dt is the timestep you want to use.

  • then you'd just need to redraw the vehicle at the orientation of theta (after you cast x, y to integers).

Correct answer by NMech on January 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP