|
Mujoco KDL Wrapper
0.5.1
MuJoCo + KDL bridge for robot kinematics and dynamics
|
Build and modify MuJoCo scenes from MJCF specifications. More...
Classes | |
| struct | mj_kdl::SceneJointReading |
| struct | mj_kdl::SceneJointSlot |
| struct | mj_kdl::SceneFreeBodyReading |
| struct | mj_kdl::SceneFreeBodySlot |
| struct | mj_kdl::SceneWrenchCommand |
| struct | mj_kdl::SceneWrenchSlot |
| struct | mj_kdl::SceneActuatorCommand |
| struct | mj_kdl::SceneActuatorSlot |
| struct | mj_kdl::SceneState |
Functions | |
| Status | mj_kdl::save_model_xml (const mjModel *model, const char *path) |
| Status | mj_kdl::build_scene (mjModel **out_model, mjData **out_data, const SceneSpec *spec) |
| void | mj_kdl::destroy_scene (mjModel *model, mjData *data) |
| SceneJointSlot * | mj_kdl::bind_scene_joint (SceneState *s, const char *joint_name) |
| SceneFreeBodySlot * | mj_kdl::bind_scene_free_body (SceneState *s, const char *body_name) |
| SceneWrenchSlot * | mj_kdl::bind_scene_wrench (SceneState *s, const char *body_name) |
| SceneActuatorSlot * | mj_kdl::bind_scene_actuator (SceneState *s, const char *name) |
| Status | mj_kdl::scene_add_object (Env *env, const SceneObject &obj) |
| Status | mj_kdl::scene_remove_object (Env *env, const std::string &name) |
| bool | mj_kdl::get_site_frame (Env *env, const char *site_name, KDL::Frame *out) |
| bool | mj_kdl::get_body_frame (Env *env, const char *body_name, KDL::Frame *out) |
Build and modify MuJoCo scenes from MJCF specifications.
init_env() builds the scene into an Env. Use scene_add_object() and scene_remove_object() to modify a running Env; bind scene slots (joints, free bodies, wrenches, actuators outside a Robot chain) with bind_scene_*().
| SceneActuatorSlot * mj_kdl::bind_scene_actuator | ( | SceneState * | s, |
| const char * | name ) |
Resolve the actuator named, or the one driving the joint of that name, and keep a slot for its command. Rejects a name that reaches no actuator, and a name already bound.
Referenced by main(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
| SceneFreeBodySlot * mj_kdl::bind_scene_free_body | ( | SceneState * | s, |
| const char * | body_name ) |
Resolve a free-floating body by name and keep a slot for its pose. Rejects an unknown name, a body that owns no mjJNT_FREE joint, and a name already bound.
Referenced by main(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
| SceneJointSlot * mj_kdl::bind_scene_joint | ( | SceneState * | s, |
| const char * | joint_name ) |
| SceneWrenchSlot * mj_kdl::bind_scene_wrench | ( | SceneState * | s, |
| const char * | body_name ) |
Build a MuJoCo scene from one or more robots using the MuJoCo spec API. This is the primary scene-building function.
For each RobotSpec: mj_parseXML loads the root MJCF, then mjs_attach applies each entry in RobotSpec::attachments in order (mount, sensor, gripper, etc.), and mjs_attach places the complete robot spec at the given position. A single mj_compile produces the final model – no intermediate XML files are written.
| [out] | out_model | Newly allocated MuJoCo model; caller frees via destroy_scene(). |
| [out] | out_data | Newly allocated MuJoCo data; caller frees via destroy_scene(). |
| [in] | spec | Scene description: robots (with attachment chains), objects, sites, cameras, timestep, gravity, floor, skybox. |
| void mj_kdl::destroy_scene | ( | mjModel * | model, |
| mjData * | data ) |
| bool mj_kdl::get_body_frame | ( | Env * | env, |
| const char * | body_name, | ||
| KDL::Frame * | out ) |
| bool mj_kdl::get_site_frame | ( | Env * | env, |
| const char * | site_name, | ||
| KDL::Frame * | out ) |
| Status mj_kdl::save_model_xml | ( | const mjModel * | model, |
| const char * | path ) |
Save a model to an MJCF XML file, including runtime changes to its real-valued fields. Works for any live model from build_scene() or init_env() (adopted ones too), and for the last model loaded with mj_loadXML. Typical use: build a combined scene once, save it, reload it later.
| model | Model to save. |
| path | Output path for the MJCF XML file. |
| Status mj_kdl::scene_add_object | ( | Env * | env, |
| const SceneObject & | obj ) |
Append obj to env->spec.objects and rebuild. Time, and qpos/qvel/act/ctrl of every joint and actuator whose name survives, carry over; robots, scene slots, recorders and the viewer follow the new model; a slot whose name is gone is unbound and skipped.
Referenced by TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().