====== TurtleBot Lab Guide ====== ==== Booking a robot ==== * The booking system is available at https://cw.felk.cvut.cz/brute/student/reservation.php. * Create a team of at most three students for the semestral work assignment in [[https://cw.felk.cvut.cz/brute|BRUTE]]. * Each team can book one robot for four 45min time slots. * Each team can book the playground only for a single 45min time slot. * Every two slots contain a 15min break, so that the slots are aligned with the school schedule hours. * Note: All the robots are already reserved for ARO students during the ARO lab slots. There is no need to book the robots for your ARO lab slot, just take one. ==== Turning a robot on ==== * Turn the robot on using the black power flip switch located on the side of each robot base. * Turn on the robot NUC computer by pressing its power button. * The robot is ready when its screen shows the Ubuntu desktop and the robot number. ==== SSH login to the robots ==== Use the following command to login to your booked robot (turtle04 in this case) from one of the lab computers (machine name 'pc', username 'user'). The password is ''%%r0sr0s%%''. The commands here are shown as displayed in a terminal, so do not type the prompt (e.g. ''%%user@pc:~$%%'') again, only the command itself (e.g. ''%%ssh ros@turtle04%%''). user@pc:~$ ssh ros@turtle04 password: A TurtleBot welcome message etc... ros@turtle04:~$ Although one can also use all the robots numbered from one to seven, the robots turtle04, turtle06, turtle07 are equipped with all the hardware needed in the ARO course (RPLidar, RealSense). If you want to login to the robots from your own laptop, you need to connect to the lab wi-fi hotspot: SSID: e210bot password: j6UsAC8a The robots can be accessed via the domain names ''%%turtle04.local, turtle06.local, turtle07.local%%'' etc. on the wireless network. === Turtlebots' IP addresses === In the rare case the local domain name system does not work, you may access the robots via their IP addresses instead of the domain names: 192.168.210.21 turtle01 192.168.210.22 turtle02 192.168.210.23 turtle03 192.168.210.24 turtle04 192.168.210.25 turtle05 192.168.210.26 turtle06 192.168.210.27 turtle07 On your computer, you can add these items to ''/etc/hosts'' to ensure the name resolution works. ==== ROS workspace location and data transferring ==== Upload your ROS packages into ~/workspace/aro_student/. Create the workspace folder on the robot if it does not already exist: ros@turtle04:~$ mkdir -p ~/workspace/aro_student/src If the workspace exists, delete it and create it again: ros@turtle04:~$ rm -r ~/workspace/aro_student ros@turtle04:~$ mkdir -p ~/workspace/aro_student/src The first suitable ROS package to copy to the robot is [[https://cw.fel.cvut.cz/wiki/_media/courses/aro/tutorials/robot_coordination.tar.gz|robot_coordination]]. It provides waypoint navigation services and a sample Python script to follow a predefined trajectory with the robot. One needs to extract the robot_coordination folder from the tar.gz archive before copying it to the TurtleBot computer. To synchronize a folder robot_coordination (change this folder name later to your own folder containing a ROS package) to the workspace of turtle04, type the following command on your PC: user@pc:~$ rsync -av --delete robot_coordination ros@turtle04:~/workspace/aro_student/src The command transfers the data of the local folder robot_coordination via SSH over the network to the computer of TurtleBot turtle04. Before shutting down the robot and leaving, do not forget to delete all your files on the TurtleBot: ros@turtle04:~$ rm -r ~/workspace/aro_student ==== Controlling the robot from your computer ==== Another option is to run on the robot only the drivers and have the rest running on your computer. There is no need to transfer your workspace to the robot in this setup. For that to work, one has to ensure that nodes can establish connection in both ways---both from your computer to the robot and from the robot to your computer. Let the roscore and drivers run on the robot (''turtle_start'' and ''rplidar.launch'' below). On your computer, you can run e.g. source ~/path/to/your_workspace/devel/setup.bash export ROS_MASTER_URI=http://turtle07:11311/ export ROS_IP=`ip -4 addr | grep -oP '(?<=inet\s)192\.168\.210\.\d+'` roslaunch aro_slam live.launch ''ROS_MASTER_URI'' tells the nodes what roscore to contact (pick your turtle), ''ROS_IP'' tells them to advertise topics using the IP address (which the robot can see) instead of the hostname (which it may not see). On your computer, add static IP addresses of the robots to ''/etc/hosts'' to ensure the name resolution works. See Turtlebots' IP addresses above. ==== Starting the robot ==== Activate ROS and basic TurtleBot packages: ros@turtle04:~$ turtle_stop ros@turtle04:~$ turtle_start Activate the RPLidar if it is not already running: ros@turtle04:~$ tmux new-window -t ros:3 ros@turtle04:~$ tmux send -t ros:3 "roslaunch rplidar_ros rplidar.launch" ENTER Change the current directory to the catkin workspace, build it and source it: ros@turtle04:~$ cd ~/workspace/aro_student ros@turtle04:~/workspace/aro_student$ catkin build ros@turtle04:~/workspace/aro_student$ source devel/setup.bash Run any ROS nodes you wish, e.g. waypoint navigation from the robot_coordination package: ros@turtle04:~$ rosrun robot_coordination robot_node When the waypoint navigation services are running, you can make the robot move by running the provided example script in another bash terminal, again while being logged in to the robot: ros@turtle04:~$ rosrun robot_coordination path_following_simple.py See the README.md file in the robot_coordination package for more details. To start the ICP SLAM node: ros@turtle04:~$ roslaunch aro_slam live.launch If you want to run a program requiring PyTorch, source the PyTorch virtual environment first: ros@turtle04:~$ source ~/torchenv/bin/activate ==== Shutting down ==== * Run ''%%turtle_stop%%''. * Delete all your files on the TurtleBot, ''%%rm -r ~/workspace/aro_student%%''. * Turn off the NUC computer by pressing its power button. * Turn off the robot by the black power flip switch. * Park the robot in a charging station.