To run the code in this tutorial, you need first download the package. https://github.com/hutslib/rchome_tutorial Put robocup_vision_tutorial package in your catｋｉｎ_ws.
$ cd ~/catkin_ws $ catkin_make
Ｙｏｕ ｎｅｅｄ ｆｉｒｓｔ bringup your robot. Follow the steps in the bringup tutorial. Your need to start your camera. Take astra camera for example.
$ roslaunch astra_launch astra.launch
$ cd ~/catkin_ws/robocup_vision_tutorial/scripts
You need to modify the scripts named take_pic.py.
You need to change my_pic.take("/home/hts/rchome_tutorial/robocup_vision_tutorial/test_imgs/my_img1.jpg") with your own img_topic and the result_path you want. change the image topic name image_sub = rospy.Subscriber ("/astra/rgb/image_raw", Image, self.callback)
Then you can run the following command to test whether it works. If you see a pic taken and saved in your own result_path, it means it works ok!
$ python take_pic.py
if you want to use this function in your task, annotate the main function and create the class object in your code just as the example in main now.