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#
Base class that provides JSON-compatible message serialization. |
|
Version-neutral metadata shared by all IR-SIM messages. |
|
ROS |
|
ROS |
|
ROS |
|
ROS |
|
ROS |
|
ROS |
|
ROS |
|
ROS |
|
Shared |
|
One contact of an object in the last step ( |
|
Topic-shaped messages and simulator metadata for one object. |
|
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.
- class irsim.msg.messages.Header[源代码]#
Bases:
MessageVersion-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:
MessageROS
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:
MessageROS
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:
MessageROS
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.
- class irsim.msg.messages.Pose[源代码]#
Bases:
MessageROS
geometry_msgs/Pose-shaped position and orientation.- ros_type: ClassVar[str] = 'geometry_msgs/Pose'#
- orientation: Quaternion#
- class irsim.msg.messages.PoseWithCovariance[源代码]#
Bases:
MessageROS
geometry_msgs/PoseWithCovariance-shaped pose.- ros_type: ClassVar[str] = 'geometry_msgs/PoseWithCovariance'#
- covariance: numpy.ndarray#
- class irsim.msg.messages.Twist[源代码]#
Bases:
MessageROS
geometry_msgs/Twist-shaped linear and angular velocity.- ros_type: ClassVar[str] = 'geometry_msgs/Twist'#
- class irsim.msg.messages.TwistWithCovariance[源代码]#
Bases:
MessageROS
geometry_msgs/TwistWithCovariance-shaped velocity.- ros_type: ClassVar[str] = 'geometry_msgs/TwistWithCovariance'#
- covariance: numpy.ndarray#
- class irsim.msg.messages.Odometry[源代码]#
Bases:
MessageROS
nav_msgs/Odometry-shaped object pose and velocity.- ros_type: ClassVar[str] = 'nav_msgs/Odometry'#
- 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.poseandtwist.twist.- 返回:
An independent, validated IR-SIM odometry message.
- 返回类型:
- 抛出:
TypeError -- If
msgdoes 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.objis 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
objkeeps the one it already had.- 参数:
obj -- The simulation object whose layout the arrays must match.
- 返回:
The new
(state, velocity)arrays forobj.- 返回类型:
tuple
- 抛出:
ValueError -- If
objhas fewer than three state values, an Ackermann object has no steering value, or the orientation defines no rotation.
- class irsim.msg.messages.LaserScan[源代码]#
Bases:
MessageShared
sensor_msgs/LaserScanfields for a LiDAR snapshot.- ros_type: ClassVar[str] = 'sensor_msgs/LaserScan'#
- 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, use_inf: bool = False) LaserScan[源代码]#
Capture a LiDAR sensor without sharing its mutable arrays.
By default
rangesare the sensor's own finite values,range_maxfor a miss, so snapshots used for learning are unchanged. Withuse_inf=Truea beam without a usable return becomes+infwhen nothing came back withinrange_maxand-infwhen the return was too close to measure, as Gazebo publishes it under REP 117, so ROS consumers read the scan as they would a real driver's.
- class irsim.msg.messages.ContactState[源代码]#
Bases:
MessageOne contact of an object in the last step (
collision_mode: contact).normalpoints from the partner toward the object,pointis the world-frame contact point,depththe overlap that was pushed apart (zero or negative for a resting contact) andforcethe contact force in newtons along the normal.- ros_type: ClassVar[str] = 'irsim_msgs/ContactState'#
- other_id: int = -1#
- other: str = ''#
- depth: float = 0.0#
- force: float = 0.0#
- classmethod from_report(report: Any) ContactState[源代码]#
Serialize an object's
ContactReport.
- class irsim.msg.messages.ObjectState[源代码]#
Bases:
MessageTopic-shaped messages and simulator metadata for one object.
In
collision_mode: contactthe state also carries what a contact sensor reports: the netcontact_force, oneContactStateper contact, and how long the object has been touching (contact_time) or free (air_time).- id: int#
- name: str#
- role: str#
- kinematics: str | None#
- shape: str#
- goal: numpy.ndarray | None#
- static: bool#
- arrive: bool#
- collision: bool#
- collision_ids: list[int] = []#
- contact_time: float = 0.0#
- air_time: float = 0.0#
- contacts: list[ContactState] = []#
- classmethod from_object(obj: Any, *, stamp: float = 0.0, seq: int = 0, frame_id: str = 'world', use_inf: bool = False) ObjectState[源代码]#
Capture an object as conventional
odomandscantopics.use_infis passed toLaserScan.from_sensor().
- class irsim.msg.messages.WorldState[源代码]#
Bases:
MessageComplete point-in-time state of an IR-SIM environment.
- name: str#
- status: str#
- step_time: float#
- objects: list[ObjectState] = []#
- classmethod from_env(env: Any, frame_id: str = 'world', use_inf: bool = False) WorldState[源代码]#
Capture the current state and sensor data from an environment.
use_infis passed to everyLaserScan.from_sensor().
- property robots: list[ObjectState]#
Return the robot messages in this snapshot.
- property obstacles: list[ObjectState]#
Return the obstacle messages in this snapshot.