MRC/Using Pico: Difference between revisions
m (→Recording data) |
m (moved Embedded Motion Control/Using Pico to MRC/Using Pico) |
||
(17 intermediate revisions by 7 users not shown) | |||
Line 6: | Line 6: | ||
#* For Taco, the on-off switch is on the outer edge of the base. Also start the laptop, if it is not already on (you don't need to log in). | #* For Taco, the on-off switch is on the outer edge of the base. Also start the laptop, if it is not already on (you don't need to log in). | ||
--> | --> | ||
# Now plug | # Now plug the provided ethernet cable into the laptop you want to use (one of your group members' laptops). | ||
# '''From here on, you should work on your laptop.''' Open a terminal and type <pre>sshpico</pre> | # '''From here on, you should work on your laptop.''' Open a terminal and type <pre>sshpico</pre> The password is '''emc'''. | ||
<!-- where <robot name> is either pico or taco, depending on which robot you want to use. Using this command, you login on the robot's computer; the password is again '''emc'''. --> | <!-- where <robot name> is either pico or taco, depending on which robot you want to use. Using this command, you login on the robot's computer; the password is again '''emc'''. --> | ||
# Now that you are in, you can start all the necessary nodes on the robot. These controllers and drivers let your software communicate with the hardware. On the robot (so in the terminal you opened in the previous step) enter | # Now that you are in, you can start all the necessary nodes on the robot. These controllers and drivers let your software communicate with the hardware. On the robot (so in the terminal you opened in the previous step) enter | ||
Line 21: | Line 21: | ||
# Go to your group's folder: <pre>cd ~/emc/emc<group number></pre> | # Go to your group's folder: <pre>cd ~/emc/emc<group number></pre> | ||
# The rest works the same as on your own PC. | # The rest works the same as on your own PC. | ||
#* The first time, you will have to clone your git project on the robot's computer: <pre>git clone | #* The first time, you will have to clone your git project on the robot's computer: <pre>git clone https://gitlab.tue.nl/emc2019/group<group number>.git</pre> Of course with your own group number, project name etc. Just like you did on the PCs of the group members. | ||
#* Any next time you can just navigate to your group's folder and <pre>git pull</pre> | #* Any next time you can just navigate to your project folder within your group's folder and <pre>git pull</pre> | ||
#* Now that your own software is up to date, you can compile it and run it, again just like you would on your own laptop. | #* Now that your own software is up to date, you can compile it and run it, again just like you would on your own laptop. | ||
Line 47: | Line 47: | ||
A simulator simulates a perfect world, so if your software works in the simulator, it is not (at all) guaranteed to work in the real world. But because you only have limited testing time on the robots, it would be nice if you could somehow simulate being in the real world. Luckily, the developers of ROS also ran into this, so they created rosbag. Using rosbag you can record data published by the robot and play it later when you want to test an awesome new feature of your software using real sensor data, or if you just want to inspect the quality of the sensor data, etc. | A simulator simulates a perfect world, so if your software works in the simulator, it is not (at all) guaranteed to work in the real world. But because you only have limited testing time on the robots, it would be nice if you could somehow simulate being in the real world. Luckily, the developers of ROS also ran into this, so they created rosbag. Using rosbag you can record data published by the robot and play it later when you want to test an awesome new feature of your software using real sensor data, or if you just want to inspect the quality of the sensor data, etc. | ||
# The first step is again to open a terminal and log in to the robot <pre>sshpico</pre> | # The first step is again to open a terminal and log in to the robot <pre>sshpico</pre> | ||
# Find the topics you would like to record (usually those will be the ones containing data from the LRF and the odometry) by using <pre>rostopic list</pre> | # Find the topics you would like to record (usually those will be the ones containing data from the LRF and the odometry: /pico/laser and /pico/odom) by using <pre>rostopic list</pre> | ||
# You can now use the rosbag tool to record the topics you like: <pre>rosbag record topic_1 topic_2</pre>Topic_1 and topic_2 should of course be changed to the correct topic names, but you can also add more topics to this command. While recording, you should leave this terminal open, and if you think you have enough data, you can stop recording by pressing ctrl+C. If you would like to record all topics (not recommended, as this means recording '''a lot''' of unnecessary data), you could use the option -a instead of typing in all of the topic names. | # You can now use the rosbag tool to record the topics you like: <pre>rosbag record topic_1 topic_2</pre>Topic_1 and topic_2 should of course be changed to the correct topic names, but you can also add more topics to this command. While recording, you should leave this terminal open, and if you think you have enough data, you can stop recording by pressing ctrl+C. If you would like to record all topics (not recommended, as this means recording '''a lot''' of unnecessary data), you could use the option -a instead of typing in all of the topic names. | ||
# The bag file you just recorded is now in the current directory, so if you enter <pre>ls</pre> you can see it among the other files in the current directory. This should be the home directory (if you did not cd to somewhere else). You can now copy this file over the network to your own laptop by opening a new terminal (or just log out of the robot by pressing ctrl+D), navigating to the directory where you want to place your new bag file, and entering<pre>scp emc@ | # The bag file you just recorded is now in the current directory, so if you enter <pre>ls</pre> you can see it among the other files in the current directory. This should be the home directory (if you did not cd to somewhere else). You can now copy this file over the network to your own laptop by opening a '''new terminal''' (or just log out of the robot by pressing ctrl+D), navigating to the directory where you want to place your new bag file, and entering<pre>scp emc@192.168.44.253:~/<filename> <filename></pre> What this command does is the following: it securely copies (scp) from the emc account at the robot's computer the file given by the path after the colon and it places it in your current directory with the second file name. If you gathered multiple bag files on the robot's PC, you can easily copy all of them in one go by doing <pre>scp emc@192.168.44.253:~/*.bag .</pre> This will copy all files wit the .bag extention from the home folder of Pico to your current directory. | ||
# After you have copied your bag files to your own PC, clean up the robot's PC by removing your bag file(s): <pre>rm <filename></pre> This '''permanently''' removes the file from the robot's file system, so if you want to keep it, make sure you only do this after copying it to your own PC! | # After you have copied your bag files to your own PC, clean up the robot's PC by removing your bag file(s): <pre>rm <filename></pre> This '''permanently''' removes the file from the robot's file system, so if you want to keep it, make sure you only do this after copying it to your own PC! | ||
Line 57: | Line 57: | ||
# Now, because you want your node(s) to use the time that was recorded in the bag file instead of the current system time, you will have to tell it to do that. You can do that by setting the ROS parameter use_sim_time to ''true'': <pre>rosparam set use_sim_time true</pre> | # Now, because you want your node(s) to use the time that was recorded in the bag file instead of the current system time, you will have to tell it to do that. You can do that by setting the ROS parameter use_sim_time to ''true'': <pre>rosparam set use_sim_time true</pre> | ||
# If all is well, you should now be able to play the bag file by entering <pre>rosbag play --clock <filename></pre> | # If all is well, you should now be able to play the bag file by entering <pre>rosbag play --clock <filename></pre> | ||
For more advanced use and other information on the command line use of rosbag, go to the official [http://wiki.ros.org/rosbag/Commandline documentation of the tool]. |
Latest revision as of 11:12, 27 March 2020
Starting Pico
To start Pico please follow the following steps:
- Power on the robot
- For Pico, the on-off switch is on the bottom, next to the emergency button. This also starts the on-board computer
- Now plug the provided ethernet cable into the laptop you want to use (one of your group members' laptops).
- From here on, you should work on your laptop. Open a terminal and type
sshpico
The password is emc. - Now that you are in, you can start all the necessary nodes on the robot. These controllers and drivers let your software communicate with the hardware. On the robot (so in the terminal you opened in the previous step) enter
- For Pico:
pstart
- For Pico:
- N.B. leave this terminal open!
Running your software
Pico is now up and running. To run your own software follow these steps:
- Open a new terminal and login to your robot again:
sshpico
with password emc. - Go to your group's folder:
cd ~/emc/emc<group number>
- The rest works the same as on your own PC.
- The first time, you will have to clone your git project on the robot's computer:
git clone https://gitlab.tue.nl/emc2019/group<group number>.git
Of course with your own group number, project name etc. Just like you did on the PCs of the group members. - Any next time you can just navigate to your project folder within your group's folder and
git pull
- Now that your own software is up to date, you can compile it and run it, again just like you would on your own laptop.
- The first time, you will have to clone your git project on the robot's computer:
Develop while testing
You should avoid having to do hard-core debugging and developing while testing, since you only have limited testing time. However, there may be times when you have to change some things in your code and retry. There are roughly two ways to do this:
- Edit the files on your pc:
- Simply use Qt Creator or any other editor to change the files
- Push your changes to the git server
- Pull the changes on the robot, recompile, and try
- Edit the files on the robot:
- Use programs such as 'nano' or 'vim' to edit the files
- recompile and test
- Commit and push your changes once you're happy
- Be sure to set your name and email address before committing!
git config user.email "bla@student.tue.nl"
git config user.name "Your name"
Note: don't use the '--global' option as other people are also using the robot. Not having the '--global' option will limit the config change to the current repository.
- Be sure to set your name and email address before committing!
Visualization
When you want to visualize the robot while testing, you can do the following
- Open a new terminal and type
pico-core
This makes sure that any software you run in this terminal listens to the ros-master on your robot. - So if you now run our visualization software by entering
emc-viz
it will subscribe to the topics published on the robot.
Recording data
A simulator simulates a perfect world, so if your software works in the simulator, it is not (at all) guaranteed to work in the real world. But because you only have limited testing time on the robots, it would be nice if you could somehow simulate being in the real world. Luckily, the developers of ROS also ran into this, so they created rosbag. Using rosbag you can record data published by the robot and play it later when you want to test an awesome new feature of your software using real sensor data, or if you just want to inspect the quality of the sensor data, etc.
- The first step is again to open a terminal and log in to the robot
sshpico
- Find the topics you would like to record (usually those will be the ones containing data from the LRF and the odometry: /pico/laser and /pico/odom) by using
rostopic list
- You can now use the rosbag tool to record the topics you like:
rosbag record topic_1 topic_2
Topic_1 and topic_2 should of course be changed to the correct topic names, but you can also add more topics to this command. While recording, you should leave this terminal open, and if you think you have enough data, you can stop recording by pressing ctrl+C. If you would like to record all topics (not recommended, as this means recording a lot of unnecessary data), you could use the option -a instead of typing in all of the topic names. - The bag file you just recorded is now in the current directory, so if you enter
ls
you can see it among the other files in the current directory. This should be the home directory (if you did not cd to somewhere else). You can now copy this file over the network to your own laptop by opening a new terminal (or just log out of the robot by pressing ctrl+D), navigating to the directory where you want to place your new bag file, and enteringscp emc@192.168.44.253:~/<filename> <filename>
What this command does is the following: it securely copies (scp) from the emc account at the robot's computer the file given by the path after the colon and it places it in your current directory with the second file name. If you gathered multiple bag files on the robot's PC, you can easily copy all of them in one go by doingscp emc@192.168.44.253:~/*.bag .
This will copy all files wit the .bag extention from the home folder of Pico to your current directory. - After you have copied your bag files to your own PC, clean up the robot's PC by removing your bag file(s):
rm <filename>
This permanently removes the file from the robot's file system, so if you want to keep it, make sure you only do this after copying it to your own PC!
Playing back bag files
Now you can play this bag file as often as you like and have your software analyse the sensor data. To do that, take the following steps:
- First start a roscore, like you always do
- Now, because you want your node(s) to use the time that was recorded in the bag file instead of the current system time, you will have to tell it to do that. You can do that by setting the ROS parameter use_sim_time to true:
rosparam set use_sim_time true
- If all is well, you should now be able to play the bag file by entering
rosbag play --clock <filename>
For more advanced use and other information on the command line use of rosbag, go to the official documentation of the tool.