Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorials:intermediate:pepper_shopping [2020/05/13 14:47] – added an example of lisp code gkazhoyatutorials:intermediate:pepper_shopping [2020/08/17 22:42] derrick
Line 1: Line 1:
 ====== Pepper robot shopping assistant (tutorial in construction) ====== ====== Pepper robot shopping assistant (tutorial in construction) ======
  
-===== This is an example section title ===== +===== Setting Up The Workspace =====
-==== This is then a subsection ====+
  
-  This is a bit of code+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: 
 + 
 +<code> 
 +$ sudo apt update && sudo apt upgrade   
 +</code> 
 + 
 +Let’s update ROS and CRAM components. In the terminal type and execute the following commands: 
 + 
 +<code> 
 +$ cd ~/workspace/ros/ 
 +$ sudo apt install ros-kinetic-joint-state-publisher-gui 
 +$ sudo apt-get install ros-kinetic-pepper-meshes    
 +</code> 
 + 
 +**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 
 + 
 +<code> 
 +$ sudo apt-get install ros-kinetic-ros-control ros-kinetic-ros-controllers 
 +$ sudo apt install ros-melodic-roslisp-common   
 +</code> 
 + 
 +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. 
 + 
 +<code> 
 +$ cd ~/workspace/ros/src/cram 
 +$ git checkout 3f5b268504cb5226709daa7a5d52364c2b05a93d 
 +$ git branch  
 +</code> 
 + 
 +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 package in the src of our ROS workspace by running the command below in a terminal. 
 + 
 +<code> 
 +$ cd ~/path-to-workspace/ros/src 
 +$ catkin_create_pkg pepper_description 
 +</code> 
 + 
 +The terminal should be looking like the sample below. 
 + 
 +<code> 
 +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. 
 +</code> 
 + 
 +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. 
 + 
 +<code XML> 
 +<?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>
      
-<code lisp+  <build_export_depend>urdf</build_export_depend
-(and this-is (some lisp code with lisp highlighting))+ 
 +  <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>
 </code> </code>
  
-  - This is an ordered list+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. 
 + 
 +<code> 
 +find_package(catkin REQUIRED COMPONENTS 
 +  urdf 
 +  controller_manager 
 +  joint_state_controller 
 +  robot_state_publisher 
 +
 +</code> 
 + 
 +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 [[https://github.com/danricky/cram-pepper/raw/master/map-2017-11-ease-demo.pgm|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. 
 + 
 +<code> 
 +; (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."
 + 
 +</code> 
 + 
 +Now we can compile. Run the code below. 
 + 
 +<code> 
 +$ cd .. && catkin_make 
 +</code> 
 + 
 +==== 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 [[https://github.com/danricky/cram-pepper/tree/master/pepper_description/urdf|these]] files and put them in the URDF folder. Download [[https://github.com/danricky/cram-pepper/tree/master/pepper_description/meshes|these]] meshes and put them in the meshes folder. Download the [[https://github.com/danricky/cram-pepper/blob/master/pepper_description/launch/upload.launch|upload.launch]] file and put it in the launch folder.  
 + 
 +Now let’s explain the code in the //upload.launch// file. 
 + 
 +<code> 
 +<include file="$(find iai_maps)/launch/map.launch" /> 
 +</code> 
 + 
 +This line uploads the occupancy map for navigation. It is the environment or free space for the robot to move around. 
 + 
 +<code> 
 +<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'" /> 
 +</code> 
 + 
 +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. 
 + 
 +<code> 
 +<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> 
 +</code> 
 + 
 + 
 +The next line is a ROS node to publish the robot and the shelf joint state values to make them available to other nodes. 
 + 
 + 
 +<code> 
 +<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> 
 +</code> 
 + 
 +This line is also a ROS node to publish the robot state values of the robot and the shelves. 
 + 
 +<code> 
 +<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> 
 +</code> 
 + 
 +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. 
 + 
 +<code> 
 +$ roslaunch pepper_description upload.launch 
 +</code> 
 + 
 +Open another terminal and open RViz. 
 + 
 +<code> 
 +$ rviz 
 +</code> 
 + 
 +You should see a window like the one below. 
  
-  * And this is a bullet list 
  
-Below is a horizontal rule: 
----------------------------------- 
  
-And this is ''some inline code'', and this is <html><!-- a comment --/></html>