Usage - AmyPhung/SLAM-SoftDes-Final-Project GitHub Wiki

Make sure that you have completed all the steps outlined on the page Environment Setup

If you run into errors, look at the Troubleshooting Page

To run simulation

First, export the correct map with the following commands:

export NAV_TURTLE_MAP_FILE=~/catkin_ws/src/nav_turtle/maps/cc3.yaml
export NAV_TURTLE_WORLD_FILE=~/catkin_ws/src/nav_turtle/maps/stage/cc3.world

Then run the following to boot up the simulation:

roslaunch nav_turtle nav_turtle_sim.launch initial_pose_x:=8.0 initial_pose_y:=-5.5

To run robot

To run the robot, navigate to the folder that contains the file 'PublishingVelocites.py' Then run the following command to get the robot to move:

python2 PublishingVelocities.py

To run turtlebot and build map only

To run the turtlebot, you need a computer connecting the turtlebot (the robot machine) and a computer for keyboard teleop (the work station). The keyboard teleop requires you to ssh to the robot machine on the work station computer.

First, on the robot machine, install openssh server:

sudo apt-get install openssh-server

On your workstation PC, try to connect to the turtlebot by typing the following command:

ssh name_of_turtlebot_PC@TURTLEBOT_IP

You can check the ip address by typing ifconfig in the terminal.

Type yes when asked for permission and enter the password. On the robot machine, add the following lines to the ~/.bashrc file:

#The localhost IP address = IP address for the Master node
export ROS_MASTER_URI=http://localhost:11311
#The IP address for the Master node
export ROS_HOSTNAME=TURTLEBOT_IP

Source the ~/.bashrc when finish:

source ~/.bashrc

On the work station, add the following lines to the ~/.bashrc file:

#The IP address for the Master node
export ROS_MASTER_URI=http://TURTLEBOT_IP:11311
#The IP address for your device/host IP address
export ROS_HOSTNAME=WORK_STATION_IP

Source the ~/.bashrc when finish:

source ~/.bashrc

------------------The following instructions should all be done on the robot machine.------------------------ On the robot machine, navigate to the /catkin_ws/src folder and clone turtlebot_apps and openni_camera for running the turtlebot and connecting to the Kinnect.

git clone https://github.com/turtlebot/turtlebot_apps.git
git clone https://github.com/ros-drivers/openni_camera.git
catkin_make

To start the robot, on the master node (the robot machine) run the following commands on two terminals:

roscore
roslaunch turtlebot_bringup minimal.launch

To visualize the laser scan in rviz, run the following commands:

roslaunch turtlebot_bringup 3dsensor.launch
roslaunch turtlebot_rviz_launchers view_navigation.launch

To build a map with gmapping, install the Ros package gmapping and run the following command instead of 3dsensor:

sudo apt-get install ros-kinetic-slam-gmapping
roslaunch turtlebot_navigation gmapping_demo.launch

------------------The following instructions should all be done on the work station.------------------------- Drive the robot with the following command:

roslaunch turtlebot_teleop keyboard_teleop.launch

When finish, save the map data with the following command:

rosrun map_server map_saver -f /folder/of/your/own/choosing

The previous command will generate a .pgm file and a .yaml file with the name you specified in the map_server command.

How to change map

If you want to change maps, you have to export the map and world files. To do this you have to run the following command with {fileLocation} replaced with the file location of the map and world files. {fileLocation_map} should be a yaml file, while {fileLocation_world} should be a world file.

export NAV_TURTLE_MAP_FILE={fileLocation_map}
export NAV_TURTLE_WORLD_FILE={fileLocation_world}