jrosmoveit is a Java module which allows to interact with MoveIt in ROS (Robot Operating System). It allows to set target pose for the robot, plan trajectory and execute it.
It is based on jrosclient module which is a Java client for ROS.
As an example we will move Panda robotic arm. To install it:
Use following command to run it:
If it fails apply the fix.
For code to compile following Java dependencies are required:
Code:
try (var client = new JRos1ClientFactory().createClient("http://localhost:11311/"); var moveIt = new JRosMoveIt(client, "panda_arm", new RobotModel("world"))) { var targetPose = new PoseMessage(); targetPose.position = transformer.toPointMessage(new Point(0.28, -0.2, 0.5)); targetPose.orientation = new QuaternionMessage().withW(-1.0); moveIt.setPoseTarget(targetPose, "panda_hand"); var plan = moveIt.plan(); moveIt.execute(plan); }
Once code is executed the arm will move from its initial position to the point coordinates we specified.