From 6799bc5c4a65a95faf195ecfc86bf04c29280ed8 Mon Sep 17 00:00:00 2001 From: dtotsila Date: Fri, 30 Aug 2024 13:50:12 +0200 Subject: [PATCH] vx300 python examples --- src/examples/python/vx300.py | 28 ++++++++++++++++++++++++++++ src/examples/vx300.cpp | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 src/examples/python/vx300.py diff --git a/src/examples/python/vx300.py b/src/examples/python/vx300.py new file mode 100644 index 00000000..f86e7a92 --- /dev/null +++ b/src/examples/python/vx300.py @@ -0,0 +1,28 @@ +import RobotDART as rd + +# @VX300_PYTHON@ +robot = rd.Vx300() +# @VX300_PYTHON_END@ +robot.set_actuator_types("servo") + +ctrl = [0.0, 1.0, -1.5, 1.0, 0.5, 0.] + +controller = rd.PDControl(ctrl) +robot.add_controller(controller) + +simu = rd.RobotDARTSimu() +simu.set_collision_detector("fcl") + +simu.set_graphics(rd.gui.Graphics()) +simu.add_robot(robot) +simu.add_checkerboard_floor() + +for n in robot.dof_names(): + print(n) + +simu.run(2.5) + +ctrl = [0.0, -0.5, 0.5, -0.5, 0., 1.] +controller.set_parameters(ctrl) +controller.set_pd(20., 0.) +simu.run(2.5) diff --git a/src/examples/vx300.cpp b/src/examples/vx300.cpp index 0c158567..43c8a674 100644 --- a/src/examples/vx300.cpp +++ b/src/examples/vx300.cpp @@ -8,7 +8,9 @@ int main() { + // @VX300@ auto robot = std::make_shared(); + // @VX300_END@ robot->set_actuator_types("servo"); Eigen::VectorXd ctrl = robot_dart::make_vector({0.0, 1.0, -1.5, 1.0, 0.5, 0.});