===== Prerequisites ===== You are required to be on two mailing lists before you can work on the pr2: * robots@ias.cs.tum.edu (register [[https://toychest.ai.uni-bremen.de/wiki/robots:pr2_guidelines|TBD]]) * pr2-users@lists.willowgarage.com (register [[https://toychest.ai.uni-bremen.de/wiki/robots:pr2_guidelines|TBD]]) You also need to watch the pr2 [[https://www.youtube.com/watch?v=9OQK_h6ZB6Q|safety video]] before working on it. We recommend to read the [[https://pr2s.clearpathrobotics.com/wiki/PR2%20Manual|pr2 manual]]. ===== Accounts ===== You can get your account from the administrators [[mailto:amaldo@cs.uni-bremen.de|Alexis]], [[mailto:georg.bartels@cs.uni-bremen.de|Georg]], [[mailto:lisca@cs.uni-bremen.de|Gheorghe]]. You will get full sudo permissions on the robot. Be careful with it. If you do not know all possible effects of an action, ask one of the administrators before. Installation of new software packages with `aptitude` or `apt-get` is not a problem. Messing around in configuration files or doing something like `sudo make install` is not allowed. Please be always aware that the robot may be reinstalled and your home directory gets deleted during this process. Never keep any important data on the robot. Always copy important data to your local machine. ===== Computer's Clock Synchronization ===== Consistent time-stamping of data exchanged between the user's computer and the robot's computer is crucial for interpreting this data, on both computers. Keeping the the user's computer time synced with the robot's computer time requires some attention. The tool employed to take care of this synchronization is chrony [[http://chrony.tuxfamily.org]]. The general strategy is to have the two computers (user's computer and robot's computer) tightly coupled to one another, but loosely coupled to an external time source. This will prevent the robot time and the user time from drifting too far one from the other. In our case the external time source will be the robot's base station. The robot's computer time should be always synced to the base station time. chony's job is to synchronize the user's computer time to the base station time. I order to employ chrony to keep synced your computer time with the base station computer time, make sure: 1. you have chrony installed sudo apt-get install chrony 2. you updated your chrony configuration file: /etc/chrony/chrony.conf allowing chrony to check if whether another chronyd client is already running (to be **newly added** to your chrony.conf file): pidfile /var/run/chrony-internal.pid and telling chrony client which is the chrony server to whom to sync (to **replace** the old servers in your chrony.conf): server pr2a minpoll 3 maxpoll 15 maxdelay .010 initstepslew 0 pr2a 0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org 3. restarting chrony client (running on user's computer) sudo /etc/init.d/chrony restart 4. check your installation / configuration Start chrony: chronyc Ask chrony the synchronization sources: sources You should get something similar with: 210 Number of sources = 1 MS Name/IP address Stratum Poll LastRx Last sample ============================================================================ ^* pr2a.ai.loc 3 5 0 -24us[ -31us] +/- 33ms The **asterisk * ** appearing in front of the source confirms your computer time is synced to the pr2base. Exit chrony: exit Now you should be fine. A second test would be: ntpdate -q pr2a with an expected value smaller than 0.0001 milisecond. Sometimes the clocks on the computers get into an inconsistent state. This will show up as an error in the pr2dashboard as: "NTP offset from XXX to YYY; Offset too great." If the clocks are in an inconsistent state, try restarting chrony on your computer. If this still doesn't solve the problem you may ask one of the PR2 admins to restart chrony on the basestation, c1, and c2, in this order. For additional details you may have a look how the synchronization problem between PR2's C1 and C2 is solved with the base station help http://pr2support.willowgarage.com/wiki/PR2%20Manual/Chapter13#Clock_Synchronization. ===== Software installation ===== Get familiar with [[http://www.ros.org/wiki|ROS]] by working through the following tutorials on your local machine before getting started on the robot: * [[http://wiki.ros.org/ROS/Tutorials]] both Python and C++ * [[http://www.ros.org/wiki/actionlib/Tutorials]] both Python and C++ * [[http://www.ros.org/wiki/tf/Tutorials]] both Python or C++ ===== Running the robot ===== To work on the robot, your computer must be either connected to the lab network. The robot's computers in the network are named pr2a and pr2b. export ROS_IP= export ROS_MASTER_URI=http://pr2a:11311 to run some ros nodes locally. To start your stuff, ssh into the robot with ssh @pr2a You will see a message if the robot is free or claimed right now. If it is claimed, go and find the person who claimed it and ask if he/she still needs it. __Never__ kill someone else's processes without asking. If the robot is not claimed, first find the wireless runstop. It should be close around the robot. Now claim the robot: robot claim Make sure that the runstop is off before you start up the robot with: roslaunch /etc/ros/indigo/robot.launch The robot should come up now. To check, set the %%ROS_MASTER_URI%% on your local machine to %%http://pr2a:11311%% and launch the [[http://www.ros.org/wiki/pr2_dashboard|rqt_pr2_dashboard]] with rosrun rqt_pr2_dashboard rqt_pr2_dashboard You should see only green fields. It is important that you run the dashboard whenever you are working on the robot. It might be a good idea to first start the core manually before running the robot and to run all your commands in a [[http://www.gnu.org/software/screen/|screen]] or [[http://gnometerminator.blogspot.de/p/introduction.html|terminator]] session. Now release the runstop. The robot might calibrate. Be sure that it will not hit anything while calibrating. While moving the robot, __always__ make sure that the wireless runstop is in reach. If you need to leave the robot for a short amount of time, make sure that you always press the runstop and make sure that the pr2's power cable is plugged in. **First plug in the power cable into the PR2's inlet, then into the wall outlet**. This is important because the power cable and the pr2 power inlet might get damaged otherwise. When you are done on the robot, move it to its docking station and plug in the network cable and the power cable. Press the red button on the runstop. Now release the robot with: robot release No food or drink in the PR2 workspace, in particular anywhere the PR2 might make contact with. Keep the joystick plugged into the USB hub nearby the robot charging station when not in use. Obey standard PR2 safety protocol, including: No sharp objects in the PR2’s grasp. No liquids near the PR2, regardless of how sturdy you think the container is. No objects may be placed on top of the PR2. Be wary of small objects (e.g. screws). If you suspect anything has fallen in the PR2, cut the power with the breakers and contact [[mailto:amaldo@cs.uni-bremen.de|Alexis]] immediately. ===== Running Kinect2 from PR2 ===== * Make sure the robot is running. * Make sure your user has access to the [[ias:backpackpc|Backpack PC]]. ==== Starting Kinect 2 Node ==== - Connect to pr2a: # ssh -XAC pr2a - Start the Kinect2 bridge: (stopping with **CTRL+C**) # /etc/ros/kinect2_bridge_remote.sh This script sets the environment and launches the kinect2_bridge node on the [[ias:backpackpc|Backpack PC]]. ===== Checklists ===== ==== Running the robot ==== * Check if the robot is claimed. Do not kill other people's processes without asking them. * Make sure the runstop is off * Claim and start up the robot with robot claim * Run the dashboard on your local machine * Release the runstop. The robot might calibrate. Make sure that it doesn't hit anything. * Work with the robot. * Always have the runstop in reach. * When you are done working with the robot press the "Stop" button on runstop. * Release the robot robot release ==== Leaving the robot for a short time ==== * Press the runstop * Make sure the robot is plugged in ==== Shutting down the robot ==== * Move the robot to its docking station * Plug in the robot (Ethernet and power). **First plug in the power cable into the PR2's inlet, then plug in the power cable into the wall outlet** * Press the red button on the runstop * Release the robot with `robot release` * Plug the PS3 controller into the USB hub nearby the robot ==== Rebooting the robot ==== * on pr2b enter the command sudo shutdown -h now * on pr2a enter the command sudo shutdown -h now * flip off the power switch (on the back side of robot's base) * flip on the power switch (on the back side of robot's base) * pr2a should boot automatically (no help needed) * in case help is needed then in your favourite browser, open pr2a's remote BIOS screen http://192.168.102.79 * pr2b needs manual trigger for the the booting process * in your favourite browser, open pr2b's remote BIOS screen http://192.168.102.81 * ask [[mailto:amaldo@cs.uni-bremen.de|Alexis]] or [[mailto:lisca@cs.uni-bremen.de|Gheorghe]] the magic username and password * hit enter in order to trigger the pr2b's booting process (just follow the instructions on the screen) * next step: the calibration routine (trigger at the first run of roslaunch /etc/ros/indigo/robot.launch)