Search
Your task will be to explore a bagfile containing data from a laser scanner (obtained from a real turtlebot). Once you have familiarized yourself with the contents of the bagfile, you should create a node that will collect and process the laser scanner data. After collecting the specified number of samples, the node will publish the collected data in batch using a ROS message. You can find a more detailed description of the individual sub-tasks below.
$ wget https://cw.fel.cvut.cz/b202/_media/courses/aro/tutorials/2019-02-20-11-00-56.zip $ unzip 2019-02-20-11-00-56.zip
rosbag info <bag_name>
rqt_bag <bag_name>
rosmsg show <msg_type>
aro_scan
scancollector.py
scan_filtered
data
layout
You can plot the data to check it using the plot(x, y) function of the pyplot module from the matplotlib package. You might also need to use the show() function to show the plot.
rospy.get_param()
#!/usr/bin/env python3 import rospy import numpy as np # TODO other imports class ScanCollector(): def __init__(self): # Initialize the node here # retrieve the necessary parameters from the parameter server rospy.get_param( ... ) # and store them into variables # create the listener object and assign a class method as the callback # possibly do some additional stuff def scan_callback(self, msg): # process the message # if enough data has been collected, publish the data if __name__ == '__main__': sc = ScanCollector() rospy.spin()
Here is an example of a data plot (extracted from the bag with plot_length set to 500):
Your plot might differ a little, depending on the parameters. You also don't need to tune value ranges of the plot axis and the labels (but the plot will look nicer if you do!)
Please, submit your solution to the upload system. Upload the whole package aro_scan (as a folder with matching name, that contains the script and the config files “CMakeList.txt”, “package.xml”). Please, do not upload the entire workspace or just the files. 5 points will be awarded for valid submission.