Mujoco KDL Wrapper  0.5.1
MuJoCo + KDL bridge for robot kinematics and dynamics
Loading...
Searching...
No Matches
mj_kdl_examples Namespace Reference

Classes

struct  Args
struct  PickPlaceWaypoints
struct  Phase
struct  PhaseArm

Functions

Args parse_args (int argc, char **argv, const std::string &default_record_path="")
int verdict (bool ok, const std::string &goal)
double clamp01 (double v)
double clamp_abs (double v, double limit)
KDL::JntArray home_q (unsigned n)
void lerp_q (const KDL::JntArray &a, const KDL::JntArray &b, double t, KDL::JntArray &out)
void read_q (const mj_kdl::Robot &robot, KDL::JntArray &q)
void read_q (const mj_kdl::Robot &robot, KDL::JntArray &q, KDL::JntArray &qd)
double max_abs_joint_err (const mj_kdl::Robot &robot, const KDL::JntArray &q)
KDL::Frame tcp_frame (KDL::ChainFkSolverPos_recursive &fk, const mj_kdl::Robot &robot)
void pd_gravity (mj_kdl::Robot &robot, KDL::ChainDynParam &dyn, const KDL::JntArray &q_des, const double *kp=nullptr, const double *kd=nullptr)
void prime_gravity (mj_kdl::Robot &robot, KDL::ChainDynParam &dyn, const KDL::JntArray &q)
mj_kdl::SceneSpec scene_spec ()
mj_kdl::AttachmentSpec gripper_attachment (const std::string &path, const std::string &site="pinch_site")
mj_kdl::ToolFrameSpec gripper_tool (const std::string &prefix="")
mj_kdl::SceneObject table_object (const std::string &path, double surface_z)
mj_kdl::SceneObject cube_object (double x, double y, double surface_z)
void place_cube (mj_kdl::Env &env)
bool solve_near_seed (KDL::ChainIkSolverVel_wdls &ik_vel, KDL::ChainFkSolverPos_recursive &fk, const mj_kdl::Robot &robot, const KDL::JntArray &seed, const KDL::Frame &target, KDL::JntArray &out)
bool solve_pick_place (const mj_kdl::Robot &robot, PickPlaceWaypoints &w)
std::vector< Phase > pick_place_phases (const PickPlaceWaypoints &w)
bool run_phases (mj_kdl::Env &env, const std::vector< PhaseArm > &arms, const std::vector< Phase > &phases, bool &restart, const std::function< void(std::size_t, const KDL::JntArray &)> &control, const std::function< void(const Phase &, double t_rel)> &after_step={})
std::string find_asset (const fs::path &relative)
std::string asset (const fs::path &relative)

Variables

constexpr double kGripperClosed = 0.82
constexpr double kHomePose [7] = { 0.0, 0.2618, 3.1416, -2.2689, 0.0, 0.9599, 1.5708 }
constexpr double kKp [7] = { 100, 200, 100, 200, 100, 200, 100 }
constexpr double kKd [7] = { 10, 20, 10, 20, 10, 20, 10 }
constexpr double kTableZ = 0.70
constexpr double kCubeHS = 0.02
constexpr double kPickXY [2] = { 0.40, 0.00 }
constexpr double kPlaceXY [2] = { 0.40, 0.24 }

Function Documentation

◆ asset()

std::string mj_kdl_examples::asset ( const fs::path & relative)
inline

Definition at line 16 of file example_paths.hpp.

References find_asset().

Referenced by main(), and main().

◆ clamp01()

double mj_kdl_examples::clamp01 ( double v)
inline

Definition at line 64 of file common.hpp.

Referenced by main(), and TEST_F().

◆ clamp_abs()

double mj_kdl_examples::clamp_abs ( double v,
double limit )
inline

Definition at line 66 of file common.hpp.

Referenced by AchdController::control(), main(), main(), and TEST().

◆ cube_object()

◆ find_asset()

◆ gripper_attachment()

mj_kdl::AttachmentSpec mj_kdl_examples::gripper_attachment ( const std::string & path,
const std::string & site = "pinch_site" )
inline

◆ gripper_tool()

mj_kdl::ToolFrameSpec mj_kdl_examples::gripper_tool ( const std::string & prefix = "")
inline

◆ home_q()

KDL::JntArray mj_kdl_examples::home_q ( unsigned n)
inline

◆ lerp_q()

void mj_kdl_examples::lerp_q ( const KDL::JntArray & a,
const KDL::JntArray & b,
double t,
KDL::JntArray & out )
inline

Definition at line 75 of file common.hpp.

References KDL::JntArray::rows().

◆ max_abs_joint_err()

double mj_kdl_examples::max_abs_joint_err ( const mj_kdl::Robot & robot,
const KDL::JntArray & q )
inline

Definition at line 93 of file common.hpp.

References mj_kdl::RobotPorts::jnt_pos_msr, and KDL::JntArray::rows().

◆ parse_args()

Args mj_kdl_examples::parse_args ( int argc,
char ** argv,
const std::string & default_record_path = "" )
inline

◆ pd_gravity()

void mj_kdl_examples::pd_gravity ( mj_kdl::Robot & robot,
KDL::ChainDynParam & dyn,
const KDL::JntArray & q_des,
const double * kp = nullptr,
const double * kd = nullptr )
inline

◆ pick_place_phases()

◆ place_cube()

void mj_kdl_examples::place_cube ( mj_kdl::Env & env)
inline

Definition at line 197 of file common.hpp.

References kCubeHS, kPickXY, kTableZ, and mj_kdl::set_body_pose().

Referenced by main().

◆ prime_gravity()

void mj_kdl_examples::prime_gravity ( mj_kdl::Robot & robot,
KDL::ChainDynParam & dyn,
const KDL::JntArray & q )
inline

◆ read_q() [1/2]

void mj_kdl_examples::read_q ( const mj_kdl::Robot & robot,
KDL::JntArray & q )
inline

◆ read_q() [2/2]

void mj_kdl_examples::read_q ( const mj_kdl::Robot & robot,
KDL::JntArray & q,
KDL::JntArray & qd )
inline

◆ run_phases()

bool mj_kdl_examples::run_phases ( mj_kdl::Env & env,
const std::vector< PhaseArm > & arms,
const std::vector< Phase > & phases,
bool & restart,
const std::function< void(std::size_t, const KDL::JntArray &)> & control,
const std::function< void(const Phase &, double t_rel)> & after_step = {} )
inline

Definition at line 319 of file common.hpp.

Referenced by main(), and TEST_F().

◆ scene_spec()

mj_kdl::SceneSpec mj_kdl_examples::scene_spec ( )
inline

Definition at line 138 of file common.hpp.

References mj_kdl::SceneSpec::add_floor, mj_kdl::SceneSpec::add_skybox, and mj_kdl::SceneSpec::timestep.

Referenced by main(), and main().

◆ solve_near_seed()

◆ solve_pick_place()

◆ table_object()

mj_kdl::SceneObject mj_kdl_examples::table_object ( const std::string & path,
double surface_z )
inline

Definition at line 168 of file common.hpp.

References mj_kdl::SceneObject::name.

Referenced by main(), and main().

◆ tcp_frame()

KDL::Frame mj_kdl_examples::tcp_frame ( KDL::ChainFkSolverPos_recursive & fk,
const mj_kdl::Robot & robot )
inline

◆ verdict()

int mj_kdl_examples::verdict ( bool ok,
const std::string & goal )
inline

Definition at line 58 of file common.hpp.

Referenced by main(), and main().

Variable Documentation

◆ kCubeHS

double mj_kdl_examples::kCubeHS = 0.02
constexpr

Definition at line 29 of file common.hpp.

Referenced by cube_object(), main(), place_cube(), and solve_pick_place().

◆ kGripperClosed

double mj_kdl_examples::kGripperClosed = 0.82
constexpr

Definition at line 19 of file common.hpp.

Referenced by main(), pick_place_phases(), TEST_F(), and TEST_F().

◆ kHomePose

double mj_kdl_examples::kHomePose[7] = { 0.0, 0.2618, 3.1416, -2.2689, 0.0, 0.9599, 1.5708 }
constexpr

Definition at line 22 of file common.hpp.

Referenced by home_q(), and TEST_F().

◆ kKd

double mj_kdl_examples::kKd[7] = { 10, 20, 10, 20, 10, 20, 10 }
constexpr

Definition at line 26 of file common.hpp.

Referenced by main(), TEST_F(), and TEST_F().

◆ kKp

double mj_kdl_examples::kKp[7] = { 100, 200, 100, 200, 100, 200, 100 }
constexpr

Definition at line 25 of file common.hpp.

Referenced by main(), TEST_F(), and TEST_F().

◆ kPickXY

double mj_kdl_examples::kPickXY[2] = { 0.40, 0.00 }
constexpr

Definition at line 30 of file common.hpp.

Referenced by main(), place_cube(), MjcfPickTest::SetUp(), and solve_pick_place().

◆ kPlaceXY

double mj_kdl_examples::kPlaceXY[2] = { 0.40, 0.24 }
constexpr

Definition at line 31 of file common.hpp.

Referenced by main(), and solve_pick_place().

◆ kTableZ

double mj_kdl_examples::kTableZ = 0.70
constexpr

Definition at line 28 of file common.hpp.

Referenced by main(), and place_cube().