This is an old revision of the document!
Pepper robot shopping assistant (tutorial in construction)
Setting Up The Workspace
This process assumes you have already installed CRAM on your laptop. If not, please visit the installation section. If you are using the image version of CRAM, please follow the next section.
VM Set Up
Open the terminal by just typing ctrl+alt+t and then type and execute the following command:
$ sudo apt update && sudo apt upgrade
Let’s update ROS and CRAM components. In the terminal type and execute the following commands:
$ cd ~/workspace/ros/ $ sudo apt install ros-kinetic-joint-state-publisher-gui $ sudo apt-get install ros-kinetic-pepper-meshes
Please note that during this process, a window will pop up, and you must accept the license. Press tab key to select 0K then Yes.
Install ros-control and roslisp_common package
$ sudo apt-get install ros-kinetic-ros-control ros-kinetic-ros-controllers $ sudo apt install ros-melodic-roslisp-common
At this point, we need an older version of CRAM. We a specific branch of the CRAM architecture. Therefore, if you have some work done in the current version of CRAM, please make a copy and place it in a different directory for safekeeping or commit your current branch.
Run the following in your terminal.
$ cd ~/workspace/ros/src/cram $ git checkout 3f5b268504cb5226709daa7a5d52364c2b05a93d $ git branch
Use the last command to confirm that you are using a branch named 3f5b268.
Native Set Up
If you did a native installation of ROS and CRAM, you would most likely install all the necessary components. However, you have to go through the setup process for the VM to be sure everything is setup. Otherwise, skip to the part where you change the branch, then you are set to go.
Now let's begin.
First, we need to set up our Robot and Shelf models to upload them to the ROS parameter server. Through that, we can visualize these models in RViz and the Bullet world.
Let's begin by creating a package in the src of our ROS workspace by running the command below in a terminal.
$ cd ~/path-to-workspace/ros/src $ catkin_create_pkg pepper_description
The terminal should be looking like the sample below.
Created file pepper_description/package.xml Created file pepper_description/CMakeLists.txt Successfully created files in /home/path-to-workspace/ros/src/pepper_description. Please adjust the values in package.xml.
Next, we are going to adjust the values in the package.xml file. Here we want to add all the project dependencies to this file. Replace everything in the file with the code below.
<?xml version="1.0"?> <package format="2"> <name>pepper_description</name> <version>1.0.0</version> <description>The pepper_description package</description> <maintainer email="pepper@todo.todo">pepper</maintainer> <license>TODO</license> <buildtool_depend>catkin</buildtool_depend> <build_depend>urdf</build_depend> <build_depend>controller_manager</build_depend> <build_depend>joint_state_controller</build_depend> <build_depend>robot_state_publisher</build_depend> <build_export_depend>urdf</build_export_depend> <exec_depend>urdf</exec_depend> <exec_depend>controller_manager</exec_depend> <exec_depend>joint_state_controller</exec_depend> <exec_depend>robot_state_publisher</exec_depend> </package>
Next, we edit the CMakeList.txt file. Here we need to tell catkin which other packages are required for building our package. Add the same list of packages from the package.xml file to the find_package section of the CmakeList.txt file. It should look like the sample below.
find_package(catkin REQUIRED COMPONENTS urdf controller_manager joint_state_controller robot_state_publisher )
Rename the file “PATH-TO-YOUR-WORKSPACE/ros/src/iai_maps/iai_maps/maps/map-2017-11-ease-demo.pgm” to “PATH-TO-YOUR-WORKSPACE/ros/src/iai_maps/iai_maps/maps/map-2017-11-ease-demo-old.pgm”. Download the file “map-2017-11-ease-demo.pgm” from here and replace the old file with this new one. Here we are replacing the default map with our map.
Next, open this file: “PATH-TO-YOUR-WORKSPACE/ros/src/cram/cram_common/cram_robot_pose_gaussian_costmap/src/current-pose-generator-and-pose-validator.lisp” in any text editor.
Comment out the following code by putting semi-colon in front of them. It should be on line 40 - 43.
; (desig:register-location-generator ; 3 robot-current-pose-tf-generator ; "We should move the robot only if we really need to move. Try the ; current robot pose as a first solution.")
Now we can compile. Run the code below.
$ cd .. && catkin_make
Uploading Models to the Parameter Server
After successfully building the package, we need to add the models we will be uploading to the ROS parameter server. Change directory to the pepper_description package, and let's create three folders, namely launch, meshes, and urdf.
Download these files and put them in the URDF folder. Download these meshes and put them in the meshes folder. Download the upload.launch file and put it in the launch folder.
Now let’s explain the code in the upload.launch file.
<include file="$(find iai_maps)/launch/map.launch" />
This line uploads the occupancy map for navigation. It is the environment or free space for the robot to move around.
<param name="robot_description" textfile="$(find pepper_description)/urdf/pepper.urdf" /> <param name="shelf_description" command="$(find xacro)/xacro --inorder '$(find pepper_description)/urdf/dm_shelves.urdf.xacro'" />
These two lines are the representation of the Pepper robot and shelves in the URDF. Take note of the name parameter. We will need it for Rviz visualization.
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" ></node> <node name="shelf_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" > <remap from="robot_description" to="shelf_description"/> </node>
The next line is a ROS node to publish the robot and the shelf joint state values to make them available to other nodes.
<node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" /> <node pkg="robot_state_publisher" type="state_publisher" name="shelf_tf_state_publisher"> <param name="publish_frequency" value="25"/> <remap from="robot_description" to="shelf_description" /> </node>
This line is also a ROS node to publish the robot state values of the robot and the shelves.
<node pkg="tf" type="static_transform_publisher" name="pepper_wrt_map_tf" args="0 0 0 0 0 0 /map /base_link 25"></node> <node pkg="tf" type="static_transform_publisher" name="shelf_wrt_map_tf" args="0 0 0 0 0 0 /map /room_link 25"></node>
The last two lines are nodes to publish transform frames with respect to the map.
Save and compile your workspace.
Now let's upload the models to the ROS parameter server. Run the code below.
$ roslaunch pepper_description upload.launch
Open another terminal and open RViz.
$ rviz
You should see a window like the one below.