robot_msgs

ServoCommand

Targets for servo name[i], in SI.

Full docstring
- `position` rad or m; NaN means "no position target" (velocity or effort only, as moteus).
- `velocity` rad/s or m/s; `feedforward_effort` N·m or N, added to the board's PD output.
- `stiffness` N·m/rad (or N/m) and `damping` N·m·s/rad (or N·s/m) for the board's PD loop;
  `None` keeps the board's configured gains. `max_effort` caps the board's output.
- `header.stamp` is when the command was sent (s). `state_stamp` / `state_seq` name the
  `ServoState` it was computed from, so `latency` (sensor-to-command) is measurable from a log
  alone. `None` means open loop: nothing was read.
Import
from robot_msgs.control import ServoCommand
ROS 2no ROS equivalent

Fields

NameTypeDefault
nametuple[str, ...]required
positionArrayrequired
velocityArray | NoneNone
feedforward_effortArray | NoneNone
stiffnessArray | NoneNone
dampingArray | NoneNone
max_effortArray | NoneNone
state_stampfloat | NoneNone
state_seqint | NoneNone
headerHeaderHeader()

Example

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

ServoCommand(name=('j1', 'j2', 'j3'), position=[0.11, 0.21,  nan], velocity=[0.1, 0.1, 0.2], feedforward_effort=[ 0.4, -0.1,  0. ], stiffness=[30., 30.,  5.], damping=[1. , 1. , 0.3], max_effort=[4., 4., 2.], state_stamp=1761600000.25, state_seq=812, header=Header(stamp=1761600000.2521, frame_id='camera_color_optical_frame'))
to_dict() as JSON
{
  "_type": "control/ServoCommand",
  "name": ["j1", "j2", "j3"],
  "position": {
    "dtype": "<f8",
    "shape": [3],
    "data": [0.11, 0.21, NaN]
  },
  "velocity": {
    "dtype": "<f8",
    "shape": [3],
    "data": [0.1, 0.1, 0.2]
  },
  "feedforward_effort": {
    "dtype": "<f8",
    "shape": [3],
    "data": [0.4, -0.1, 0.0]
  },
  "stiffness": {
    "dtype": "<f8",
    "shape": [3],
    "data": [30.0, 30.0, 5.0]
  },
  "damping": {
    "dtype": "<f8",
    "shape": [3],
    "data": [1.0, 1.0, 0.3]
  },
  "max_effort": {
    "dtype": "<f8",
    "shape": [3],
    "data": [4.0, 4.0, 2.0]
  },
  "state_stamp": 1761600000.25,
  "state_seq": 812,
  "header": {
    "_type": "std/Header",
    "stamp": 1761600000.2521,
    "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_state(state: ServoState, *, stamp: float) -> ServoCommand

Hold at the measured position with zero velocity, sent at stamp, board gains kept.

from_dict

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

No docstring.

Properties

Read-only views computed from the fields.

latency: float | None

Seconds from the state sample to sending this command; None when open loop.

Methods

Return new values; messages are never mutated.

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.2.0 @ 22ec67fGitHub · MIT license · generated from the package, not written per type