irsim.lib.algorithm.kinematics#

This file is the implementation of the kinematics for different robots.

reference: Lynch, Kevin M., and Frank C. Park. Modern Robotics: Mechanics, Planning, and Control. 1st ed. Cambridge, MA: Cambridge University Press, 2017.

Functions#

differential_kinematics(→ numpy.ndarray)

Calculate the next state for a differential wheel robot.

ackermann_kinematics(→ numpy.ndarray)

Calculate the next state for an Ackermann steering vehicle.

omni_kinematics(→ numpy.ndarray)

Calculate the next position for an omnidirectional robot.

omni_angular_kinematics(→ numpy.ndarray)

Calculate the next state for an omnidirectional robot with angular velocity.

Module Contents#

irsim.lib.algorithm.kinematics.differential_kinematics(state: numpy.ndarray, velocity: numpy.ndarray, step_time: float, noise: bool = False, alpha: list[float] | None = None) numpy.ndarray[source]#

Calculate the next state for a differential wheel robot.

Parameters:
  • state – A 3x1 vector [x, y, theta] representing the current position and orientation.

  • velocity – A 2x1 vector [linear, angular] representing the current velocities.

  • step_time – The time step for the simulation.

  • noise – Boolean indicating whether to add noise to the velocity (default False).

  • alpha – List of noise parameters for the velocity model (default [0.03, 0, 0, 0.03]). alpha[0] and alpha[1] are for linear velocity, alpha[2] and alpha[3] are for angular velocity.

Returns:

A 3x1 vector [x, y, theta] representing the next state.

Return type:

next_state

irsim.lib.algorithm.kinematics.ackermann_kinematics(state: numpy.ndarray, velocity: numpy.ndarray, step_time: float, noise: bool = False, alpha: list[float] | None = None, mode: str = 'steer', wheelbase: float = 1) numpy.ndarray[source]#

Calculate the next state for an Ackermann steering vehicle.

Parameters:
  • state – A 4x1 vector [x, y, theta, steer_angle] representing the current state.

  • velocity – A 2x1 vector representing the current velocities, format depends on mode. For “steer” mode, [linear, steer_angle] is expected. For “angular” mode, [linear, angular] is expected.

  • step_time – The time step for the simulation.

  • noise – Boolean indicating whether to add noise to the velocity (default False).

  • alpha – List of noise parameters for the velocity model (default [0.03, 0, 0, 0.03]). alpha[0] and alpha[1] are for linear velocity, alpha[2] and alpha[3] are for angular velocity.

  • mode – The kinematic mode, either “steer” or “angular” (default “steer”).

  • wheelbase – The distance between the front and rear axles (default 1).

Returns:

A 4x1 vector representing the next state.

Return type:

new_state

irsim.lib.algorithm.kinematics.omni_kinematics(state: numpy.ndarray, velocity: numpy.ndarray, step_time: float, noise: bool = False, alpha: list[float] | None = None) numpy.ndarray[source]#

Calculate the next position for an omnidirectional robot.

Uses body-frame velocity: the two components are forward and lateral speeds relative to the robot heading (theta). Since omni robots have no yaw control, theta remains unchanged.

Parameters:
  • state – A 3x1 vector [x, y, theta] representing the current state.

  • velocity – A 2x1 vector [forward, lateral] in body frame.

  • step_time – The time step for the simulation.

  • noise – Boolean indicating whether to add noise to the velocity (default False).

  • alpha – List of noise parameters for the velocity model (default [0.03, 0.03]).

Returns:

A 3x1 vector [x, y, theta] representing the next state.

Theta is preserved unchanged.

Return type:

next_state

irsim.lib.algorithm.kinematics.omni_angular_kinematics(state: numpy.ndarray, velocity: numpy.ndarray, step_time: float, noise: bool = False, alpha: list[float] | None = None) numpy.ndarray[source]#

Calculate the next state for an omnidirectional robot with angular velocity.

Uses body-frame velocity: the first two components are forward and lateral speeds relative to the robot heading, and the third is yaw rate.

Parameters:
  • state – A 3x1 vector [x, y, theta] representing the current position and orientation.

  • velocity – A 3x1 vector [forward, lateral, yaw_rate] in body frame.

  • step_time – The time step for the simulation.

  • noise – Boolean indicating whether to add noise to the velocity (default False).

  • alpha – List of noise parameters [alpha_fwd, alpha_lat, alpha_yaw] (default [0.03, 0.03, 0.03]). Each value scales the standard deviation for the corresponding velocity channel.

Returns:

A 3x1 vector [x, y, theta] representing the next state.

Return type:

next_state