Skip to content

ReplaceRobot

Jeff Delmerico edited this page Feb 19, 2021 · 3 revisions

3.1 Replacing the robot

To replace the Jackal robot from this demo you'll have to do the following steps:
(This list assumes, that you have the robot installed and working on your linux machine)

3.1.1 Importing the new Robot into Unity

  1. Install the required packages This package is required to send stl and mesh files from the linux machine to unity.
// install file_server package
$ cd /home/ && git clone https://github.com/EricVoll/ros-sharp.git
$ mv /home/ros-sharp/ROS/file_server /home/catkin_ws/src
$ rm -r -f /home/ros-sharp
$ cd /home/catkin_ws
$ catkin_make
$ source /home/catkin_ws/devel/setup.bash
  1. Write a roslaunch file similar to this one
    (This is the roslaunch file which was used to import Jackal into Unity) and place it in the launch directory of the file_server package. The roslaunch file has to:
  • Start the file_server package, which will later allows Ros# to import stl files.
  • Write the urdf content of your robot in the robot_description parameter on the parameter server
  • Write the robot's name in the robot/name parameter.
  1. Import the robot
    For that, follow this tutorial from the original Ros# repository. In principle, your robot is now present in the Unity game.

3.1.2 Configure the RosConnector

Everything that's left is to configure the Demo scene to listen to the correct topics and to publish to the correct topics.
Do the following:

  • Add a JointStateSubscriber and a JointStatePatcher component to the RosConnector
  • Assign the Field UrdfRobot of the JointStatePatcher with the topmost GameObject of your imported Robot
  • Click "Enable" right next to "Subscribe Joint State". The Editor script will auto assign all references for you.
  • If you want the base of your robot to move as well (e.g. mobile robots) add a OdometrySubscriber to the RosConnector and configure the correct Topic to subscribe to. Then assign the Published Transform reference with the base GameObject's Transform of your robot. In theory you can of course also add multiple OdometrySubscribers if your robot requires you to do so.
  • You can also add Path visualization. To do that, add a prefab called "PathVisualization" as a sibling to your Robot-GameObject, and a NavigationPathSubscriber to the RosConnector, and configure their paths accordingly.

The process for adding JointStatePublishers is pretty much the same and self explanatory.

The ExecutableStampedPosePublisher maybe has to be adjusted to the correct topic, where you'd like to send the goal-pose to. That depends on the trajectory planner you are using.

Clone this wiki locally