robot_msgs

JointState

position[i] (rad or m), velocity[i] and effort[i] belong to joint name[i].

Full docstring
`velocity` and `effort` are `None` when not measured (ROS sends empty arrays).
Import
from robot_msgs.sensor import JointState
ROS 2sensor_msgs/msg/JointState

Preview

The figure robot_msgs.viz.plot(example) draws for the example below.

Plot of an example JointState

Fields

NameTypeDefault
nametuple[str, ...]required
positionArrayrequired
velocityArray | NoneNone
effortArray | NoneNone
headerHeaderHeader()

Example

One instance from the package's own test catalog; the output is its real repr().

JointState(name=('j1', 'j2', 'j3'), position=[0.1, 0.2, 0.3], velocity=[0. , 0.1, 0. ], header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'))
to_dict() as JSON
{
  "_type": "sensor/JointState",
  "name": ["j1", "j2", "j3"],
  "position": {
    "dtype": "<f8",
    "shape": [3],
    "data": [0.1, 0.2, 0.3]
  },
  "velocity": {
    "dtype": "<f8",
    "shape": [3],
    "data": [0.0, 0.1, 0.0]
  },
  "effort": null,
  "header": {
    "_type": "std/Header",
    "stamp": 1761600000.25,
    "frame_id": "camera_color_optical_frame",
    "meta": {}
  }
}

Long arrays are cut after 16 values and say so with “…”.

Functions

Constructors

Classmethods and staticmethods: ways to build one.

from_dict

from Msg
from_dict(data: Mapping[str, Any]) -> M

No docstring.

Methods

Return new values; messages are never mutated.

as_dict() -> dict[str, float]

Joint name → position.

index_of(name: str) -> int

No docstring.

position_of(name: str) -> float

No docstring.

select(names: Sequence[str]) -> JointState

The named joints, in the order given.

replace

from Msg
replace(**changes: Any) -> M

A copy with some fields changed. Validation runs again.

to_dict

from Msg
to_dict() -> dict[str, Any]

JSON-safe dict with a "_type" key; arrays keep their dtype and shape.

Operators

Python operators and protocols the type supports.

__len__() -> int

No docstring.

Uses

Types its fields refer to.

Header

robot_msgs 0.1.0 @ 2dc6666GitHub · MIT license · generated from the package, not written per type