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.
Fields
| Name | Type | Default |
|---|---|---|
name | tuple[str, ...] | required |
position | Array | required |
velocity | Array | None | None |
feedforward_effort | Array | None | None |
stiffness | Array | None | None |
damping | Array | None | None |
max_effort | Array | None | None |
state_stamp | float | None | None |
state_seq | int | None | None |
header | Header | Header() |
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) -> ServoCommandHold at the measured position with zero velocity, sent at stamp, board gains kept.
Properties
Read-only views computed from the fields.
latency: float | NoneSeconds from the state sample to sending this command; None when open loop.