|
Mujoco KDL Wrapper
0.5.1
MuJoCo + KDL bridge for robot kinematics and dynamics
|
The Env: owns model/data, robots, scene slots and the viewer. More...
Classes | |
| struct | mj_kdl::ResetOptions |
| struct | mj_kdl::ResetInfo |
| struct | mj_kdl::ResetContext |
| struct | mj_kdl::Env |
Functions | |
| Status | mj_kdl::init_env (Env *env, const SceneSpec *spec) |
| ResetInfo | mj_kdl::reset (Env *env, const ResetOptions *options=nullptr) |
| void | mj_kdl::cleanup (Env *env) |
| bool | mj_kdl::step (Env *env) |
| void | mj_kdl::update (Env *env) |
| void | mj_kdl::set_body_pose (Env *env, const char *body_name, const double pos[3], const double *quat=nullptr) |
The Env: owns model/data, robots, scene slots and the viewer.
init_env() builds it; step(), update() and reset() drive it; cleanup(Env *) frees it. reset() re-seeds every part it holds.
| void mj_kdl::cleanup | ( | Env * | env | ) |
Close the viewer, free the model/data and forget the robots (which are not deleted).
Build the scene from spec into env, which owns the model/data until cleanup(Env *). Env::on_reset and Env::adopt set beforehand are kept.
Referenced by main(), main(), ArmModesTest::SetUp(), AttachedArmModesTest::SetUp(), DualArmTest::SetUp(), InitTest::SetUp(), MjcfFtSensorTest::SetUp(), MjcfLoadTest::SetUp(), MjcfPickTest::SetUp(), MjcfPosCtrlTest::SetUp(), MjcfTrqCtrlTest::SetUp(), MotorWheelModesTest::SetUp(), RebuildTest::SetUp(), SceneStateTest::SetUp(), TableSceneTest::SetUp(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_P(), and TEST_P().
| ResetInfo mj_kdl::reset | ( | Env * | env, |
| const ResetOptions * | options = nullptr ) |
Reset everything env holds: MuJoCo data to the keyframe (or the model default); every registered robot's ports (holding the reset pose, a requested ctrl_mode kept) and F/T readings, and every scene slot, re-seeded; then Env::on_reset; then measurements read from the result. The simulate UI's reset button does the same.
Referenced by main(), main(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
| void mj_kdl::set_body_pose | ( | Env * | env, |
| const char * | body_name, | ||
| const double | pos[3], | ||
| const double * | quat = nullptr ) |
Teleport a free-floating body to a world-frame position and optionally a world-frame orientation, then zero its velocity. body_name must identify a body that owns a mjJNT_FREE joint. quat is [x, y, z, w] like every quaternion in this API; nullptr sets identity.
Referenced by main(), and mj_kdl_examples::place_cube().
| bool mj_kdl::step | ( | Env * | env | ) |
Advance env one timestep: mj_step2() then mj_step1() (MuJoCo's split mj_step()). Afterwards joint state, body frames and position/velocity sensors all describe the new state; force and acceleration sensors describe the step just taken. With the viewer open it also honours its pause, perturbation and recording, and does nothing while every robot is paused.
Referenced by main(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_P(), TEST_P(), and TEST_P().
| void mj_kdl::update | ( | Env * | env | ) |
One control cycle for everything env holds: read, then apply. Robots: qpos -> jnt_pos_msr, qvel -> jnt_vel_msr, qfrc_actuator -> jnt_trq_msr (only the active mode's actuators produce force, so this is the drive torque in every mode), F/T wrenches; then the active mode's command to its actuators' ctrl (gear applied, ctrlrange clamped). If ctrl_mode was changed directly, the switch runs first (set_control_mode()). Outside TORQUE, gravity on the bodies a robot's joints carry is compensated (body_gravcomp), so a servo holds its setpoint; in TORQUE the command carries gravity itself. Scene slots: joints and free bodies sampled from qpos/qvel; wrenches into xfrc_applied (zeros included), actuator commands into ctrl.
Referenced by main(), main(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_P(), TEST_P(), TEST_P(), TEST_P(), TEST_P(), and TEST_P().