irsim.msg.messages#

ROS-style, dependency-free messages for simulation snapshots. Used for exchanging data with ROS and other simulators, and for logging and playback.

The classes in this module are plain dataclasses. They intentionally do not depend on ROS, which keeps them usable in regular Python, learning, and batch simulation workflows while providing familiar topic names and message shapes.

Classes#

Message

Base class that provides JSON-compatible message serialization.

Header

Version-neutral metadata shared by all IR-SIM messages.

Point

ROS geometry_msgs/Point-shaped Cartesian position.

Vector3

ROS geometry_msgs/Vector3-shaped Cartesian vector.

Quaternion

ROS geometry_msgs/Quaternion-shaped orientation.

Pose

ROS geometry_msgs/Pose-shaped position and orientation.

PoseWithCovariance

ROS geometry_msgs/PoseWithCovariance-shaped pose.

Twist

ROS geometry_msgs/Twist-shaped linear and angular velocity.

TwistWithCovariance

ROS geometry_msgs/TwistWithCovariance-shaped velocity.

Odometry

ROS nav_msgs/Odometry-shaped object pose and velocity.

LaserScan

Shared sensor_msgs/LaserScan fields for a LiDAR snapshot.

ObjectState

Topic-shaped messages and simulator metadata for one object.

WorldState

Complete point-in-time state of an IR-SIM environment.

Module Contents#

class irsim.msg.messages.Message[源代码]#

Base class that provides JSON-compatible message serialization.

to_dict() dict[str, Any][源代码]#

Return the complete message as JSON-compatible built-in values.

class irsim.msg.messages.Header[源代码]#

Bases: Message

Version-neutral metadata shared by all IR-SIM messages.

ros_type: ClassVar[str] = 'std_msgs/Header'#
seq: int = 0#
stamp: float = 0.0#
frame_id: str = 'world'#
class irsim.msg.messages.Point[源代码]#

Bases: Message

ROS geometry_msgs/Point-shaped Cartesian position.

ros_type: ClassVar[str] = 'geometry_msgs/Point'#
x: float = 0.0#
y: float = 0.0#
z: float = 0.0#
class irsim.msg.messages.Vector3[源代码]#

Bases: Message

ROS geometry_msgs/Vector3-shaped Cartesian vector.

ros_type: ClassVar[str] = 'geometry_msgs/Vector3'#
x: float = 0.0#
y: float = 0.0#
z: float = 0.0#
class irsim.msg.messages.Quaternion[源代码]#

Bases: Message

ROS geometry_msgs/Quaternion-shaped orientation.

ros_type: ClassVar[str] = 'geometry_msgs/Quaternion'#
x: float = 0.0#
y: float = 0.0#
z: float = 0.0#
w: float = 1.0#
classmethod from_yaw(yaw: float) Quaternion[源代码]#

Create a planar quaternion from a yaw angle in radians.

to_yaw() float[源代码]#

Return the planar yaw angle in radians, from a normalized copy.

抛出:

ValueError -- If the quaternion is zero and defines no rotation.

class irsim.msg.messages.Pose[源代码]#

Bases: Message

ROS geometry_msgs/Pose-shaped position and orientation.

ros_type: ClassVar[str] = 'geometry_msgs/Pose'#
position: Point#
orientation: Quaternion#
class irsim.msg.messages.PoseWithCovariance[源代码]#

Bases: Message

ROS geometry_msgs/PoseWithCovariance-shaped pose.

ros_type: ClassVar[str] = 'geometry_msgs/PoseWithCovariance'#
pose: Pose#
covariance: numpy.ndarray#
class irsim.msg.messages.Twist[源代码]#

Bases: Message

ROS geometry_msgs/Twist-shaped linear and angular velocity.

ros_type: ClassVar[str] = 'geometry_msgs/Twist'#
linear: Vector3#
angular: Vector3#
class irsim.msg.messages.TwistWithCovariance[源代码]#

Bases: Message

ROS geometry_msgs/TwistWithCovariance-shaped velocity.

ros_type: ClassVar[str] = 'geometry_msgs/TwistWithCovariance'#
twist: Twist#
covariance: numpy.ndarray#
class irsim.msg.messages.Odometry[源代码]#

Bases: Message

ROS nav_msgs/Odometry-shaped object pose and velocity.

ros_type: ClassVar[str] = 'nav_msgs/Odometry'#
header: Header#
child_frame_id: str = ''#
pose: PoseWithCovariance#
twist: TwistWithCovariance#
classmethod from_object(obj: Any, *, stamp: float = 0.0, seq: int = 0, frame_id: str = 'world') Odometry[源代码]#

Capture an object's planar pose and body-frame velocity.

classmethod from_msg(msg: Any) Odometry[源代码]#

Adopt any ROS-compatible nav_msgs/Odometry-shaped message.

Only the planar fields IR-SIM uses are read, so native ROS messages and partial stand-ins are both accepted. Header metadata is left out, since its layout is ROS-version specific and belongs to the receiver.

参数:

msg -- An object exposing pose.pose and twist.twist.

返回:

An independent, validated IR-SIM odometry message.

返回类型:

Odometry

抛出:
  • TypeError -- If msg does not expose ROS odometry pose and twist.

  • ValueError -- If any planar value is not finite.

to_state_velocity(obj: Any) tuple[numpy.ndarray, numpy.ndarray][源代码]#

Convert this odometry into state and velocity arrays for obj.

The inverse of from_object(): the planar pose replaces the first three state values, and the body-frame twist is mapped onto the velocity layout of the object's kinematics. obj is only read, so a caller can validate several updates before applying any of them.

Ackermann steering is carried as a yaw rate, which is zero whenever the car is not moving. A stopped car therefore conveys no steering angle, and obj keeps the one it already had.

参数:

obj -- The simulation object whose layout the arrays must match.

返回:

The new (state, velocity) arrays for obj.

返回类型:

tuple

抛出:

ValueError -- If obj has fewer than three state values, an Ackermann object has no steering value, or the orientation defines no rotation.

class irsim.msg.messages.LaserScan[源代码]#

Bases: Message

Shared sensor_msgs/LaserScan fields for a LiDAR snapshot.

ros_type: ClassVar[str] = 'sensor_msgs/LaserScan'#
header: Header#
angle_min: float#
angle_max: float#
angle_increment: float#
time_increment: float#
scan_time: float#
range_min: float#
range_max: float#
ranges: numpy.ndarray#
intensities: numpy.ndarray#
classmethod from_sensor(sensor: Any, *, stamp: float = 0.0, seq: int = 0, frame_id: str | None = None) LaserScan[源代码]#

Capture a LiDAR sensor without sharing its mutable arrays.

class irsim.msg.messages.ObjectState[源代码]#

Bases: Message

Topic-shaped messages and simulator metadata for one object.

header: Header#
id: int#
name: str#
role: str#
kinematics: str | None#
shape: str#
odom: Odometry#
scan: LaserScan | None#
goal: numpy.ndarray | None#
static: bool#
arrive: bool#
collision: bool#
collision_ids: list[int] = []#
scans: list[LaserScan] = []#
classmethod from_object(obj: Any, *, stamp: float = 0.0, seq: int = 0, frame_id: str = 'world') ObjectState[源代码]#

Capture an object as conventional odom and scan topics.

property sensors: list[LaserScan]#

Return all LiDAR messages as a compatibility alias for scans.

class irsim.msg.messages.WorldState[源代码]#

Bases: Message

Complete point-in-time state of an IR-SIM environment.

header: Header#
name: str#
status: str#
step_time: float#
objects: list[ObjectState] = []#
classmethod from_env(env: Any, frame_id: str = 'world') WorldState[源代码]#

Capture the current state and sensor data from an environment.

property robots: list[ObjectState]#

Return the robot messages in this snapshot.

property obstacles: list[ObjectState]#

Return the obstacle messages in this snapshot.