DifferentialKinematics

io.github.srs.model.entity.dynamicentity.actuator.DifferentialKinematics

DifferentialKinematics provides methods to compute the kinematics of a differential drive robot.

It includes methods to compute wheel velocities, robot velocities, and the new position and orientation of the robot based on its current state and wheel speeds.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def computePositionAndOrientation(theta: Double, dt: FiniteDuration): ((Double, Double)) => (Double, Double, Orientation)

Computes the new position and orientation of the robot based on its current orientation theta and the time.

Computes the new position and orientation of the robot based on its current orientation theta and the time.

  • The new position is computed as:
xNew = x + v * cos(theta) * dt
yNew = y + v * sin(theta) * dt
  • The new orientation is:
thetaNew = theta + omega * dt

Value parameters

dt

the time interval over which the robot moves. This is a FiniteDuration representing the time step for the movement.

theta

the current orientation of the robot in radians.

Attributes

Returns

a function (v, omega) => (dx, dy, newOrientation) that computes the change in position and the new orientation of the robot.

def computeVelocities(wheelDistance: Double): ((Double, Double)) => (Double, Double)

Computes the linear velocity and angular velocity of the robot based on the wheel velocities.

Computes the linear velocity and angular velocity of the robot based on the wheel velocities.

  • The linear velocity of the robot is the average of the two:
v = (vRight + vLeft) / 2
  • The angular velocity (omega) is proportional to the difference of the wheel velocities:
omega = (vRight - vLeft) / d

Where d is the distance between the wheels (assumed to be robot.shape.radius * 2)

Value parameters

wheelDistance

the distance between the left and right wheels.

Attributes

Returns

a function (vLeft, vRight) => (v, omega) that computes the linear and angular velocities of the robot.

Computes the linear velocities of the left and right wheels based on their speeds and radii.

Computes the linear velocities of the left and right wheels based on their speeds and radii.

The linear velocity of each wheel is obtained by:

vLeft = left.speed * left.radius
vRight = right.speed * right.radius

Attributes

Returns

a function that takes a DifferentialWheelMotor and returns a tuple containing the linear velocities of the left and right wheels.