Skip to content

Tutorial 4: Extending to a new robot

Brad Saund edited this page Apr 29, 2020 · 2 revisions

Extending this teleoperation package to your own robot requires:

  1. a "urdf" model of the robot
  2. A robot state publisher
  3. A controller for the robot with a ROS interface

Loading the robot into Unity

Loading a URDF into Unity is handled very nicely by ROS#. As unity_victor_teleop is built on top of ROS#, this tutorial can be used directly.

Robot state publisher

Ros needs to tell Unity where the robot is. Once again, ROS# has made this very easy. The Urdf plugin script can directly listen to the same type of robot state publisher used by moveit and RViz.

Making the robot controller

The robot controller needs to take in a target pose and output an action that can be executed on the robot. unity_victor_teleop published the pose_target. The sister library (vr_teleop) subscribes to this topic, performs IK using IKFast, does some simple validation, and publishes the command to our robot. You may want to copy this design with the kinematics of your robot, or write your own controller.

In this demo so far the simulated robot is very simple, and just moves exactly as the action commands with no dynamics or collision checking. You may choose to create a similar demo script. Our simulated robot regularly publishes its current state.

Interacting with Unity

You'll notice there are three copies of the robot "Victor" in the unity project.

  • Victor_Real is int the position of the robot directly set by the robot's reporting of the current state
  • Victor_IK shows the IK solution that was found. If the robot has reached the goal, this will be the same as the final potision
  • Victor_Graspable is a copy of the robot grippers. These can be "grasped" with the VR controllers because they have the script "Intractable". When grasped they publish their current position as the goal for the controller using the VictorHand script.

graspable hands graspable hands graspable hands

There are a few more scripts attached to Victor_Graspable that allow interacting with the grippers such as:

  • vibrating when the torque of the arm is too high
  • sending commands to open and close the grippers
  • change the color if the there is no valid solution found by the controller

hands

You will have to build out these components for your robot, but I hope this repo provides a good starting point!

Let me know what you build!