You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4f3fc73
Browse filesBrowse the repository at this point in the historyBrowse files
Resets the simulation state, optionally applying per-joint state overrides on top of the restored state.
279
303
280
304
- If the optional ``keyframe`` string field is empty, the simulation is restored to the state captured at startup (initial joint positions, velocities, and control values).
281
305
- If a ``keyframe`` name is provided, that named keyframe from the MJCF is applied instead.
306
+
- ``state_overrides`` (``mujoco_ros2_control_msgs/SimulationState``): optional overrides applied on top of the
307
+
restored state — ``joint_states`` for single-DOF (hinge/slide) joints keyed by MuJoCo joint name, and
308
+
``free_joints`` for free joints keyed by the name of the body each one drives.
309
+
The split follows the representation: ``joint_states`` carries raw scalar joint coordinates, while
310
+
``free_joints`` carries a frame-relative Cartesian pose and twist. Ball and other multi-DOF joints fit
311
+
neither and are not supported.
312
+
- In ``joint_states``, ``position`` and ``velocity`` must each be empty or the same length as ``name``, so a given
313
+
field is set for every listed joint or for none of them; an empty array leaves that field at its reset value.
314
+
``effort`` is not supported and must be empty.
315
+
- In ``free_joints``, entries behave exactly like the ``~/set_free_joint_state`` service (see below), except that any
316
+
``pose``/``twist`` ``frame_id`` is resolved against body poses *after* the reset and *after* any ``joint_states``
317
+
overrides have been written. An object can therefore be placed relative to where another body ends up, rather than
318
+
where it was before the reset.
282
319
- Returns ``success`` and a human-readable ``message``.
283
320
321
+
.. note::
322
+
323
+
There is no standalone service for setting a single-DOF joint; unlike free-joint bodies, articulated joints are
324
+
usually actuated, so writing one has to re-sync the hardware interface's command interfaces and reset its PIDs.
325
+
That reconciliation only happens as part of a reset, which is why the capability lives here.
326
+
284
327
.. code-block:: bash
285
328
286
329
# Reset to startup state
@@ -289,10 +332,24 @@ Services
289
332
# Reset to a named MJCF keyframe
290
333
ros2 service call /ros2_control_node/reset_world mujoco_ros2_control_msgs/srv/ResetWorld "{keyframe: 'home'}"
291
334
335
+
# Reset to a keyframe, but with the cabinet door open and "box_1" placed on the table
336
+
ros2 service call /ros2_control_node/reset_world mujoco_ros2_control_msgs/srv/ResetWorld \
0 commit comments