├── .gitignore ├── LICENSE ├── README.md ├── chapter2_tutorials ├── .gitignore ├── CMakeLists.txt ├── Makefile ├── mainpage.dox ├── manifest.xml ├── msg │ └── chapter2_msg1.msg ├── src │ ├── example1_a.cpp │ ├── example1_b.cpp │ ├── example2_a.cpp │ ├── example2_b.cpp │ ├── example3_a.cpp │ └── example3_b.cpp └── srv │ └── chapter2_srv1.srv ├── chapter3_tutorials ├── CMakeLists.txt ├── Makefile ├── bag │ ├── 2013-01-10-10-56-11.bag │ └── 2013-01-10-11-59-48.bag ├── config │ ├── chapter3_tutorials.config │ ├── example7.vcg │ └── example_tf.vcg ├── launch │ ├── example1.launch │ ├── example1_gdb.launch │ ├── example1_valgrind.launch │ ├── example2.launch │ ├── example3.launch │ ├── example4_5.launch │ ├── example4_record.launch │ ├── example6.launch │ └── example7.launch ├── mainpage.dox ├── manifest.xml ├── output │ └── gdb_run_node_example1.txt ├── src │ ├── .gitignore │ ├── example1.cpp │ ├── example2.cpp │ ├── example3.cpp │ ├── example4.cpp │ ├── example5.cpp │ ├── example6.cpp │ └── example7.cpp └── srv │ └── SetSpeed.srv ├── chapter4_tutorials ├── CMakeLists.txt ├── Makefile ├── example2.vcg ├── launch │ ├── example1.launch │ └── example2.launch ├── libraries │ ├── ADXL345.zip │ ├── Adafruit-BMP085.zip │ ├── L3G-master.zip │ └── LoveElectronics_HMC5883L_ArduinoLibrary_V3.zip ├── mainpage.dox ├── manifest.xml └── src │ ├── example1.cpp │ ├── example2.cpp │ ├── example3.cpp │ ├── example4.cpp │ ├── example5_1 │ └── example5_1.ino │ ├── example5_2 │ └── example5_2.ino │ ├── example6.cpp │ ├── example7 │ └── example7.ino │ └── example8.cpp ├── chapter5_tutorials ├── .bot_body1.dae.swp ├── .bot_body2.dae.swp ├── CMakeLists.txt ├── Makefile ├── launch │ ├── display.launch │ ├── display_xacro.launch │ ├── gazebo.launch │ ├── gazebo_map_robot.launch │ ├── state.launch │ └── state_xacro.launch ├── mainpage.dox ├── manifest.xml ├── src │ └── state_publisher.cpp └── urdf │ ├── bot.dae │ ├── dae.urdf │ ├── robot1.urdf │ ├── robot1.xacro │ ├── robot1_arm.xacro │ ├── robot1_base.xacro │ ├── robot1_base_01.xacro │ ├── robot1_base_02.xacro │ ├── robot1_base_03.xacro │ ├── robot1_base_04.xacro │ ├── robot1_base_laser.xacro │ └── robot1_physics.urdf ├── chapter6_tutorials ├── CMakeLists.txt ├── Makefile ├── bag │ └── viso2_demo │ │ └── download_amphoras_pool_bag_files.sh ├── calibration │ ├── camera │ │ ├── calibration_webcam.yaml │ │ ├── calibrationdata.tar.gz │ │ ├── cameracalibrator-4-stdout.log │ │ └── cameracheck-stdout.log │ ├── camera_stereo │ │ ├── calibrationdata.tar.gz │ │ ├── cameracalibrator-4-stdout.log │ │ ├── cameracheck-stdout.log │ │ ├── logitech_c120_left.yaml │ │ └── logitech_c120_right.yaml │ ├── firewire_camera │ │ ├── calibration_firewire_camera.yaml │ │ ├── calibrationdata.tar.gz │ │ └── cameracalibrator-4-stdout.log │ ├── gscam │ │ ├── calibration_gscam.yaml │ │ ├── calibrationdata.tar.gz │ │ └── stdout.log │ └── pattern │ │ └── calibration_pattern_chessboard.pdf ├── cfg │ ├── .gitignore │ ├── Camera.cfg │ └── CameraStereo.cfg ├── config │ └── chapter6_tutorials.config ├── launch │ ├── calibration │ │ ├── calibration_camera_chessboard.launch │ │ ├── calibration_camera_stereo_chessboard.launch │ │ ├── calibration_firewire_camera_acircles.launch │ │ ├── calibration_firewire_camera_chessboard.launch │ │ ├── calibration_firewire_camera_circles.launch │ │ └── calibration_gscam_chessboard.launch │ ├── camera.launch │ ├── camera_polling.launch │ ├── camera_stereo.launch │ ├── camera_timer.launch │ ├── firewire_camera.launch │ ├── frames │ │ └── stereo_frames.launch │ ├── gscam.launch │ ├── usb_cam.launch │ ├── viso2_demo.launch │ └── visual_odometry │ │ ├── viso2_mono_odometer.launch │ │ └── viso2_stereo_odometer.launch ├── mainpage.dox ├── manifest.xml ├── params │ ├── camera │ │ └── webcam.yaml │ ├── camera_stereo │ │ ├── disparity.yaml │ │ ├── logitech_c120.yaml │ │ ├── rviz.vcg │ │ └── rviz_odometry.vcg │ ├── firewire_camera │ │ └── format7_mode0.yaml │ ├── gscam │ │ └── logitech.yaml │ ├── usb_cam │ │ └── logitech.yaml │ └── viso2_demo │ │ ├── disparity.yaml │ │ └── rviz.vcg └── src │ ├── .gitignore │ ├── camera.cpp │ ├── camera_polling.cpp │ ├── camera_stereo.cpp │ └── camera_timer.cpp ├── chapter7_tutorials ├── CMakeLists.txt ├── Makefile ├── launch │ ├── display.vcg │ ├── display_xacro.launch │ ├── gazebo_map_robot.launch │ ├── gazebo_mapping_robot.launch │ ├── gazebo_xacro.launch │ └── mapping.vcg ├── manifest.xml ├── maps │ ├── map.pgm │ └── map.yaml ├── src │ ├── base_controller.cpp │ ├── laser.cpp │ ├── odometry.cpp │ ├── tf_broadcaster.cpp │ └── tf_listener.cpp └── urdf │ └── robot1_base_04.xacro ├── chapter8_tutorials ├── .tipos.swp ├── CMakeLists.txt ├── Makefile ├── launch │ ├── base_local_planner_params.yaml │ ├── chapter8_configuration_gazebo.launch │ ├── chapter8_configuration_gazebo_taliarte.launch │ ├── costmap_common_params.yaml │ ├── display.vcg │ ├── global_costmap_params.yaml │ ├── local_costmap_params.yaml │ ├── move_base.launch │ └── navigation.vcg ├── manifest.xml ├── maps │ ├── map.pgm │ └── map.yaml ├── src │ └── sendGoals.cpp └── urdf │ └── robot1_base_04.xacro └── chapter9_tutorials ├── CMakeLists.txt ├── Makefile ├── pr2 ├── CMakeLists.txt ├── Makefile ├── launch │ ├── pr2_mapping.launch │ ├── pr2_navigation.launch │ ├── pr2_no_arms_empty_world.launch │ ├── pr2_no_arms_simple_world.launch │ └── simple_world.launch ├── mainpage.dox ├── manifest.xml └── worlds │ ├── models │ └── simple │ │ ├── model-1_3.sdf │ │ ├── model.config │ │ └── model.sdf │ └── simple.world ├── r2 └── config │ └── r2.vcg ├── reem ├── CMakeLists.txt ├── Makefile ├── cfg │ └── reem.rviz ├── mainpage.dox ├── manifest.xml └── scripts │ ├── environment │ └── pal_ros_pkg_environment.sh │ ├── gazebo_install.sh │ ├── osrf_common_install.sh │ └── pal_ros_pkg_install.sh └── stack.xml /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Built using gitignore templates from https://github.com/github/gitignore 3 | 4 | # Backup 5 | *.*~ 6 | 7 | # C++.gitignore 8 | # Compiled Object files 9 | *.slo 10 | *.lo 11 | *.o 12 | 13 | # Compiled Dynamic libraries 14 | *.so 15 | *.dylib 16 | 17 | # Compiled Static libraries 18 | *.lai 19 | *.la 20 | *.a 21 | *.l 22 | 23 | # CMake.gitignore 24 | CMakeCache.txt 25 | CMakeFiles 26 | # Makefile is part of ROS packages (outside build dir) 27 | #Makefile 28 | cmake_install.cmake 29 | install_manifest.txt 30 | 31 | # Python.gitignore 32 | *.py[co] 33 | 34 | # Packages 35 | *.egg 36 | *.egg-info 37 | dist 38 | build 39 | eggs 40 | parts 41 | bin 42 | develop-eggs 43 | lib 44 | msg_gen 45 | srv_gen 46 | .installed.cfg 47 | 48 | # Installer logs 49 | pip-log.txt 50 | 51 | # Unit test / coverage reports 52 | .coverage 53 | .tox 54 | 55 | # Eclipse project files 56 | #.project 57 | #.cproject 58 | #.pydevproject 59 | 60 | # ROS 61 | *.cfgc 62 | docs 63 | *.bag* 64 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Learning ROS for Robotics Programming 2 | Copyright (C) 2013 Aaron Martinez, Enrique Fernández 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | 17 | Aaron Martinez 18 | Enrique Fernández 19 | 20 | Learning ROS for Robotics Programming Link: 21 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [Learning ROS for Robotics Programming Link](http://www.packtpub.com/learning-ros-for-robotics-programming/book) 2 | 3 | Authors: 4 | 5 | * [Aaron Martinez](http://www.aaronmr.com) 6 | * [Enrique Fernández](http://berlioz.dis.ulpgc.es/roc-siani/personas/efernandez) 7 | 8 | Code and examples!!! 9 | -------------------------------------------------------------------------------- /chapter2_tutorials/.gitignore: -------------------------------------------------------------------------------- 1 | src/chapter2_tutorials 2 | -------------------------------------------------------------------------------- /chapter2_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | #uncomment if you have defined messages 20 | rosbuild_genmsg() 21 | #uncomment if you have defined services 22 | rosbuild_gensrv() 23 | 24 | #common commands for building c++ executables and libraries 25 | #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) 26 | #target_link_libraries(${PROJECT_NAME} another_library) 27 | #rosbuild_add_boost_directories() 28 | #rosbuild_link_boost(${PROJECT_NAME} thread) 29 | #rosbuild_add_executable(example examples/example.cpp) 30 | #target_link_libraries(example ${PROJECT_NAME}) 31 | rosbuild_add_executable(example1_a src/example1_a.cpp) 32 | rosbuild_add_executable(example1_b src/example1_b.cpp) 33 | rosbuild_add_executable(example2_a src/example2_a.cpp) 34 | rosbuild_add_executable(example2_b src/example2_b.cpp) 35 | rosbuild_add_executable(example3_a src/example3_a.cpp) 36 | rosbuild_add_executable(example3_b src/example3_b.cpp) 37 | -------------------------------------------------------------------------------- /chapter2_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter2_tutorials/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b chapter2_tutorials 6 | 7 | 10 | 11 | --> 12 | 13 | 14 | */ 15 | -------------------------------------------------------------------------------- /chapter2_tutorials/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 2 tutorials. 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /chapter2_tutorials/msg/chapter2_msg1.msg: -------------------------------------------------------------------------------- 1 | int32 A 2 | int32 B 3 | int32 C 4 | -------------------------------------------------------------------------------- /chapter2_tutorials/src/example1_a.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "std_msgs/String.h" 3 | #include 4 | 5 | int main(int argc, char **argv) 6 | { 7 | ros::init(argc, argv, "example1_a"); 8 | ros::NodeHandle n; 9 | ros::Publisher pub = n.advertise("message", 1000); 10 | ros::Rate loop_rate(10); 11 | while (ros::ok()) 12 | { 13 | std_msgs::String msg; 14 | std::stringstream ss; 15 | ss << " I am the example1_a node "; 16 | msg.data = ss.str(); 17 | //ROS_INFO("%s", msg.data.c_str()); 18 | pub.publish(msg); 19 | ros::spinOnce(); 20 | loop_rate.sleep(); 21 | } 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /chapter2_tutorials/src/example1_b.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "std_msgs/String.h" 3 | 4 | void messageCallback(const std_msgs::String::ConstPtr& msg) 5 | { 6 | ROS_INFO("I heard: [%s]", msg->data.c_str()); 7 | } 8 | 9 | int main(int argc, char **argv) 10 | { 11 | ros::init(argc, argv, "example1_b"); 12 | ros::NodeHandle n; 13 | ros::Subscriber sub = n.subscribe("message", 1000, messageCallback); 14 | ros::spin(); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /chapter2_tutorials/src/example2_a.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "chapter2_tutorials/chapter2_srv1.h" 3 | 4 | bool add(chapter2_tutorials::chapter2_srv1::Request &req, 5 | chapter2_tutorials::chapter2_srv1::Response &res) 6 | { 7 | res.sum = req.A + req.B + req.C; 8 | ROS_INFO("request: A=%ld, B=%ld C=%ld", (int)req.A, (int)req.B, (int)req.C); 9 | ROS_INFO("sending back response: [%ld]", (int)res.sum); 10 | return true; 11 | } 12 | 13 | int main(int argc, char **argv) 14 | { 15 | ros::init(argc, argv, "add_3_ints_server"); 16 | ros::NodeHandle n; 17 | 18 | ros::ServiceServer service = n.advertiseService("add_3_ints", add); 19 | ROS_INFO("Ready to add 3 ints."); 20 | ros::spin(); 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /chapter2_tutorials/src/example2_b.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "chapter2_tutorials/chapter2_srv1.h" 3 | #include 4 | 5 | int main(int argc, char **argv) 6 | { 7 | ros::init(argc, argv, "add_3_ints_client"); 8 | if (argc != 4) 9 | { 10 | ROS_INFO("usage: add_3_ints_client A B C "); 11 | return 1; 12 | } 13 | 14 | ros::NodeHandle n; 15 | ros::ServiceClient client = n.serviceClient("add_3_ints"); 16 | chapter2_tutorials::chapter2_srv1 srv; 17 | srv.request.A = atoll(argv[1]); 18 | srv.request.B = atoll(argv[2]); 19 | srv.request.C = atoll(argv[3]); 20 | if (client.call(srv)) 21 | { 22 | ROS_INFO("Sum: %ld", (long int)srv.response.sum); 23 | } 24 | else 25 | { 26 | ROS_ERROR("Failed to call service add_two_ints"); 27 | return 1; 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /chapter2_tutorials/src/example3_a.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "chapter2_tutorials/chapter2_msg1.h" 3 | #include 4 | 5 | int main(int argc, char **argv) 6 | { 7 | ros::init(argc, argv, "example1_a"); 8 | ros::NodeHandle n; 9 | ros::Publisher pub = n.advertise("message", 1000); 10 | ros::Rate loop_rate(10); 11 | while (ros::ok()) 12 | { 13 | chapter2_tutorials::chapter2_msg1 msg; 14 | msg.A = 1; 15 | msg.B = 2; 16 | msg.C = 3; 17 | pub.publish(msg); 18 | ros::spinOnce(); 19 | loop_rate.sleep(); 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /chapter2_tutorials/src/example3_b.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "chapter2_tutorials/chapter2_msg1.h" 3 | 4 | void messageCallback(const chapter2_tutorials::chapter2_msg1::ConstPtr& msg) 5 | { 6 | ROS_INFO("I heard: [%d] [%d] [%d]", msg->A, msg->B, msg->C); 7 | } 8 | 9 | int main(int argc, char **argv) 10 | { 11 | ros::init(argc, argv, "example1_b"); 12 | ros::NodeHandle n; 13 | ros::Subscriber sub = n.subscribe("message", 1000, messageCallback); 14 | ros::spin(); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /chapter2_tutorials/srv/chapter2_srv1.srv: -------------------------------------------------------------------------------- 1 | int32 A 2 | int32 B 3 | int32 C 4 | --- 5 | int32 sum 6 | 7 | -------------------------------------------------------------------------------- /chapter3_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | # Log4cxx 20 | find_library(LOG4CXX_LIBRARY log4cxx) 21 | 22 | #uncomment if you have defined messages 23 | #rosbuild_genmsg() 24 | rosbuild_gensrv() 25 | 26 | rosbuild_add_executable(example1 src/example1.cpp) 27 | target_link_libraries(example1 ${LOG4CXX_LIBRARY}) 28 | 29 | rosbuild_add_executable(example2 src/example2.cpp) 30 | rosbuild_add_executable(example3 src/example3.cpp) 31 | rosbuild_add_executable(example4 src/example4.cpp) 32 | rosbuild_add_executable(example5 src/example5.cpp) 33 | rosbuild_add_executable(example6 src/example6.cpp) 34 | rosbuild_add_executable(example7 src/example7.cpp) 35 | 36 | -------------------------------------------------------------------------------- /chapter3_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter3_tutorials/bag/2013-01-10-10-56-11.bag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter3_tutorials/bag/2013-01-10-10-56-11.bag -------------------------------------------------------------------------------- /chapter3_tutorials/bag/2013-01-10-11-59-48.bag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter3_tutorials/bag/2013-01-10-11-59-48.bag -------------------------------------------------------------------------------- /chapter3_tutorials/config/chapter3_tutorials.config: -------------------------------------------------------------------------------- 1 | # Override chapter3_tutorials to output everything 2 | log4j.logger.ros.chapter3_tutorials=DEBUG 3 | 4 | -------------------------------------------------------------------------------- /chapter3_tutorials/config/example7.vcg: -------------------------------------------------------------------------------- 1 | Axes.Enabled=1 2 | Axes.Length=1 3 | Axes.Radius=0.1 4 | Axes.Reference\ Frame= 5 | Background\ ColorB=0 6 | Background\ ColorG=0 7 | Background\ ColorR=0 8 | Camera\ Config=1.4898 3.2516 195.672 0 0 0 9 | Camera\ Type=rviz::OrbitViewController 10 | Fixed\ Frame=/frame_marker 11 | Grid.Alpha=0.5 12 | Grid.Cell\ Size=1 13 | Grid.ColorB=0.5 14 | Grid.ColorG=0.5 15 | Grid.ColorR=0.5 16 | Grid.Enabled=1 17 | Grid.Line\ Style=0 18 | Grid.Line\ Width=0.03 19 | Grid.Normal\ Cell\ Count=0 20 | Grid.OffsetX=0 21 | Grid.OffsetY=0 22 | Grid.OffsetZ=0 23 | Grid.Plane=0 24 | Grid.Plane\ Cell\ Count=10 25 | Grid.Reference\ Frame= 26 | Markers.Enabled=1 27 | Markers.Marker\ Topic=/marker 28 | Markers.Queue\ Size=100 29 | Markers.shapes=1 30 | PointCloud2..AxisColorAutocompute\ Value\ Bounds=1 31 | PointCloud2..AxisColorAxis=2 32 | PointCloud2..AxisColorMax\ Value=1.08056 33 | PointCloud2..AxisColorMin\ Value=0 34 | PointCloud2..AxisColorUse\ Fixed\ Frame=1 35 | PointCloud2..FlatColorColorB=1 36 | PointCloud2..FlatColorColorG=1 37 | PointCloud2..FlatColorColorR=1 38 | PointCloud2..IntensityAutocompute\ Intensity\ Bounds=1 39 | PointCloud2..IntensityChannel\ Name=intensity 40 | PointCloud2..IntensityMax\ ColorB=1 41 | PointCloud2..IntensityMax\ ColorG=1 42 | PointCloud2..IntensityMax\ ColorR=1 43 | PointCloud2..IntensityMax\ Intensity=4096 44 | PointCloud2..IntensityMin\ ColorB=0 45 | PointCloud2..IntensityMin\ ColorG=0 46 | PointCloud2..IntensityMin\ ColorR=0 47 | PointCloud2..IntensityMin\ Intensity=0 48 | PointCloud2..IntensityUse\ full\ RGB\ spectrum=0 49 | PointCloud2.Alpha=1 50 | PointCloud2.Billboard\ Size=0.01 51 | PointCloud2.Color\ Transformer=AxisColor 52 | PointCloud2.Decay\ Time=0 53 | PointCloud2.Enabled=1 54 | PointCloud2.Position\ Transformer=XYZ 55 | PointCloud2.Queue\ Size=10 56 | PointCloud2.Selectable=1 57 | PointCloud2.Style=0 58 | PointCloud2.Topic=/pc 59 | Property\ Grid\ Splitter=523,78 60 | Property\ Grid\ State=expanded=.Global Options,Axes.Enabled,Markers.Enabled,Markers.Namespaces,PointCloud2.Enabled,PointCloud2.Status;splitterratio=0.632959 61 | QMainWindow=000000ff00000000fd00000003000000000000011d000002abfc0200000001fb000000100044006900730070006c006100790073010000001d000002ab000000ee00ffffff0000000100000131000002abfc0200000003fb0000001e0054006f006f006c002000500072006f0070006500720074006900650073010000001d000000af0000006700fffffffb0000000a0056006900650077007301000000d200000141000000bb00fffffffb0000001200530065006c0065006300740069006f006e0100000219000000af0000006700ffffff00000003000005660000003efc0100000001fb0000000800540069006d0065010000000000000566000002bf00ffffff0000030c000002ab00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 62 | Target\ Frame= 63 | Tool\ 2D\ Nav\ GoalTopic=goal 64 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 65 | [Display0] 66 | ClassName=rviz::AxesDisplay 67 | Name=Axes 68 | [Display1] 69 | ClassName=rviz::MarkerDisplay 70 | Name=Markers 71 | [Display2] 72 | ClassName=rviz::GridDisplay 73 | Name=Grid 74 | [Display3] 75 | ClassName=rviz::PointCloud2Display 76 | Name=PointCloud2 77 | [Window] 78 | Height=816 79 | Width=1398 80 | X=-16 81 | Y=-56 82 | -------------------------------------------------------------------------------- /chapter3_tutorials/config/example_tf.vcg: -------------------------------------------------------------------------------- 1 | Background\ ColorB=0 2 | Background\ ColorG=0 3 | Background\ ColorR=0 4 | Camera\ Config=233.05 0.624811 0.0130497 -1.115 5 | Camera\ Type=rviz::FixedOrientationOrthoViewController 6 | Fixed\ Frame=/world 7 | Grid.Alpha=0.5 8 | Grid.Cell\ Size=1 9 | Grid.ColorB=0.5 10 | Grid.ColorG=0.5 11 | Grid.ColorR=0.5 12 | Grid.Enabled=1 13 | Grid.Line\ Style=0 14 | Grid.Line\ Width=0.03 15 | Grid.Normal\ Cell\ Count=0 16 | Grid.OffsetX=0 17 | Grid.OffsetY=0 18 | Grid.OffsetZ=0 19 | Grid.Plane=0 20 | Grid.Plane\ Cell\ Count=10 21 | Grid.Reference\ Frame= 22 | Property\ Grid\ Splitter=296,78 23 | Property\ Grid\ State=expanded=.Global Options;splitterratio=0.632959 24 | QMainWindow=000000ff00000000fd00000003000000000000011d000001c8fc0200000001fb000000100044006900730070006c006100790073010000001d000001c8000000ee00ffffff0000000100000131000001c8fc0200000003fb0000001e0054006f006f006c002000500072006f0070006500720074006900650073010000001d000000740000006700fffffffb0000000a005600690065007700730100000097000000d4000000bb00fffffffb0000001200530065006c0065006300740069006f006e0100000171000000740000006700ffffff00000003000005580000003efc0100000001fb0000000800540069006d0065010000000000000558000002bf00ffffff000002fe000001c800000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 25 | TF.All\ Enabled=1 26 | TF.Enabled=1 27 | TF.Frame\ Timeout=15 28 | TF.Marker\ Scale=1 29 | TF.Show\ Arrows=1 30 | TF.Show\ Axes=1 31 | TF.Show\ Names=1 32 | TF.Update\ Interval=0 33 | Target\ Frame= 34 | Tool\ 2D\ Nav\ GoalTopic=goal 35 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 36 | [Display0] 37 | ClassName=rviz::GridDisplay 38 | Name=Grid 39 | [Display1] 40 | ClassName=rviz::TFDisplay 41 | Name=TF 42 | [TF.Frames.] 43 | turtle1.Enabled=1 44 | turtle2.Enabled=1 45 | world.Enabled=1 46 | [Window] 47 | Height=589 48 | Width=1384 49 | X=-23 50 | Y=-56 51 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example1.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example1_gdb.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example1_valgrind.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example2.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example3.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example4_5.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example4_record.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example6.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter3_tutorials/launch/example7.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter3_tutorials/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b chapter3_tutorials 6 | 7 | 10 | 11 | --> 12 | 13 | 14 | */ 15 | -------------------------------------------------------------------------------- /chapter3_tutorials/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 3 tutorials. 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /chapter3_tutorials/output/gdb_run_node_example1.txt: -------------------------------------------------------------------------------- 1 | (gdb) r 2 | Starting program: /home/enrique/dev/rosbook/chapter3_tutorials/bin/example1 3 | [Thread debugging using libthread_db enabled] 4 | Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 5 | [New Thread 0x7ffff2664700 (LWP 3204)] 6 | [New Thread 0x7ffff1e63700 (LWP 3205)] 7 | [New Thread 0x7ffff1662700 (LWP 3206)] 8 | [New Thread 0x7ffff0e61700 (LWP 3211)] 9 | [DEBUG] [1356342615.325647326]: This is a simple DEBUG message! 10 | [DEBUG] [1356342615.326124607]: This is a DEBUG message with an argument: 3.140000 11 | [DEBUG] [1356342615.326254667]: This is DEBUG stream message with an argument: 3.14 12 | [Thread 0x7ffff0e61700 (LWP 3211) exited] 13 | [Thread 0x7ffff1662700 (LWP 3206) exited] 14 | [Thread 0x7ffff2664700 (LWP 3204) exited] 15 | [Thread 0x7ffff1e63700 (LWP 3205) exited] 16 | [Inferior 1 (process 3200) exited normally] 17 | 18 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/.gitignore: -------------------------------------------------------------------------------- 1 | chapter3_tutorials 2 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/example1.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ros/ros.h" 3 | 4 | #define OVERRIDE_NODE_VERBOSITY_LEVEL 1 5 | 6 | int main( int argc, char **argv ) 7 | { 8 | 9 | ros::init( argc, argv, "example1" ); 10 | 11 | #if OVERRIDE_NODE_VERBOSITY_LEVEL 12 | // Se the logging level manually to DEBUG 13 | ROSCONSOLE_AUTOINIT; 14 | log4cxx::LoggerPtr my_logger = 15 | log4cxx::Logger::getLogger( ROSCONSOLE_DEFAULT_NAME ); 16 | my_logger->setLevel( 17 | ros::console::g_level_lookup[ros::console::levels::Debug] 18 | ); 19 | #endif 20 | 21 | ros::NodeHandle n; 22 | 23 | const double val = 3.14; 24 | 25 | ROS_DEBUG( "This is a simple DEBUG message!" ); 26 | 27 | ROS_DEBUG( "This is a DEBUG message with an argument: %f", val ); 28 | 29 | ROS_DEBUG_STREAM( 30 | "This is DEBUG stream message with an argument: " << val 31 | ); 32 | 33 | ros::spinOnce(); 34 | 35 | return EXIT_SUCCESS; 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/example2.cpp: -------------------------------------------------------------------------------- 1 | 2 | #define ROSCONSOLE_MIN_SEVERITY ROSCONSOLE_SEVERITY_DEBUG 3 | 4 | #include 5 | #include 6 | 7 | int main( int argc, char **argv ) 8 | { 9 | 10 | ros::init( argc, argv, "example2" ); 11 | 12 | ros::NodeHandle n; 13 | 14 | const double val = 3.14; 15 | 16 | // Basic messages: 17 | ROS_INFO( "My INFO message." ); 18 | ROS_INFO( "My INFO message with argument: %f", val ); 19 | ROS_INFO_STREAM( 20 | "My INFO stream message with argument: " << val 21 | ); 22 | 23 | // Named messages: 24 | ROS_INFO_STREAM_NAMED( 25 | "named_msg", 26 | "My named INFO stream message; val = " << val 27 | ); 28 | 29 | // Conditional messages: 30 | ROS_INFO_STREAM_COND( 31 | val < 0., 32 | "My conditional INFO stream message; val (" << val << ") < 0" 33 | ); 34 | ROS_INFO_STREAM_COND( 35 | val >= 0., 36 | "My conditional INFO stream message; val (" << val << ") >= 0" 37 | ); 38 | 39 | // Conditional Named messages: 40 | ROS_INFO_STREAM_COND_NAMED( 41 | val < 0., "cond_named_msg", 42 | "My conditional INFO stream message; val (" << val << ") < 0" 43 | ); 44 | ROS_INFO_STREAM_COND_NAMED( 45 | val >= 0., "cond_named_msg", 46 | "My conditional INFO stream message; val (" << val << ") >= 0" 47 | ); 48 | 49 | // Filtered messages: 50 | struct MyLowerFilter : public ros::console::FilterBase { 51 | MyLowerFilter( const double& val ) : value( val ) {} 52 | 53 | inline virtual bool isEnabled() 54 | { 55 | return value < 0.; 56 | } 57 | 58 | double value; 59 | }; 60 | 61 | struct MyGreaterEqualFilter : public ros::console::FilterBase { 62 | MyGreaterEqualFilter( const double& val ) : value( val ) {} 63 | 64 | inline virtual bool isEnabled() 65 | { 66 | return value >= 0.; 67 | } 68 | 69 | double value; 70 | }; 71 | 72 | MyLowerFilter filter_lower( val ); 73 | MyGreaterEqualFilter filter_greater_equal( val ); 74 | 75 | ROS_INFO_STREAM_FILTER( 76 | &filter_lower, 77 | "My filter INFO stream message; val (" << val << ") < 0" 78 | ); 79 | ROS_INFO_STREAM_FILTER( 80 | &filter_greater_equal, 81 | "My filter INFO stream message; val (" << val << ") >= 0" 82 | ); 83 | 84 | // Once messages: 85 | for( int i = 0; i < 10; ++i ) { 86 | ROS_INFO_STREAM_ONCE( 87 | "My once INFO stream message; i = " << i 88 | ); 89 | } 90 | 91 | // Throttle messages: 92 | for( int i = 0; i < 10; ++i ) { 93 | ROS_INFO_STREAM_THROTTLE( 94 | 2, 95 | "My throttle INFO stream message; i = " << i 96 | ); 97 | ros::Duration( 1 ).sleep(); 98 | } 99 | 100 | ros::spinOnce(); 101 | 102 | return EXIT_SUCCESS; 103 | 104 | } 105 | 106 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/example3.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | int main( int argc, char **argv ) 6 | { 7 | 8 | ros::init( argc, argv, "example3" ); 9 | 10 | ros::NodeHandle n; 11 | 12 | ros::Rate rate( 1 ); 13 | while( ros::ok() ) { 14 | 15 | ROS_DEBUG_STREAM( "DEBUG message." ); 16 | ROS_INFO_STREAM ( "INFO message." ); 17 | ROS_WARN_STREAM ( "WARN message." ); 18 | ROS_ERROR_STREAM( "ERROR message." ); 19 | ROS_FATAL_STREAM( "FATAL message." ); 20 | 21 | ROS_INFO_STREAM_NAMED( "named_msg", "INFO named message." ); 22 | 23 | ROS_INFO_STREAM_THROTTLE( 2, "INFO throttle message." ); 24 | 25 | ros::spinOnce(); 26 | rate.sleep(); 27 | } 28 | 29 | return EXIT_SUCCESS; 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/example4.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | int main( int argc, char **argv ) 11 | { 12 | 13 | ros::init( argc, argv, "example4" ); 14 | 15 | ros::NodeHandle n; 16 | 17 | ros::Publisher pub_temp = n.advertise< std_msgs::Int32 >( "temp", 1000 ); 18 | ros::Publisher pub_accel = n.advertise< geometry_msgs::Vector3 >( "accel", 1000 ); 19 | 20 | ros::ServiceClient srv_speed = n.serviceClient< chapter3_tutorials::SetSpeed>( "speed" ); 21 | 22 | std_msgs::Int32 msg_temp; 23 | geometry_msgs::Vector3 msg_accel; 24 | chapter3_tutorials::SetSpeed msg_speed; 25 | 26 | int i = 0; 27 | 28 | ros::Rate rate( 1 ); 29 | while( ros::ok() ) { 30 | 31 | msg_temp.data = i; 32 | 33 | msg_accel.x = 0.1 * i; 34 | msg_accel.y = 0.2 * i; 35 | msg_accel.z = 0.3 * i; 36 | 37 | msg_speed.request.desired_speed = 0.01 * i; 38 | 39 | pub_temp.publish( msg_temp ); 40 | pub_accel.publish( msg_accel ); 41 | 42 | if( srv_speed.call( msg_speed ) ) 43 | { 44 | ROS_INFO_STREAM( 45 | "SetSpeed response:\n" << 46 | "previous speed = " << msg_speed.response.previous_speed << "\n" << 47 | "new speed = " << msg_speed.response.new_speed << "\n" << 48 | "motor stalled = " << ( msg_speed.response.stalled ? "true" : "false" ) 49 | ); 50 | } 51 | else 52 | { 53 | // Note that this might happen at the beginning, because 54 | // the service server could have not started yet! 55 | ROS_ERROR_STREAM( "Call to speed service failed!" ); 56 | } 57 | 58 | ++i; 59 | 60 | ros::spinOnce(); 61 | rate.sleep(); 62 | } 63 | 64 | return EXIT_SUCCESS; 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/example5.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | float previous_speed = 0.; 11 | float new_speed = 0.; 12 | 13 | void callback_temp( const std_msgs::Int32::ConstPtr& msg ) 14 | { 15 | ROS_INFO_STREAM( "Temp = " << msg->data ); 16 | } 17 | 18 | void callback_accel( const geometry_msgs::Vector3::ConstPtr& msg ) 19 | { 20 | ROS_INFO_STREAM( 21 | "Accel = (" << msg->x << ", " << msg->y << ", " << msg->z << ")" 22 | ); 23 | } 24 | 25 | bool callback_speed( 26 | chapter3_tutorials::SetSpeed::Request &req, 27 | chapter3_tutorials::SetSpeed::Response &res 28 | ) 29 | { 30 | ROS_INFO_STREAM( 31 | "speed service request: desired speed = " << req.desired_speed 32 | ); 33 | 34 | new_speed = 0.9 * req.desired_speed; 35 | 36 | res.previous_speed = previous_speed; 37 | res.new_speed = new_speed; 38 | res.stalled = new_speed < 0.1; 39 | 40 | previous_speed = new_speed; 41 | 42 | return true; 43 | } 44 | 45 | 46 | int main( int argc, char **argv ) 47 | { 48 | 49 | ros::init( argc, argv, "example5" ); 50 | 51 | ros::NodeHandle n; 52 | 53 | ros::Subscriber sub_temp = n.subscribe( "temp", 1000, callback_temp ); 54 | ros::Subscriber sub_accel = n.subscribe( "accel", 1000, callback_accel ); 55 | 56 | ros::ServiceServer srv_speed = n.advertiseService( "speed", callback_speed ); 57 | 58 | while( ros::ok() ) { 59 | ros::spin(); 60 | } 61 | 62 | return EXIT_SUCCESS; 63 | 64 | } 65 | 66 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/example6.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | int main( int argc, char **argv ) 11 | { 12 | 13 | ros::init( argc, argv, "example6" ); 14 | 15 | ros::NodeHandle n; 16 | 17 | // Open camera with CAMERA_INDEX (webcam is typically #0). 18 | const int CAMERA_INDEX = 0; 19 | cv::VideoCapture capture( CAMERA_INDEX ); 20 | if( not capture.isOpened() ) 21 | { 22 | ROS_ERROR_STREAM( 23 | "Failed to open camera with index " << CAMERA_INDEX << "!" 24 | ); 25 | ros::shutdown(); 26 | } 27 | 28 | image_transport::ImageTransport it( n ); 29 | image_transport::Publisher pub_image = it.advertise( "camera", 1 ); 30 | 31 | cv_bridge::CvImagePtr frame = boost::make_shared< cv_bridge::CvImage >(); 32 | frame->encoding = sensor_msgs::image_encodings::BGR8; 33 | 34 | while( ros::ok() ) { 35 | capture >> frame->image; 36 | 37 | if( frame->image.empty() ) 38 | { 39 | ROS_ERROR_STREAM( "Failed to capture frame!" ); 40 | ros::shutdown(); 41 | } 42 | 43 | frame->header.stamp = ros::Time::now(); 44 | pub_image.publish( frame->toImageMsg() ); 45 | 46 | cv::waitKey( 3 ); 47 | 48 | ros::spinOnce(); 49 | } 50 | 51 | capture.release(); 52 | 53 | return EXIT_SUCCESS; 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /chapter3_tutorials/src/example7.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main( int argc, char **argv ) 12 | { 13 | 14 | ros::init( argc, argv, "example7" ); 15 | 16 | ros::NodeHandle n; 17 | 18 | ros::Publisher pub_marker = n.advertise< visualization_msgs::Marker >( "marker", 1000 ); 19 | ros::Publisher pub_pc = n.advertise< sensor_msgs::PointCloud2 >( "pc", 1000 ); 20 | 21 | visualization_msgs::Marker msg_marker; 22 | 23 | msg_marker.header.frame_id = "/frame_marker"; 24 | 25 | msg_marker.ns = "shapes"; 26 | msg_marker.id = 0; 27 | 28 | msg_marker.type = visualization_msgs::Marker::CUBE; 29 | 30 | msg_marker.action = visualization_msgs::Marker::ADD; 31 | 32 | msg_marker.pose.position.x = 0.; 33 | msg_marker.pose.position.y = 1.; 34 | msg_marker.pose.position.z = 2.; 35 | msg_marker.pose.orientation.x = 0.; 36 | msg_marker.pose.orientation.y = 0.; 37 | msg_marker.pose.orientation.z = 0.; 38 | msg_marker.pose.orientation.w = 1.; 39 | 40 | msg_marker.scale.x = 1.; 41 | msg_marker.scale.y = 1.; 42 | msg_marker.scale.z = 1.; 43 | 44 | msg_marker.color.r = 1.; 45 | msg_marker.color.g = 0.; 46 | msg_marker.color.b = 0.; 47 | msg_marker.color.a = 1.; 48 | 49 | msg_marker.lifetime = ros::Duration(); 50 | 51 | ROS_INFO_STREAM( "Initial Marker created." ); 52 | 53 | sensor_msgs::PointCloud2 msg_pc; 54 | 55 | pcl::PointCloud< pcl::PointXYZ > pc; 56 | 57 | pc.width = 200; 58 | pc.height = 100; 59 | pc.is_dense = false; 60 | pc.points.resize( pc.width * pc.height ); 61 | 62 | for( size_t i = 0; i < pc.height; ++i ) { 63 | for( size_t j = 0; j < pc.width; ++j ) { 64 | 65 | const size_t k = pc.width * i + j; 66 | 67 | pc.points[k].x = 0.1 * i; 68 | pc.points[k].y = 0.2 * j; 69 | pc.points[k].z = 1.5; 70 | 71 | } 72 | } 73 | 74 | ROS_INFO_STREAM( "Initial Point Cloud created." ); 75 | 76 | ros::Rate rate( 1 ); 77 | while( ros::ok() ) { 78 | 79 | msg_marker.header.stamp = ros::Time::now(); 80 | 81 | msg_marker.pose.position.x += 0.01; 82 | msg_marker.pose.position.y += 0.02; 83 | msg_marker.pose.position.z += 0.03; 84 | 85 | for( size_t i = 0; i < pc.height; ++i ) { 86 | for( size_t j = 0; j < pc.width; ++j ) { 87 | 88 | const size_t k = pc.width * i + j; 89 | 90 | pc.points[k].z -= 0.1; 91 | 92 | } 93 | } 94 | 95 | pcl::toROSMsg( pc, msg_pc ); 96 | 97 | msg_pc.header.stamp = msg_marker.header.stamp; 98 | msg_pc.header.frame_id = "/frame_pc"; 99 | 100 | pub_marker.publish( msg_marker ); 101 | pub_pc.publish( msg_pc ); 102 | 103 | ros::spinOnce(); 104 | rate.sleep(); 105 | } 106 | 107 | return EXIT_SUCCESS; 108 | 109 | } 110 | 111 | -------------------------------------------------------------------------------- /chapter3_tutorials/srv/SetSpeed.srv: -------------------------------------------------------------------------------- 1 | float32 desired_speed 2 | --- 3 | float32 previous_speed 4 | float32 new_speed 5 | bool stalled 6 | -------------------------------------------------------------------------------- /chapter4_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | #uncomment if you have defined messages 20 | rosbuild_genmsg() 21 | #uncomment if you have defined services 22 | #rosbuild_gensrv() 23 | 24 | #common commands for building c++ executables and libraries 25 | #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) 26 | #target_link_libraries(${PROJECT_NAME} another_library) 27 | #rosbuild_add_boost_directories() 28 | #rosbuild_link_boost(${PROJECT_NAME} thread) 29 | #rosbuild_add_executable(example examples/example.cpp) 30 | #target_link_libraries(example ${PROJECT_NAME}) 31 | rosbuild_add_executable(example1 src/example1.cpp) 32 | rosbuild_add_executable(example2 src/example2.cpp) 33 | rosbuild_add_executable(example3 src/example3.cpp) 34 | rosbuild_add_executable(example4 src/example4.cpp) 35 | rosbuild_add_executable(example6 src/example6.cpp) 36 | rosbuild_add_executable(example8 src/example8.cpp) -------------------------------------------------------------------------------- /chapter4_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter4_tutorials/example2.vcg: -------------------------------------------------------------------------------- 1 | Background\ ColorB=0 2 | Background\ ColorG=0 3 | Background\ ColorR=0 4 | Camera\ Config=0.870398 3.9404 7.08352 -0.127327 -1.63921 -1.14617e-06 5 | Camera\ Type=rviz::XYOrbitViewController 6 | Fixed\ Frame=/laser 7 | Floor\ Scan..AxisColorAutocompute\ Value\ Bounds=1 8 | Floor\ Scan..AxisColorAxis=2 9 | Floor\ Scan..AxisColorMax\ Value=10 10 | Floor\ Scan..AxisColorMin\ Value=-10 11 | Floor\ Scan..AxisColorUse\ Fixed\ Frame=1 12 | Floor\ Scan..FlatColorColorB=1 13 | Floor\ Scan..FlatColorColorG=1 14 | Floor\ Scan..FlatColorColorR=1 15 | Floor\ Scan..IntensityAutocompute\ Intensity\ Bounds=1 16 | Floor\ Scan..IntensityChannel\ Name=intensity 17 | Floor\ Scan..IntensityMax\ ColorB=1 18 | Floor\ Scan..IntensityMax\ ColorG=1 19 | Floor\ Scan..IntensityMax\ ColorR=1 20 | Floor\ Scan..IntensityMax\ Intensity=4096 21 | Floor\ Scan..IntensityMin\ ColorB=0 22 | Floor\ Scan..IntensityMin\ ColorG=0 23 | Floor\ Scan..IntensityMin\ ColorR=0 24 | Floor\ Scan..IntensityMin\ Intensity=0 25 | Floor\ Scan..IntensityUse\ full\ RGB\ spectrum=0 26 | Floor\ Scan.Alpha=1 27 | Floor\ Scan.Billboard\ Size=0.01 28 | Floor\ Scan.Color\ Transformer=Intensity 29 | Floor\ Scan.Decay\ Time=0 30 | Floor\ Scan.Enabled=1 31 | Floor\ Scan.Position\ Transformer=XYZ 32 | Floor\ Scan.Queue\ Size=10 33 | Floor\ Scan.Selectable=1 34 | Floor\ Scan.Style=1 35 | Floor\ Scan.Topic=/scan 36 | Grid.Alpha=0.5 37 | Grid.Cell\ Size=1 38 | Grid.ColorB=0.5 39 | Grid.ColorG=0.5 40 | Grid.ColorR=0.5 41 | Grid.Enabled=1 42 | Grid.Line\ Style=0 43 | Grid.Line\ Width=0.03 44 | Grid.Normal\ Cell\ Count=0 45 | Grid.OffsetX=0 46 | Grid.OffsetY=0 47 | Grid.OffsetZ=0 48 | Grid.Plane=0 49 | Grid.Plane\ Cell\ Count=10 50 | Grid.Reference\ Frame= 51 | LaserScan..AxisColorAutocompute\ Value\ Bounds=1 52 | LaserScan..AxisColorAxis=2 53 | LaserScan..AxisColorMax\ Value=10 54 | LaserScan..AxisColorMin\ Value=-10 55 | LaserScan..AxisColorUse\ Fixed\ Frame=1 56 | LaserScan..FlatColorColorB=0 57 | LaserScan..FlatColorColorG=1 58 | LaserScan..FlatColorColorR=0.333333 59 | LaserScan..IntensityAutocompute\ Intensity\ Bounds=1 60 | LaserScan..IntensityChannel\ Name=intensity 61 | LaserScan..IntensityMax\ ColorB=0 62 | LaserScan..IntensityMax\ ColorG=1 63 | LaserScan..IntensityMax\ ColorR=0.333333 64 | LaserScan..IntensityMax\ Intensity=0 65 | LaserScan..IntensityMin\ ColorB=0 66 | LaserScan..IntensityMin\ ColorG=0 67 | LaserScan..IntensityMin\ ColorR=0 68 | LaserScan..IntensityMin\ Intensity=0 69 | LaserScan..IntensityUse\ full\ RGB\ spectrum=1 70 | LaserScan.Alpha=1 71 | LaserScan.Billboard\ Size=0.01 72 | LaserScan.Color\ Transformer=FlatColor 73 | LaserScan.Decay\ Time=0 74 | LaserScan.Enabled=1 75 | LaserScan.Position\ Transformer=XYZ 76 | LaserScan.Queue\ Size=10 77 | LaserScan.Selectable=1 78 | LaserScan.Style=0 79 | LaserScan.Topic=/scan2 80 | Property\ Grid\ Splitter=294,78 81 | Property\ Grid\ State=expanded=.Global Options,LaserScan.Enabled;splitterratio=0.5 82 | QMainWindow=000000ff00000000fd00000003000000000000011d000001c6fc0200000001fb000000100044006900730070006c0061007900730100000036000001c6000000ee00ffffff0000000100000131000001c6fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000036000000740000006700fffffffb0000000a0056006900650077007301000000b0000000d2000000bb00fffffffb0000001200530065006c0065006300740069006f006e0100000188000000740000006700ffffff00000003000003bf0000003efc0100000001fb0000000800540069006d00650100000000000003bf000002bf00ffffff00000165000001c600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 83 | Target\ Frame=/laser 84 | Tool\ 2D\ Nav\ GoalTopic=goal 85 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 86 | [Display0] 87 | ClassName=rviz::LaserScanDisplay 88 | Name=Floor Scan 89 | [Display1] 90 | ClassName=rviz::GridDisplay 91 | Name=Grid 92 | [Display2] 93 | ClassName=rviz::LaserScanDisplay 94 | Name=LaserScan 95 | [Window] 96 | Height=576 97 | Width=959 98 | X=-1 99 | Y=-28 100 | -------------------------------------------------------------------------------- /chapter4_tutorials/launch/example1.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapter4_tutorials/launch/example2.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /chapter4_tutorials/libraries/ADXL345.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter4_tutorials/libraries/ADXL345.zip -------------------------------------------------------------------------------- /chapter4_tutorials/libraries/Adafruit-BMP085.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter4_tutorials/libraries/Adafruit-BMP085.zip -------------------------------------------------------------------------------- /chapter4_tutorials/libraries/L3G-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter4_tutorials/libraries/L3G-master.zip -------------------------------------------------------------------------------- /chapter4_tutorials/libraries/LoveElectronics_HMC5883L_ArduinoLibrary_V3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter4_tutorials/libraries/LoveElectronics_HMC5883L_ArduinoLibrary_V3.zip -------------------------------------------------------------------------------- /chapter4_tutorials/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b chapter4_tutorials 6 | 7 | 10 | 11 | --> 12 | 13 | 14 | */ 15 | -------------------------------------------------------------------------------- /chapter4_tutorials/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 4 tutorials. 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | class TeleopJoy{ 9 | public: 10 | TeleopJoy(); 11 | private: 12 | void callBack(const sensor_msgs::Joy::ConstPtr& joy); 13 | ros::NodeHandle n; 14 | ros::Publisher pub; 15 | ros::Subscriber sub; 16 | int i_velLinear, i_velAngular; 17 | }; 18 | 19 | TeleopJoy::TeleopJoy() 20 | { 21 | n.param("axis_linear",i_velLinear,i_velLinear); 22 | n.param("axis_angular",i_velAngular,i_velAngular); 23 | 24 | pub = n.advertise("turtle1/command_velocity",1); 25 | sub = n.subscribe("joy", 10, &TeleopJoy::callBack, this); 26 | } 27 | 28 | void TeleopJoy::callBack(const sensor_msgs::Joy::ConstPtr& joy) 29 | { 30 | turtlesim::Velocity vel; 31 | vel.angular = joy->axes[i_velAngular]; 32 | vel.linear = joy->axes[i_velLinear]; 33 | pub.publish(vel); 34 | } 35 | 36 | int main(int argc, char** argv) 37 | { 38 | ros::init(argc, argv, "teleopJoy"); 39 | TeleopJoy teleop_turtle; 40 | 41 | ros::spin(); 42 | } 43 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "std_msgs/String.h" 3 | #include 4 | #include 5 | 6 | 7 | using namespace std; 8 | 9 | class Scan2{ 10 | public: 11 | Scan2(); 12 | private: 13 | ros::NodeHandle n; 14 | ros::Publisher scan_pub; 15 | ros::Subscriber scan_sub; 16 | void scanCallBack(const sensor_msgs::LaserScan::ConstPtr& scan2); 17 | 18 | }; 19 | 20 | 21 | Scan2::Scan2() 22 | { 23 | scan_pub = n.advertise("/scan2",1); 24 | scan_sub = n.subscribe("/scan",1, &Scan2::scanCallBack, this); 25 | } 26 | 27 | void Scan2::scanCallBack(const sensor_msgs::LaserScan::ConstPtr& scan2) 28 | { 29 | int ranges = scan2->ranges.size(); 30 | //populate the LaserScan message 31 | sensor_msgs::LaserScan scan; 32 | scan.header.stamp = scan2->header.stamp; 33 | scan.header.frame_id = scan2->header.frame_id; 34 | scan.angle_min = scan2->angle_min; 35 | scan.angle_max = scan2->angle_max; 36 | scan.angle_increment = scan2->angle_increment; 37 | scan.time_increment = scan2->time_increment; 38 | scan.range_min = 0.0; 39 | scan.range_max = 100.0; 40 | scan.ranges.resize(ranges); 41 | 42 | for(int i = 0; i < ranges; ++i){ 43 | 44 | scan.ranges[i] = scan2->ranges[i] + 1; 45 | } 46 | scan_pub.publish(scan); 47 | } 48 | 49 | int main(int argc, char** argv){ 50 | ros::init(argc, argv, "example2_laser_scan_publisher"); 51 | Scan2 scan2; 52 | ros::spin(); 53 | } 54 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // PCL specific includes 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | ros::Publisher pub; 10 | 11 | void 12 | cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input) 13 | { 14 | // ... do data processing 15 | 16 | sensor_msgs::PointCloud2 output; 17 | 18 | pcl::VoxelGrid sor; 19 | sor.setInputCloud(input); 20 | sor.setLeafSize(0.02f,0.02f,0.02f); 21 | sor.filter(output);; 22 | 23 | // Publish the data 24 | pub.publish (output); 25 | } 26 | 27 | int 28 | main (int argc, char** argv) 29 | { 30 | // Initialize ROS 31 | ros::init (argc, argv, "my_pcl_tutorial"); 32 | ros::NodeHandle nh; 33 | 34 | // Create a ROS subscriber for the input point cloud 35 | ros::Subscriber sub = nh.subscribe ("/camera/depth/points", 1, cloud_cb); 36 | 37 | // Create a ROS publisher for the output point cloud 38 | pub = nh.advertise ("output", 1); 39 | 40 | // Spin 41 | ros::spin (); 42 | } 43 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example4.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | using namespace std; 7 | 8 | class Dynamixel{ 9 | private: 10 | ros::NodeHandle n; 11 | ros::Publisher pub_n; 12 | public: 13 | Dynamixel(); 14 | int moveMotor(double position); 15 | 16 | }; 17 | 18 | 19 | Dynamixel::Dynamixel(){ 20 | pub_n = n.advertise("/tilt_controller/command",1); 21 | 22 | } 23 | 24 | int Dynamixel::moveMotor(double position) 25 | { 26 | std_msgs::Float64 aux; 27 | aux.data = position; 28 | pub_n.publish(aux); 29 | return 1; 30 | } 31 | 32 | 33 | int main(int argc,char** argv) 34 | { 35 | ros::init(argc, argv, "example4_move_motor"); 36 | Dynamixel motors; 37 | 38 | float counter = -180; 39 | ros::Rate loop_rate(100); 40 | while(ros::ok()) 41 | { 42 | if(counter < 180) 43 | { 44 | motors.moveMotor(counter*3.14/180); 45 | counter++; 46 | }else{ 47 | counter = -180; 48 | } 49 | loop_rate.sleep(); 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example5_1/example5_1.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * rosserial Publisher Example 3 | * Prints "hello world!" 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | ros::NodeHandle nh; 10 | 11 | std_msgs::String str_msg; 12 | ros::Publisher chatter("chatter", &str_msg); 13 | 14 | char hello[19] = "chapter4_tutorials"; 15 | 16 | void setup() 17 | { 18 | nh.initNode(); 19 | nh.advertise(chatter); 20 | } 21 | 22 | void loop() 23 | { 24 | str_msg.data = hello; 25 | chatter.publish( &str_msg ); 26 | nh.spinOnce(); 27 | delay(1000); 28 | } 29 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example5_2/example5_2.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * rosserial Subscriber Example 3 | * Blinks an LED on callback 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | ros::NodeHandle nh; 10 | 11 | void messageCb( const std_msgs::Empty& toggle_msg){ 12 | digitalWrite(13, HIGH-digitalRead(13)); // blink the led 13 | } 14 | 15 | ros::Subscriber sub("toggle_led", &messageCb ); 16 | 17 | void setup() 18 | { 19 | pinMode(13, OUTPUT); 20 | nh.initNode(); 21 | nh.subscribe(sub); 22 | } 23 | 24 | void loop() 25 | { 26 | nh.spinOnce(); 27 | delay(1); 28 | } 29 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example6.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | class TeleopImu{ 11 | public: 12 | TeleopImu(); 13 | private: 14 | void callBack(const sensor_msgs::Imu::ConstPtr& imu); 15 | ros::NodeHandle n; 16 | ros::Publisher pub; 17 | ros::Subscriber sub; 18 | }; 19 | 20 | TeleopImu::TeleopImu() 21 | { 22 | pub = n.advertise("turtle1/command_velocity",1); 23 | sub = n.subscribe("imu", 10, &TeleopImu::callBack, this); 24 | } 25 | 26 | void TeleopImu::callBack(const sensor_msgs::Imu::ConstPtr& imu) 27 | { 28 | 29 | turtlesim::Velocity vel; 30 | 31 | 32 | tf::Quaternion bq(imu->orientation.x,imu->orientation.y,imu->orientation.z,imu->orientation.w); 33 | double roll,pitch,yaw; 34 | tf::Matrix3x3(bq).getRPY(roll,pitch,yaw); 35 | 36 | 37 | vel.angular = roll; 38 | vel.linear = pitch; 39 | pub.publish(vel); 40 | 41 | } 42 | 43 | int main(int argc, char** argv) 44 | { 45 | ros::init(argc, argv, "teleopImu"); 46 | TeleopImu teleop_turtle; 47 | 48 | ros::spin(); 49 | } 50 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example7/example7.ino: -------------------------------------------------------------------------------- 1 | #include 2 | // message type to publish 3 | #include 4 | 5 | // libraries for the accelerometer 6 | #include 7 | #include 8 | 9 | ADXL345 Accel; 10 | 11 | ros::NodeHandle nh; 12 | std_msgs::Float32 velLinear_x; 13 | std_msgs::Float32 velAngular_z; 14 | 15 | ros::Publisher velLinear_x_pub("velLinear_x", &velLinear_x); 16 | ros::Publisher velAngular_z_pub("velAngular_z", &velAngular_z); 17 | 18 | void setup(){ 19 | 20 | nh.initNode(); 21 | nh.advertise(velLinear_x_pub); 22 | nh.advertise(velAngular_z_pub); 23 | 24 | Wire.begin(); 25 | delay(100); 26 | Accel.set_bw(ADXL345_BW_12); 27 | 28 | } 29 | 30 | void loop(){ 31 | 32 | double acc_data[3]; 33 | Accel.get_Gxyz(acc_data); 34 | 35 | velLinear_x.data = acc_data[0]; 36 | velAngular_z.data = acc_data[1]; 37 | 38 | velLinear_x_pub.publish(&velLinear_x); 39 | velAngular_z_pub.publish(&velAngular_z); 40 | 41 | nh.spinOnce(); 42 | delay(10); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /chapter4_tutorials/src/example8.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | class TeleopImu{ 6 | public: 7 | TeleopImu(); 8 | private: 9 | void velLinearCallBack(const std_msgs::Float32::ConstPtr& vx); 10 | void velAngularCallBack(const std_msgs::Float32::ConstPtr& wz); 11 | ros::NodeHandle n; 12 | ros::Publisher pub; 13 | ros::Subscriber velAngular_z_sub; 14 | ros::Subscriber velLinear_x_sub; 15 | turtlesim::Velocity vel; 16 | 17 | }; 18 | 19 | TeleopImu::TeleopImu() 20 | { 21 | pub = n.advertise("turtle1/command_velocity",1); 22 | 23 | velLinear_x_sub = n.subscribe("/velLinear_x", 1, &TeleopImu::velLinearCallBack, this); 24 | velAngular_z_sub = n.subscribe("/velAngular_z", 1, &TeleopImu::velAngularCallBack, this); 25 | } 26 | 27 | 28 | void TeleopImu::velAngularCallBack(const std_msgs::Float32::ConstPtr& wz){ 29 | vel.linear = -1 * wz->data; 30 | pub.publish(vel); 31 | } 32 | 33 | void TeleopImu::velLinearCallBack(const std_msgs::Float32::ConstPtr& vx){ 34 | vel.angular = vx->data; 35 | pub.publish(vel); 36 | } 37 | 38 | int main(int argc, char** argv) 39 | { 40 | ros::init(argc, argv, "example8"); 41 | TeleopImu teleop_turtle; 42 | 43 | ros::spin(); 44 | } 45 | -------------------------------------------------------------------------------- /chapter5_tutorials/.bot_body1.dae.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter5_tutorials/.bot_body1.dae.swp -------------------------------------------------------------------------------- /chapter5_tutorials/.bot_body2.dae.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter5_tutorials/.bot_body2.dae.swp -------------------------------------------------------------------------------- /chapter5_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | #uncomment if you have defined messages 20 | #rosbuild_genmsg() 21 | #uncomment if you have defined services 22 | #rosbuild_gensrv() 23 | 24 | #common commands for building c++ executables and libraries 25 | #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) 26 | #target_link_libraries(${PROJECT_NAME} another_library) 27 | #rosbuild_add_boost_directories() 28 | #rosbuild_link_boost(${PROJECT_NAME} thread) 29 | #rosbuild_add_executable(example examples/example.cpp) 30 | #target_link_libraries(example ${PROJECT_NAME}) 31 | 32 | rosbuild_add_executable(state_publisher src/state_publisher.cpp) 33 | 34 | -------------------------------------------------------------------------------- /chapter5_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter5_tutorials/launch/display.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /chapter5_tutorials/launch/display_xacro.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /chapter5_tutorials/launch/gazebo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /chapter5_tutorials/launch/gazebo_map_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /chapter5_tutorials/launch/state.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /chapter5_tutorials/launch/state_xacro.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /chapter5_tutorials/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b urdf_tutorial is ... 6 | 7 | 10 | 11 | 12 | \section codeapi Code API 13 | 14 | 24 | 25 | 26 | */ 27 | -------------------------------------------------------------------------------- /chapter5_tutorials/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 5 tutorials. 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /chapter5_tutorials/src/state_publisher.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char** argv) { 7 | ros::init(argc, argv, "state_publisher"); 8 | ros::NodeHandle n; 9 | ros::Publisher joint_pub = n.advertise("joint_states", 1); 10 | tf::TransformBroadcaster broadcaster; 11 | ros::Rate loop_rate(30); 12 | 13 | const double degree = M_PI/180; 14 | 15 | // robot state 16 | double inc= 0.005, base_arm_inc= 0.005, arm1_armbase_inc= 0.005, arm2_arm1_inc= 0.005, gripper_inc= 0.005, tip_inc= 0.005; 17 | double angle= 0 ,base_arm = 0, arm1_armbase = 0, arm2_arm1 = 0, gripper = 0, tip = 0; 18 | // message declarations 19 | geometry_msgs::TransformStamped odom_trans; 20 | sensor_msgs::JointState joint_state; 21 | odom_trans.header.frame_id = "odom"; 22 | odom_trans.child_frame_id = "base_link"; 23 | 24 | while (ros::ok()) { 25 | //update joint_state 26 | joint_state.header.stamp = ros::Time::now(); 27 | joint_state.name.resize(11); 28 | joint_state.position.resize(11); 29 | joint_state.name[0] ="base_to_arm_base"; 30 | joint_state.position[0] = base_arm; 31 | joint_state.name[1] ="arm_1_to_arm_base"; 32 | joint_state.position[1] = arm1_armbase; 33 | joint_state.name[2] ="arm_2_to_arm_1"; 34 | joint_state.position[2] = arm2_arm1; 35 | joint_state.name[3] ="left_gripper_joint"; 36 | joint_state.position[3] = gripper; 37 | joint_state.name[4] ="left_tip_joint"; 38 | joint_state.position[4] = tip; 39 | joint_state.name[5] ="right_gripper_joint"; 40 | joint_state.position[5] = gripper; 41 | joint_state.name[6] ="right_tip_joint"; 42 | joint_state.position[6] = tip; 43 | joint_state.name[7] ="base_to_wheel1"; 44 | joint_state.position[7] = 0; 45 | joint_state.name[8] ="base_to_wheel2"; 46 | joint_state.position[8] = 0; 47 | joint_state.name[9] ="base_to_wheel3"; 48 | joint_state.position[9] = 0; 49 | joint_state.name[10] ="base_to_wheel4"; 50 | joint_state.position[10] = 0; 51 | 52 | 53 | 54 | 55 | 56 | 57 | // update transform 58 | // (moving in a circle with radius) 59 | odom_trans.header.stamp = ros::Time::now(); 60 | odom_trans.transform.translation.x = cos(angle); 61 | odom_trans.transform.translation.y = sin(angle); 62 | odom_trans.transform.translation.z = 0.0; 63 | odom_trans.transform.rotation = tf::createQuaternionMsgFromYaw(angle); 64 | 65 | //send the joint state and transform 66 | joint_pub.publish(joint_state); 67 | broadcaster.sendTransform(odom_trans); 68 | 69 | 70 | // Create new robot state 71 | arm2_arm1 += arm2_arm1_inc; 72 | if (arm2_arm1<-1.5 || arm2_arm1>1.5) arm2_arm1_inc *= -1; 73 | arm1_armbase += arm1_armbase_inc; 74 | if (arm1_armbase>1.2 || arm1_armbase<-1.0) arm1_armbase_inc *= -1; 75 | base_arm += base_arm_inc; 76 | if (base_arm>1. || base_arm<-1.0) base_arm_inc *= -1; 77 | gripper += gripper_inc; 78 | if (gripper<0 || gripper>1) gripper_inc *= -1; 79 | 80 | angle += degree/4; 81 | 82 | // This will adjust as needed per iteration 83 | loop_rate.sleep(); 84 | } 85 | 86 | 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /chapter5_tutorials/urdf/dae.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter5_tutorials/urdf/robot1_arm.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | -------------------------------------------------------------------------------- /chapter5_tutorials/urdf/robot1_base_01.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Gazebo/Green 33 | false 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /chapter5_tutorials/urdf/robot1_base_02.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Gazebo/Green 33 | false 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | Erratic/BlueBrushedAluminum 168 | 169 | 170 | 171 | Erratic/Black 172 | 173 | 174 | 175 | Erratic/Black 176 | 177 | 178 | 179 | Erratic/Black 180 | 181 | 182 | 183 | Erratic/Black 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /chapter5_tutorials/urdf/robot1_base_03.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Gazebo/Green 40 | false 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | Erratic/BlueBrushedAluminum 175 | 176 | 177 | 178 | Erratic/Black 179 | 180 | 181 | 182 | Erratic/Black 183 | 184 | 185 | 186 | Erratic/Black 187 | 188 | 189 | 190 | Erratic/Black 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /chapter6_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | # auto-generated dynamic reconfiguration GUI 20 | rosbuild_find_ros_package(dynamic_reconfigure) 21 | include(${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake) 22 | gencfg() 23 | 24 | #uncomment if you have defined messages 25 | #rosbuild_genmsg() 26 | #uncomment if you have defined services 27 | #rosbuild_gensrv() 28 | 29 | rosbuild_add_executable(camera src/camera.cpp) 30 | rosbuild_add_executable(camera_timer src/camera_timer.cpp) 31 | rosbuild_add_executable(camera_polling src/camera_polling.cpp) 32 | 33 | rosbuild_add_executable(camera_stereo src/camera_stereo.cpp) 34 | 35 | -------------------------------------------------------------------------------- /chapter6_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter6_tutorials/bag/viso2_demo/download_amphoras_pool_bag_files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | wget --mirror ftp://opt.uib.es/bagfiles/viso2_ros 4 | 5 | -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/camera/calibration_webcam.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: webcam 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [628.605769204058, 0, 330.525636957696, 0, 626.873332341329, 252.463246920169, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [-0.0709132085265088, 0.102063002021842, -0.00113116095948083, -3.15823206599607e-05, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [620.937438964844, 0, 329.896849376601, 0, 0, 620.437438964844, 251.769990192599, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/camera/calibrationdata.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter6_tutorials/calibration/camera/calibrationdata.tar.gz -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/camera/cameracheck-stdout.log: -------------------------------------------------------------------------------- 1 | no chessboard 2 | no chessboard 3 | no chessboard 4 | no chessboard 5 | no chessboard 6 | Linearity RMS Error: 1.319 Pixels Reprojection RMS Error: 1.278 Pixels 7 | Linearity RMS Error: 1.542 Pixels Reprojection RMS Error: 1.368 Pixels 8 | Linearity RMS Error: 1.437 Pixels Reprojection RMS Error: 1.112 Pixels 9 | Linearity RMS Error: 1.455 Pixels Reprojection RMS Error: 1.035 Pixels 10 | Linearity RMS Error: 2.210 Pixels Reprojection RMS Error: 1.584 Pixels 11 | Linearity RMS Error: 2.604 Pixels Reprojection RMS Error: 2.286 Pixels 12 | Linearity RMS Error: 0.611 Pixels Reprojection RMS Error: 0.349 Pixels 13 | Linearity RMS Error: 0.569 Pixels Reprojection RMS Error: 0.357 Pixels 14 | Linearity RMS Error: 0.559 Pixels Reprojection RMS Error: 0.354 Pixels 15 | Linearity RMS Error: 0.586 Pixels Reprojection RMS Error: 0.322 Pixels 16 | Linearity RMS Error: 0.620 Pixels Reprojection RMS Error: 0.324 Pixels 17 | Linearity RMS Error: 0.624 Pixels Reprojection RMS Error: 0.345 Pixels 18 | Linearity RMS Error: 0.664 Pixels Reprojection RMS Error: 0.357 Pixels 19 | Linearity RMS Error: 0.676 Pixels Reprojection RMS Error: 0.374 Pixels 20 | Linearity RMS Error: 0.684 Pixels Reprojection RMS Error: 0.363 Pixels 21 | Linearity RMS Error: 0.683 Pixels Reprojection RMS Error: 0.363 Pixels 22 | Linearity RMS Error: 0.728 Pixels Reprojection RMS Error: 0.386 Pixels 23 | Linearity RMS Error: 0.684 Pixels Reprojection RMS Error: 0.385 Pixels 24 | Linearity RMS Error: 0.744 Pixels Reprojection RMS Error: 0.398 Pixels 25 | Linearity RMS Error: 0.772 Pixels Reprojection RMS Error: 0.413 Pixels 26 | Linearity RMS Error: 0.732 Pixels Reprojection RMS Error: 0.410 Pixels 27 | Linearity RMS Error: 0.708 Pixels Reprojection RMS Error: 0.412 Pixels 28 | Linearity RMS Error: 0.666 Pixels Reprojection RMS Error: 0.399 Pixels 29 | Linearity RMS Error: 0.723 Pixels Reprojection RMS Error: 0.401 Pixels 30 | Linearity RMS Error: 0.516 Pixels Reprojection RMS Error: 0.308 Pixels 31 | Linearity RMS Error: 0.553 Pixels Reprojection RMS Error: 0.349 Pixels 32 | no chessboard 33 | no chessboard 34 | Linearity RMS Error: 0.484 Pixels Reprojection RMS Error: 0.445 Pixels 35 | Linearity RMS Error: 0.434 Pixels Reprojection RMS Error: 0.383 Pixels 36 | Linearity RMS Error: 0.438 Pixels Reprojection RMS Error: 0.391 Pixels 37 | Linearity RMS Error: 0.421 Pixels Reprojection RMS Error: 0.428 Pixels 38 | Linearity RMS Error: 0.424 Pixels Reprojection RMS Error: 0.428 Pixels 39 | Linearity RMS Error: 0.448 Pixels Reprojection RMS Error: 0.428 Pixels 40 | Linearity RMS Error: 0.386 Pixels Reprojection RMS Error: 0.382 Pixels 41 | Linearity RMS Error: 0.393 Pixels Reprojection RMS Error: 0.376 Pixels 42 | Linearity RMS Error: 0.372 Pixels Reprojection RMS Error: 0.399 Pixels 43 | Linearity RMS Error: 0.377 Pixels Reprojection RMS Error: 0.365 Pixels 44 | Linearity RMS Error: 0.341 Pixels Reprojection RMS Error: 0.324 Pixels 45 | Linearity RMS Error: 0.225 Pixels Reprojection RMS Error: 0.314 Pixels 46 | Linearity RMS Error: 0.266 Pixels Reprojection RMS Error: 0.318 Pixels 47 | Linearity RMS Error: 0.234 Pixels Reprojection RMS Error: 0.283 Pixels 48 | Linearity RMS Error: 0.231 Pixels Reprojection RMS Error: 0.279 Pixels 49 | Linearity RMS Error: 0.256 Pixels Reprojection RMS Error: 0.292 Pixels 50 | Linearity RMS Error: 0.222 Pixels Reprojection RMS Error: 0.305 Pixels 51 | Linearity RMS Error: 0.211 Pixels Reprojection RMS Error: 0.342 Pixels 52 | Linearity RMS Error: 0.256 Pixels Reprojection RMS Error: 0.411 Pixels 53 | Linearity RMS Error: 0.222 Pixels Reprojection RMS Error: 0.473 Pixels 54 | Linearity RMS Error: 0.200 Pixels Reprojection RMS Error: 0.448 Pixels 55 | Linearity RMS Error: 0.281 Pixels Reprojection RMS Error: 0.420 Pixels 56 | Linearity RMS Error: 0.267 Pixels Reprojection RMS Error: 0.404 Pixels 57 | Linearity RMS Error: 0.302 Pixels Reprojection RMS Error: 0.391 Pixels 58 | Linearity RMS Error: 0.280 Pixels Reprojection RMS Error: 0.345 Pixels 59 | Linearity RMS Error: 0.285 Pixels Reprojection RMS Error: 0.380 Pixels 60 | Linearity RMS Error: 0.355 Pixels Reprojection RMS Error: 0.405 Pixels 61 | Linearity RMS Error: 0.352 Pixels Reprojection RMS Error: 0.449 Pixels 62 | Linearity RMS Error: 0.414 Pixels Reprojection RMS Error: 0.480 Pixels 63 | Linearity RMS Error: 0.459 Pixels Reprojection RMS Error: 0.544 Pixels 64 | Linearity RMS Error: 0.457 Pixels Reprojection RMS Error: 0.605 Pixels 65 | Linearity RMS Error: 0.505 Pixels Reprojection RMS Error: 0.667 Pixels 66 | Linearity RMS Error: 0.495 Pixels Reprojection RMS Error: 0.671 Pixels 67 | Linearity RMS Error: 0.553 Pixels Reprojection RMS Error: 0.699 Pixels 68 | Linearity RMS Error: 0.577 Pixels Reprojection RMS Error: 0.691 Pixels 69 | Linearity RMS Error: 0.497 Pixels Reprojection RMS Error: 0.698 Pixels 70 | Linearity RMS Error: 0.500 Pixels Reprojection RMS Error: 0.690 Pixels 71 | Linearity RMS Error: 0.473 Pixels Reprojection RMS Error: 0.699 Pixels 72 | Linearity RMS Error: 0.546 Pixels Reprojection RMS Error: 0.700 Pixels 73 | Linearity RMS Error: 0.592 Pixels Reprojection RMS Error: 0.698 Pixels 74 | Linearity RMS Error: 0.520 Pixels Reprojection RMS Error: 0.677 Pixels 75 | Linearity RMS Error: 0.462 Pixels Reprojection RMS Error: 0.688 Pixels 76 | Linearity RMS Error: 0.556 Pixels Reprojection RMS Error: 0.683 Pixels 77 | Linearity RMS Error: 0.509 Pixels Reprojection RMS Error: 0.690 Pixels 78 | Linearity RMS Error: 0.519 Pixels Reprojection RMS Error: 0.690 Pixels 79 | Linearity RMS Error: 0.550 Pixels Reprojection RMS Error: 0.748 Pixels 80 | Linearity RMS Error: 0.601 Pixels Reprojection RMS Error: 0.710 Pixels 81 | 82 | -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/camera_stereo/calibrationdata.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter6_tutorials/calibration/camera_stereo/calibrationdata.tar.gz -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/camera_stereo/logitech_c120_left.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: logitech_c120_left 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [733.331336778539, 0, 311.622739302916, 0, 727.330202909555, 247.044686047471, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.119707170953865, -0.395781484171961, -0.00587813422000847, -0.0071214094185699, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [0.923889231977271, 0.0195266220698682, 0.382161481663168, -0.0234502371507184, 0.999709256785772, 0.0056114413847382, -0.381940798310449, -0.0141461276461025, 0.924078521370666] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [829.254367168777, 0, -29.7742435187101, 0, 0, 829.254367168777, 242.694038391113, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/camera_stereo/logitech_c120_right.yaml: -------------------------------------------------------------------------------- 1 | image_width: 640 2 | image_height: 480 3 | camera_name: logitech_c120_right 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [679.286769973595, 0, 305.814258310302, 0, 676.053001508839, 237.207871324979, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [0.0726799499851729, -0.277321135716807, -0.000299382652772575, -0.00606495985473834, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [0.937533880069875, -0.00257696349242685, 0.347884439117767, 0.00613686027063614, 0.999939475491544, -0.0091315004087395, -0.347839852039905, 0.0106960092022596, 0.937492950757499] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [829.254367168777, 0, -29.7742435187101, -109.679272423374, 0, 829.254367168777, 242.694038391113, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/firewire_camera/calibration_firewire_camera.yaml: -------------------------------------------------------------------------------- 1 | image_width: 1384 2 | image_height: 1036 3 | camera_name: 00b09d0100ab1324 4 | camera_matrix: 5 | rows: 3 6 | cols: 3 7 | data: [694.903357008225, 0, 689.847393876007, 0, 694.078783236935, 457.826372638728, 0, 0, 1] 8 | distortion_model: plumb_bob 9 | distortion_coefficients: 10 | rows: 1 11 | cols: 5 12 | data: [-0.293214939314933, 0.0564190484836527, 0.00539031080079255, -0.000911555139287203, 0] 13 | rectification_matrix: 14 | rows: 3 15 | cols: 3 16 | data: [1, 0, 0, 0, 1, 0, 0, 0, 1] 17 | projection_matrix: 18 | rows: 3 19 | cols: 4 20 | data: [470.999450683594, 0, 690.323303014738, 0, 0, 536.534484863281, 430.407110685832, 0, 0, 0, 1, 0] -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/firewire_camera/calibrationdata.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter6_tutorials/calibration/firewire_camera/calibrationdata.tar.gz -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/firewire_camera/cameracalibrator-4-stdout.log: -------------------------------------------------------------------------------- 1 | Waiting for service /camera/set_camera_info ... 2 | OK 3 | *** Added sample 1, p_x = 0.564, p_y = 0.303, p_size = 0.128, skew = 0.194 4 | *** Added sample 2, p_x = 0.434, p_y = 0.278, p_size = 0.167, skew = 0.088 5 | *** Added sample 3, p_x = 0.409, p_y = 0.403, p_size = 0.206, skew = 0.154 6 | *** Added sample 4, p_x = 0.382, p_y = 0.399, p_size = 0.232, skew = 0.003 7 | *** Added sample 5, p_x = 0.393, p_y = 0.209, p_size = 0.216, skew = 0.006 8 | *** Added sample 6, p_x = 0.401, p_y = 0.033, p_size = 0.176, skew = 0.083 9 | *** Added sample 7, p_x = 0.355, p_y = 0.009, p_size = 0.168, skew = 0.336 10 | *** Added sample 8, p_x = 0.094, p_y = 0.152, p_size = 0.151, skew = 1.000 11 | *** Added sample 9, p_x = 0.108, p_y = 0.175, p_size = 0.155, skew = 0.716 12 | *** Added sample 10, p_x = 0.113, p_y = 0.134, p_size = 0.160, skew = 0.430 13 | *** Added sample 11, p_x = 0.594, p_y = 0.045, p_size = 0.189, skew = 0.468 14 | *** Added sample 12, p_x = 0.711, p_y = 0.045, p_size = 0.174, skew = 0.688 15 | *** Added sample 13, p_x = 0.752, p_y = 0.015, p_size = 0.164, skew = 0.810 16 | *** Added sample 14, p_x = 0.819, p_y = 0.092, p_size = 0.204, skew = 0.707 17 | *** Added sample 15, p_x = 0.758, p_y = 0.190, p_size = 0.254, skew = 0.564 18 | *** Added sample 16, p_x = 0.629, p_y = 0.290, p_size = 0.338, skew = 0.434 19 | *** Added sample 17, p_x = 0.557, p_y = 0.304, p_size = 0.365, skew = 0.323 20 | *** Added sample 18, p_x = 0.464, p_y = 0.358, p_size = 0.363, skew = 0.128 21 | *** Added sample 19, p_x = 0.418, p_y = 0.990, p_size = 0.222, skew = 0.136 22 | *** Added sample 20, p_x = 0.403, p_y = 0.889, p_size = 0.263, skew = 0.057 23 | *** Added sample 21, p_x = 0.437, p_y = 0.744, p_size = 0.310, skew = 0.086 24 | *** Added sample 22, p_x = 0.442, p_y = 0.559, p_size = 0.337, skew = 0.035 25 | *** Added sample 23, p_x = 0.504, p_y = 0.482, p_size = 0.300, skew = 0.095 26 | *** Added sample 24, p_x = 0.295, p_y = 0.511, p_size = 0.284, skew = 0.061 27 | *** Added sample 25, p_x = 0.198, p_y = 0.490, p_size = 0.256, skew = 0.129 28 | *** Added sample 26, p_x = 0.133, p_y = 0.471, p_size = 0.225, skew = 0.220 29 | *** Added sample 27, p_x = 0.063, p_y = 0.440, p_size = 0.187, skew = 0.430 30 | *** Added sample 28, p_x = 0.007, p_y = 0.433, p_size = 0.165, skew = 0.298 31 | *** Added sample 29, p_x = 0.610, p_y = 0.341, p_size = 0.230, skew = 0.179 32 | *** Added sample 30, p_x = 0.782, p_y = 0.342, p_size = 0.198, skew = 0.282 33 | *** Added sample 31, p_x = 0.867, p_y = 0.351, p_size = 0.195, skew = 0.171 34 | *** Added sample 32, p_x = 0.925, p_y = 0.309, p_size = 0.213, skew = 0.262 35 | *** Added sample 33, p_x = 0.915, p_y = 0.227, p_size = 0.207, skew = 0.391 36 | *** Added sample 34, p_x = 0.898, p_y = 0.150, p_size = 0.198, skew = 0.494 37 | *** Added sample 35, p_x = 0.923, p_y = 0.433, p_size = 0.224, skew = 0.070 38 | *** Added sample 36, p_x = 0.870, p_y = 0.526, p_size = 0.241, skew = 0.017 39 | *** Added sample 37, p_x = 0.719, p_y = 0.488, p_size = 0.280, skew = 0.114 40 | *** Added sample 38, p_x = 0.506, p_y = 0.242, p_size = 0.414, skew = 0.149 41 | *** Added sample 39, p_x = 0.523, p_y = 0.323, p_size = 0.471, skew = 0.079 42 | *** Added sample 40, p_x = 0.574, p_y = 0.308, p_size = 0.513, skew = 0.172 43 | *** Added sample 41, p_x = 0.573, p_y = 0.396, p_size = 0.415, skew = 0.105 44 | *** Added sample 42, p_x = 0.521, p_y = 0.409, p_size = 0.156, skew = 0.097 45 | *** Added sample 43, p_x = 0.550, p_y = 0.344, p_size = 0.279, skew = 0.067 46 | *** Added sample 44, p_x = 0.543, p_y = 0.186, p_size = 0.353, skew = 0.384 47 | *** Added sample 45, p_x = 0.504, p_y = 0.132, p_size = 0.423, skew = 0.303 48 | *** Added sample 46, p_x = 0.420, p_y = 0.111, p_size = 0.458, skew = 0.176 49 | *** Added sample 47, p_x = 0.344, p_y = 0.362, p_size = 0.421, skew = 0.086 50 | *** Added sample 48, p_x = 0.387, p_y = 0.435, p_size = 0.384, skew = 0.034 51 | *** Added sample 49, p_x = 0.339, p_y = 0.302, p_size = 0.313, skew = 0.116 52 | *** Added sample 50, p_x = 0.269, p_y = 0.314, p_size = 0.268, skew = 0.267 53 | *** Added sample 51, p_x = 0.210, p_y = 0.292, p_size = 0.366, skew = 0.192 54 | *** Added sample 52, p_x = 0.161, p_y = 0.328, p_size = 0.317, skew = 0.345 55 | *** Added sample 53, p_x = 0.325, p_y = 0.411, p_size = 0.372, skew = 0.175 56 | # oST version 5.0 parameters 57 | 58 | 59 | [image] 60 | 61 | width 62 | 1384 63 | 64 | height 65 | 1036 66 | 67 | [narrow_stereo/left] 68 | 69 | camera matrix 70 | 694.903357 0.000000 689.847394 71 | 0.000000 694.078783 457.826373 72 | 0.000000 0.000000 1.000000 73 | 74 | distortion 75 | -0.293215 0.056419 0.005390 -0.000912 0.000000 76 | 77 | rectification 78 | 1.000000 0.000000 0.000000 79 | 0.000000 1.000000 0.000000 80 | 0.000000 0.000000 1.000000 81 | 82 | projection 83 | 470.999451 0.000000 690.323303 0.000000 84 | 0.000000 536.534485 430.407111 0.000000 85 | 0.000000 0.000000 1.000000 0.000000 86 | 87 | 88 | Wrote calibration data to /tmp/calibrationdata.tar.gz 89 | D = [-0.2932149393149332, 0.056419048483652715, 0.00539031080079255, -0.000911555139287203, 0.0] 90 | K = [694.9033570082253, 0.0, 689.8473938760071, 0.0, 694.0787832369349, 457.82637263872783, 0.0, 0.0, 1.0] 91 | R = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] 92 | P = [470.99945068359375, 0.0, 690.3233030147385, 0.0, 0.0, 536.5344848632812, 430.40711068583187, 0.0, 0.0, 0.0, 1.0, 0.0] 93 | # oST version 5.0 parameters 94 | 95 | 96 | [image] 97 | 98 | width 99 | 1384 100 | 101 | height 102 | 1036 103 | 104 | [narrow_stereo/left] 105 | 106 | camera matrix 107 | 694.903357 0.000000 689.847394 108 | 0.000000 694.078783 457.826373 109 | 0.000000 0.000000 1.000000 110 | 111 | distortion 112 | -0.293215 0.056419 0.005390 -0.000912 0.000000 113 | 114 | rectification 115 | 1.000000 0.000000 0.000000 116 | 0.000000 1.000000 0.000000 117 | 0.000000 0.000000 1.000000 118 | 119 | projection 120 | 470.999451 0.000000 690.323303 0.000000 121 | 0.000000 536.534485 430.407111 0.000000 122 | 0.000000 0.000000 1.000000 0.000000 123 | 124 | 125 | -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/gscam/calibration_gscam.yaml: -------------------------------------------------------------------------------- 1 | # Camera intrinsics 2 | 3 | [image] 4 | 5 | width 6 | 640 7 | 8 | height 9 | 480 10 | 11 | [default] 12 | 13 | camera matrix 14 | 655.18131 0.00000 333.36765 15 | 0.00000 653.04438 228.90739 16 | 0.00000 0.00000 1.00000 17 | 18 | distortion 19 | 0.11287 -0.22707 -0.00083 0.00298 0.00000 20 | 21 | 22 | rectification 23 | 1.00000 0.00000 0.00000 24 | 0.00000 1.00000 0.00000 25 | 0.00000 0.00000 1.00000 26 | 27 | projection 28 | 663.30322 0.00000 334.29676 0.00000 29 | 0.00000 662.06476 228.15963 0.00000 30 | 0.00000 0.00000 1.00000 0.00000 31 | -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/gscam/calibrationdata.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter6_tutorials/calibration/gscam/calibrationdata.tar.gz -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/gscam/stdout.log: -------------------------------------------------------------------------------- 1 | Waiting for service /gscam/set_camera_info ... 2 | OK 3 | *** Added sample 1, p_x = 0.233, p_y = 0.771, p_size = 0.328, skew = 0.076 4 | *** Added sample 2, p_x = 0.207, p_y = 0.722, p_size = 0.375, skew = 0.353 5 | *** Added sample 3, p_x = 0.497, p_y = 0.392, p_size = 0.500, skew = 0.010 6 | *** Added sample 4, p_x = 0.329, p_y = 0.307, p_size = 0.492, skew = 0.000 7 | *** Added sample 5, p_x = 0.290, p_y = 0.207, p_size = 0.538, skew = 0.028 8 | *** Added sample 6, p_x = 0.259, p_y = 0.315, p_size = 0.590, skew = 0.041 9 | *** Added sample 7, p_x = 0.194, p_y = 0.000, p_size = 0.550, skew = 0.018 10 | *** Added sample 8, p_x = 0.841, p_y = 0.471, p_size = 0.468, skew = 0.118 11 | *** Added sample 9, p_x = 0.636, p_y = 0.489, p_size = 0.462, skew = 0.157 12 | *** Added sample 10, p_x = 0.282, p_y = 0.181, p_size = 0.638, skew = 0.236 13 | *** Added sample 11, p_x = 0.305, p_y = 0.539, p_size = 0.681, skew = 0.281 14 | *** Added sample 12, p_x = 0.501, p_y = 0.608, p_size = 0.585, skew = 0.217 15 | *** Added sample 13, p_x = 0.503, p_y = 0.389, p_size = 0.569, skew = 0.223 16 | *** Added sample 14, p_x = 0.522, p_y = 0.161, p_size = 0.551, skew = 0.221 17 | *** Added sample 15, p_x = 0.528, p_y = 0.298, p_size = 0.549, skew = 0.144 18 | *** Added sample 16, p_x = 0.394, p_y = 0.839, p_size = 0.470, skew = 0.110 19 | *** Added sample 17, p_x = 0.441, p_y = 0.869, p_size = 0.373, skew = 0.081 20 | *** Added sample 18, p_x = 0.458, p_y = 0.831, p_size = 0.252, skew = 0.105 21 | *** Added sample 19, p_x = 0.397, p_y = 0.802, p_size = 0.196, skew = 0.164 22 | *** Added sample 20, p_x = 0.324, p_y = 0.755, p_size = 0.246, skew = 0.123 23 | *** Added sample 21, p_x = 0.306, p_y = 0.649, p_size = 0.310, skew = 0.087 24 | *** Added sample 22, p_x = 0.281, p_y = 0.598, p_size = 0.355, skew = 0.001 25 | *** Added sample 23, p_x = 0.239, p_y = 0.542, p_size = 0.394, skew = 0.126 26 | *** Added sample 24, p_x = 0.334, p_y = 0.390, p_size = 0.565, skew = 0.134 27 | *** Added sample 25, p_x = 0.362, p_y = 0.527, p_size = 0.593, skew = 0.111 28 | *** Added sample 26, p_x = 0.418, p_y = 0.683, p_size = 0.595, skew = 0.122 29 | *** Added sample 27, p_x = 0.533, p_y = 0.769, p_size = 0.617, skew = 0.118 30 | *** Added sample 28, p_x = 0.483, p_y = 0.733, p_size = 0.664, skew = 0.034 31 | *** Added sample 29, p_x = 0.469, p_y = 0.596, p_size = 0.636, skew = 0.100 32 | *** Added sample 30, p_x = 0.463, p_y = 0.392, p_size = 0.641, skew = 0.068 33 | *** Added sample 31, p_x = 0.474, p_y = 0.155, p_size = 0.658, skew = 0.048 34 | *** Added sample 32, p_x = 0.464, p_y = 0.000, p_size = 0.695, skew = 0.006 35 | *** Added sample 33, p_x = 0.383, p_y = 0.056, p_size = 0.727, skew = 0.065 36 | *** Added sample 34, p_x = 0.545, p_y = 0.721, p_size = 0.267, skew = 0.154 37 | *** Added sample 35, p_x = 0.678, p_y = 0.689, p_size = 0.276, skew = 0.188 38 | *** Added sample 36, p_x = 0.819, p_y = 0.648, p_size = 0.284, skew = 0.224 39 | *** Added sample 37, p_x = 0.922, p_y = 0.573, p_size = 0.281, skew = 0.253 40 | *** Added sample 38, p_x = 0.890, p_y = 0.500, p_size = 0.287, skew = 0.160 41 | *** Added sample 39, p_x = 0.801, p_y = 0.504, p_size = 0.280, skew = 0.013 42 | *** Added sample 40, p_x = 0.718, p_y = 0.466, p_size = 0.269, skew = 0.116 43 | *** Added sample 41, p_x = 0.638, p_y = 0.440, p_size = 0.255, skew = 0.246 44 | *** Added sample 42, p_x = 0.567, p_y = 0.354, p_size = 0.269, skew = 0.075 45 | *** Added sample 43, p_x = 0.499, p_y = 0.499, p_size = 0.265, skew = 0.087 46 | *** Added sample 44, p_x = 0.420, p_y = 0.625, p_size = 0.246, skew = 0.109 47 | *** Added sample 45, p_x = 0.356, p_y = 0.479, p_size = 0.321, skew = 0.002 48 | *** Added sample 46, p_x = 0.418, p_y = 0.287, p_size = 0.332, skew = 0.005 49 | *** Added sample 47, p_x = 0.349, p_y = 0.266, p_size = 0.361, skew = 0.134 50 | *** Added sample 48, p_x = 0.251, p_y = 0.273, p_size = 0.363, skew = 0.233 51 | *** Added sample 49, p_x = 0.127, p_y = 0.294, p_size = 0.367, skew = 0.332 52 | # oST version 5.0 parameters 53 | 54 | 55 | [image] 56 | 57 | width 58 | 640 59 | 60 | height 61 | 480 62 | 63 | [narrow_stereo/left] 64 | 65 | camera matrix 66 | 655.181307 0.000000 333.367647 67 | 0.000000 653.044383 228.907390 68 | 0.000000 0.000000 1.000000 69 | 70 | distortion 71 | 0.112869 -0.227073 -0.000828 0.002980 0.000000 72 | 73 | rectification 74 | 1.000000 0.000000 0.000000 75 | 0.000000 1.000000 0.000000 76 | 0.000000 0.000000 1.000000 77 | 78 | projection 79 | 663.303223 0.000000 334.296764 0.000000 80 | 0.000000 662.064758 228.159625 0.000000 81 | 0.000000 0.000000 1.000000 0.000000 82 | 83 | 84 | Wrote calibration data to /tmp/calibrationdata.tar.gz 85 | D = [0.11286857594302174, -0.22707331068523257, -0.0008281883144864142, 0.002980106677326995, 0.0] 86 | K = [655.1813066930142, 0.0, 333.3676471825042, 0.0, 653.0443831944614, 228.90738957871108, 0.0, 0.0, 1.0] 87 | R = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] 88 | P = [663.30322265625, 0.0, 334.2967642612348, 0.0, 0.0, 662.0647583007812, 228.15962531367222, 0.0, 0.0, 0.0, 1.0, 0.0] 89 | # oST version 5.0 parameters 90 | 91 | 92 | [image] 93 | 94 | width 95 | 640 96 | 97 | height 98 | 480 99 | 100 | [narrow_stereo/left] 101 | 102 | camera matrix 103 | 655.181307 0.000000 333.367647 104 | 0.000000 653.044383 228.907390 105 | 0.000000 0.000000 1.000000 106 | 107 | distortion 108 | 0.112869 -0.227073 -0.000828 0.002980 0.000000 109 | 110 | rectification 111 | 1.000000 0.000000 0.000000 112 | 0.000000 1.000000 0.000000 113 | 0.000000 0.000000 1.000000 114 | 115 | projection 116 | 663.303223 0.000000 334.296764 0.000000 117 | 0.000000 662.064758 228.159625 0.000000 118 | 0.000000 0.000000 1.000000 0.000000 119 | 120 | -------------------------------------------------------------------------------- /chapter6_tutorials/calibration/pattern/calibration_pattern_chessboard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter6_tutorials/calibration/pattern/calibration_pattern_chessboard.pdf -------------------------------------------------------------------------------- /chapter6_tutorials/cfg/.gitignore: -------------------------------------------------------------------------------- 1 | cpp 2 | -------------------------------------------------------------------------------- /chapter6_tutorials/cfg/Camera.cfg: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # camera dynamic configuration 4 | 5 | PACKAGE='chapter6_tutorials' 6 | import roslib; roslib.load_manifest(PACKAGE) 7 | 8 | from dynamic_reconfigure.parameter_generator import * 9 | from driver_base.msg import SensorLevels 10 | 11 | gen = ParameterGenerator() 12 | 13 | # Name, Type, Reconfiguration level, Description, Default, Min, Max 14 | 15 | gen.add("camera_index", int_t, SensorLevels.RECONFIGURE_CLOSE, 16 | "Camera device index, e.g. 0 for /dev/video0", 0, 0, 10) 17 | 18 | gen.add("frame_width", int_t, SensorLevels.RECONFIGURE_CLOSE, 19 | "Frame width", 640, 1, 2000) 20 | 21 | gen.add("frame_height", int_t, SensorLevels.RECONFIGURE_CLOSE, 22 | "Frame height", 480, 1, 2000) 23 | 24 | gen.add("fps", double_t, SensorLevels.RECONFIGURE_RUNNING, 25 | "Frames Per Second (FPS)", 30., 0., 120.) 26 | 27 | gen.add("fourcc", str_t, SensorLevels.RECONFIGURE_CLOSE, 28 | "FourCC code", "YUYV") 29 | 30 | gen.add("brightness", double_t, SensorLevels.RECONFIGURE_RUNNING, 31 | "Brightness", 0.5, 0., 1.) 32 | 33 | gen.add("contrast", double_t, SensorLevels.RECONFIGURE_RUNNING, 34 | "Contrast", 1., 0., 1.) 35 | 36 | gen.add("saturation", double_t, SensorLevels.RECONFIGURE_RUNNING, 37 | "Saturation", 1., 0., 1.) 38 | 39 | gen.add("hue", double_t, SensorLevels.RECONFIGURE_RUNNING, 40 | "Hue", 0.5, 0., 1.) 41 | 42 | gen.add("gain", double_t, SensorLevels.RECONFIGURE_RUNNING, 43 | "Gain", 0., 0., 1.) 44 | 45 | gen.add("exposure", double_t, SensorLevels.RECONFIGURE_RUNNING, 46 | "Exposure", 0.5, 0., 1.) 47 | 48 | gen.add("frame_id", str_t, SensorLevels.RECONFIGURE_CLOSE, 49 | "ROS tf frame of reference, resolved with tf_prefix unless absolute.", 50 | "camera") 51 | 52 | gen.add("camera_info_url", str_t, SensorLevels.RECONFIGURE_RUNNING, 53 | "Camera [[camera_info_manager#URL_Names|calibration URL]] for this video_mode (uncalibrated if null).", "") 54 | 55 | exit(gen.generate(PACKAGE, "Camera", "Camera")) 56 | 57 | -------------------------------------------------------------------------------- /chapter6_tutorials/cfg/CameraStereo.cfg: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | # camera dynamic configuration 4 | 5 | PACKAGE='chapter6_tutorials' 6 | import roslib; roslib.load_manifest(PACKAGE) 7 | 8 | from dynamic_reconfigure.parameter_generator import * 9 | from driver_base.msg import SensorLevels 10 | 11 | gen = ParameterGenerator() 12 | 13 | # Name, Type, Reconfiguration level, Description, Default, Min, Max 14 | 15 | gen.add("camera_index_left", int_t, SensorLevels.RECONFIGURE_CLOSE, 16 | "Left camera device index, e.g. 0 for /dev/video0", 1, 0, 10) 17 | 18 | gen.add("camera_index_right", int_t, SensorLevels.RECONFIGURE_CLOSE, 19 | "Right camera device index, e.g. 1 for /dev/video1", 2, 0, 10) 20 | 21 | gen.add("frame_width", int_t, SensorLevels.RECONFIGURE_CLOSE, 22 | "Frame width", 640, 1, 2000) 23 | 24 | gen.add("frame_height", int_t, SensorLevels.RECONFIGURE_CLOSE, 25 | "Frame height", 480, 1, 2000) 26 | 27 | gen.add("fps", double_t, SensorLevels.RECONFIGURE_RUNNING, 28 | "Frames Per Second (FPS)", 30., 0., 120.) 29 | 30 | gen.add("fourcc", str_t, SensorLevels.RECONFIGURE_CLOSE, 31 | "FourCC code", "YUYV") 32 | 33 | gen.add("brightness", double_t, SensorLevels.RECONFIGURE_RUNNING, 34 | "Brightness", 0.5, 0., 1.) 35 | 36 | gen.add("contrast", double_t, SensorLevels.RECONFIGURE_RUNNING, 37 | "Contrast", 1., 0., 1.) 38 | 39 | gen.add("saturation", double_t, SensorLevels.RECONFIGURE_RUNNING, 40 | "Saturation", 1., 0., 1.) 41 | 42 | gen.add("hue", double_t, SensorLevels.RECONFIGURE_RUNNING, 43 | "Hue", 0.5, 0., 1.) 44 | 45 | gen.add("gain", double_t, SensorLevels.RECONFIGURE_RUNNING, 46 | "Gain", 0., 0., 1.) 47 | 48 | gen.add("exposure", double_t, SensorLevels.RECONFIGURE_RUNNING, 49 | "Exposure", 0.5, 0., 1.) 50 | 51 | gen.add("frame_id", str_t, SensorLevels.RECONFIGURE_CLOSE, 52 | "ROS tf frame of reference, resolved with tf_prefix unless absolute.", 53 | "camera") 54 | 55 | gen.add("camera_info_url_left", str_t, SensorLevels.RECONFIGURE_RUNNING, 56 | "Left camera [[camera_info_manager#URL_Names|calibration URL]] for this video_mode (uncalibrated if null).", "") 57 | 58 | gen.add("camera_info_url_right", str_t, SensorLevels.RECONFIGURE_RUNNING, 59 | "Right camera [[camera_info_manager#URL_Names|calibration URL]] for this video_mode (uncalibrated if null).", "") 60 | 61 | exit(gen.generate(PACKAGE, "CameraStereo", "CameraStereo")) 62 | 63 | -------------------------------------------------------------------------------- /chapter6_tutorials/config/chapter6_tutorials.config: -------------------------------------------------------------------------------- 1 | # Override chapter6_tutorials to output everything 2 | log4j.logger.ros.chapter6_tutorials=DEBUG 3 | 4 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/calibration/calibration_camera_chessboard.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/calibration/calibration_camera_stereo_chessboard.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/calibration/calibration_firewire_camera_acircles.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/calibration/calibration_firewire_camera_chessboard.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/calibration/calibration_firewire_camera_circles.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/calibration/calibration_gscam_chessboard.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/camera.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/camera_polling.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/camera_stereo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/camera_timer.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/firewire_camera.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/frames/stereo_frames.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/gscam.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/usb_cam.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/viso2_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/visual_odometry/viso2_mono_odometer.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /chapter6_tutorials/launch/visual_odometry/viso2_stereo_odometer.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /chapter6_tutorials/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b chapter6_tutorials 6 | 7 | 10 | 11 | --> 12 | 13 | 14 | */ 15 | -------------------------------------------------------------------------------- /chapter6_tutorials/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 6 tutorials. 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/camera/webcam.yaml: -------------------------------------------------------------------------------- 1 | # Example OpenCV camera parameters 2 | 3 | # Parameters, according with OpenCV VideoCapture::set method. 4 | camera_index: 0 5 | camera_name: webcam 6 | frame_width: 640 7 | frame_height: 480 8 | fps: 7.5 9 | # Check available pixel formats with (e.g. for /dev/video0): 10 | # v4l2-ctl -d /dev/video0 --list-formats 11 | # Typical values are: YUYV, MJPG (compressed) 12 | fourcc: YUYV 13 | brightness: 0.5 14 | contrast: 0.5 15 | saturation: 1. 16 | hue: 0.5 17 | gain: 0. 18 | exposure: 0.5 19 | frame_id: camera 20 | camera_info_url: package://chapter6_tutorials/calibration/camera/calibration_webcam.yaml 21 | 22 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/camera_stereo/disparity.yaml: -------------------------------------------------------------------------------- 1 | {correlation_window_size: 33, disparity_range: 32, min_disparity: 25, prefilter_cap: 5, 2 | prefilter_size: 15, speckle_range: 15, speckle_size: 50, texture_threshold: 1000, 3 | uniqueness_ratio: 5.0} 4 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/camera_stereo/logitech_c120.yaml: -------------------------------------------------------------------------------- 1 | # Example OpenCV Logitech Webcam C120 camera parameters 2 | 3 | # Parameters, according with OpenCV VideoCapture::set method. 4 | camera_index_left: 1 5 | camera_index_right: 2 6 | camera_name: logitech_c120 7 | frame_width: 640 8 | frame_height: 480 9 | fps: 7.5 10 | # Check available pixel formats with (e.g. for /dev/video0): 11 | # v4l2-ctl -d /dev/video0 --list-formats 12 | # Typical values are: YUYV, MJPG (compressed) 13 | fourcc: YUYV 14 | brightness: 0.2 15 | contrast: 0.1 16 | saturation: 0.1 17 | hue: 0. 18 | gain: 0. 19 | exposure: 0. 20 | frame_id: stereo_optical 21 | camera_info_url_left: package://chapter6_tutorials/calibration/camera_stereo/${NAME}.yaml 22 | camera_info_url_right: package://chapter6_tutorials/calibration/camera_stereo/${NAME}.yaml 23 | 24 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/camera_stereo/rviz.vcg: -------------------------------------------------------------------------------- 1 | Axes.Enabled=1 2 | Axes.Length=0.3 3 | Axes.Radius=0.05 4 | Axes.Reference\ Frame= 5 | Background\ ColorB=0 6 | Background\ ColorG=0 7 | Background\ ColorR=0 8 | Camera\ Config=-1.5248 4.71359 5.61244 0.135195 -0.131816 0 9 | Camera\ Type=rviz::XYOrbitViewController 10 | Camera.Enabled=1 11 | Camera.Image\ Rendering=background & overlay 12 | Camera.Image\ Topic=/stereo/right/image_rect_color 13 | Camera.Overlay\ Alpha=0 14 | Camera.Queue\ Size=2 15 | Camera.Transport\ Hint=raw 16 | Camera.Zoom\ Factor=1 17 | Fixed\ Frame=/stereo_optical 18 | Grid.Alpha=0.5 19 | Grid.Cell\ Size=1 20 | Grid.ColorB=0.5 21 | Grid.ColorG=0.5 22 | Grid.ColorR=0.5 23 | Grid.Enabled=1 24 | Grid.Line\ Style=0 25 | Grid.Line\ Width=0.03 26 | Grid.Normal\ Cell\ Count=0 27 | Grid.OffsetX=0 28 | Grid.OffsetY=0 29 | Grid.OffsetZ=0 30 | Grid.Plane=1 31 | Grid.Plane\ Cell\ Count=10 32 | Grid.Reference\ Frame= 33 | PointCloud2..AxisColorAutocompute\ Value\ Bounds=1 34 | PointCloud2..AxisColorAxis=2 35 | PointCloud2..AxisColorMax\ Value=3.83341 36 | PointCloud2..AxisColorMin\ Value=1.71134 37 | PointCloud2..AxisColorUse\ Fixed\ Frame=1 38 | PointCloud2..FlatColorColorB=1 39 | PointCloud2..FlatColorColorG=1 40 | PointCloud2..FlatColorColorR=1 41 | PointCloud2..IntensityAutocompute\ Intensity\ Bounds=1 42 | PointCloud2..IntensityChannel\ Name=intensity 43 | PointCloud2..IntensityMax\ ColorB=1 44 | PointCloud2..IntensityMax\ ColorG=1 45 | PointCloud2..IntensityMax\ ColorR=1 46 | PointCloud2..IntensityMax\ Intensity=4096 47 | PointCloud2..IntensityMin\ ColorB=0 48 | PointCloud2..IntensityMin\ ColorG=0 49 | PointCloud2..IntensityMin\ ColorR=0 50 | PointCloud2..IntensityMin\ Intensity=0 51 | PointCloud2..IntensityUse\ full\ RGB\ spectrum=0 52 | PointCloud2.Alpha=1 53 | PointCloud2.Billboard\ Size=0.01 54 | PointCloud2.Color\ Transformer=RGB8 55 | PointCloud2.Decay\ Time=0 56 | PointCloud2.Enabled=1 57 | PointCloud2.Position\ Transformer=XYZ 58 | PointCloud2.Queue\ Size=10 59 | PointCloud2.Selectable=1 60 | PointCloud2.Style=0 61 | PointCloud2.Topic=/stereo/points2 62 | Property\ Grid\ Splitter=295,78 63 | Property\ Grid\ State=expanded=.Global Options,Axes.Enabled,Grid.Enabled,PointCloud2.Enabled,PointCloud2.Status,Camera.Enabled;splitterratio=0.632959 64 | QMainWindow=000000ff00000000fd00000003000000000000011d00000287fc0200000003fb000000100044006900730070006c006100790073010000001d000001c7000000ee00fffffffb0000000a0049006d00610067006500000001ea000000ba0000000000000000fb0000000c00430061006d00650072006101000001ea000000ba0000001900ffffff000000010000013100000287fc0200000003fb0000001e0054006f006f006c002000500072006f0070006500720074006900650073010000001d000000a50000006700fffffffb0000000a0056006900650077007301000000c800000131000000bb00fffffffb0000001200530065006c0065006300740069006f006e01000001ff000000a50000006700ffffff00000003000005560000003efc0100000001fb0000000800540069006d0065010000000000000556000002bf00ffffff000002fc0000028700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 65 | Target\ Frame= 66 | Tool\ 2D\ Nav\ GoalTopic=goal 67 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 68 | [Display0] 69 | ClassName=rviz::AxesDisplay 70 | Name=Axes 71 | [Display1] 72 | ClassName=rviz::GridDisplay 73 | Name=Grid 74 | [Display2] 75 | ClassName=rviz::PointCloud2Display 76 | Name=PointCloud2 77 | [Display3] 78 | ClassName=rviz::CameraDisplay 79 | Name=Camera 80 | [Window] 81 | Height=780 82 | Width=1382 83 | X=-23 84 | Y=-56 85 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/camera_stereo/rviz_odometry.vcg: -------------------------------------------------------------------------------- 1 | Background\ ColorB=0 2 | Background\ ColorG=0 3 | Background\ ColorR=0 4 | Camera\ Config=0.3354 2.75858 3.50678 0 0 0 5 | Camera\ Type=rviz::OrbitViewController 6 | Camera.Enabled=1 7 | Camera.Image\ Rendering=background & overlay 8 | Camera.Image\ Topic=/stereo/left/image_rect_color 9 | Camera.Overlay\ Alpha=0 10 | Camera.Queue\ Size=2 11 | Camera.Transport\ Hint=raw 12 | Camera.Zoom\ Factor=1 13 | Fixed\ Frame=/odom 14 | Grid.Alpha=0.5 15 | Grid.Cell\ Size=1 16 | Grid.ColorB=0.5 17 | Grid.ColorG=0.5 18 | Grid.ColorR=0.5 19 | Grid.Enabled=1 20 | Grid.Line\ Style=0 21 | Grid.Line\ Width=0.03 22 | Grid.Normal\ Cell\ Count=0 23 | Grid.OffsetX=0 24 | Grid.OffsetY=0 25 | Grid.OffsetZ=0 26 | Grid.Plane=0 27 | Grid.Plane\ Cell\ Count=10 28 | Grid.Reference\ Frame= 29 | Odometry.Angle\ Tolerance=0.1 30 | Odometry.ColorB=0 31 | Odometry.ColorG=0.1 32 | Odometry.ColorR=1 33 | Odometry.Enabled=1 34 | Odometry.Keep=1 35 | Odometry.Length=0.5 36 | Odometry.Position\ Tolerance=0.1 37 | Odometry.Topic=/stereo_odometer/odometry 38 | PointCloud2..AxisColorAutocompute\ Value\ Bounds=1 39 | PointCloud2..AxisColorAxis=2 40 | PointCloud2..AxisColorMax\ Value=3.83341 41 | PointCloud2..AxisColorMin\ Value=1.71134 42 | PointCloud2..AxisColorUse\ Fixed\ Frame=1 43 | PointCloud2..FlatColorColorB=1 44 | PointCloud2..FlatColorColorG=1 45 | PointCloud2..FlatColorColorR=1 46 | PointCloud2..IntensityAutocompute\ Intensity\ Bounds=1 47 | PointCloud2..IntensityChannel\ Name=intensity 48 | PointCloud2..IntensityMax\ ColorB=1 49 | PointCloud2..IntensityMax\ ColorG=1 50 | PointCloud2..IntensityMax\ ColorR=1 51 | PointCloud2..IntensityMax\ Intensity=4096 52 | PointCloud2..IntensityMin\ ColorB=0 53 | PointCloud2..IntensityMin\ ColorG=0 54 | PointCloud2..IntensityMin\ ColorR=0 55 | PointCloud2..IntensityMin\ Intensity=0 56 | PointCloud2..IntensityUse\ full\ RGB\ spectrum=0 57 | PointCloud2.Alpha=1 58 | PointCloud2.Billboard\ Size=0.01 59 | PointCloud2.Color\ Transformer=RGB8 60 | PointCloud2.Decay\ Time=0 61 | PointCloud2.Enabled=1 62 | PointCloud2.Position\ Transformer=XYZ 63 | PointCloud2.Queue\ Size=10 64 | PointCloud2.Selectable=1 65 | PointCloud2.Style=0 66 | PointCloud2.Topic=/stereo/points2 67 | Property\ Grid\ Splitter=295,78 68 | Property\ Grid\ State=expanded=.Global Options,PointCloud2.Enabled,PointCloud2.Status;splitterratio=0.541806 69 | QMainWindow=000000ff00000000fd00000003000000000000013d00000287fc0200000003fb000000100044006900730070006c006100790073010000001d000001c7000000ee00fffffffb0000000a0049006d00610067006500000001ea000000ba0000000000000000fb0000000c00430061006d00650072006101000001ea000000ba0000001900ffffff000000010000013100000287fc0200000003fb0000001e0054006f006f006c002000500072006f0070006500720074006900650073010000001d000000a50000006700fffffffb0000000a0056006900650077007301000000c800000131000000bb00fffffffb0000001200530065006c0065006300740069006f006e01000001ff000000a50000006700ffffff00000003000005560000003efc0100000001fb0000000800540069006d0065010000000000000556000002bf00ffffff000002dc0000028700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 70 | TF.All\ Enabled=0 71 | TF.Enabled=1 72 | TF.Frame\ Timeout=15 73 | TF.Marker\ Scale=1 74 | TF.Show\ Arrows=1 75 | TF.Show\ Axes=1 76 | TF.Show\ Names=1 77 | TF.Update\ Interval=0 78 | Target\ Frame= 79 | Tool\ 2D\ Nav\ GoalTopic=goal 80 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 81 | [Display0] 82 | ClassName=rviz::GridDisplay 83 | Name=Grid 84 | [Display1] 85 | ClassName=rviz::PointCloud2Display 86 | Name=PointCloud2 87 | [Display2] 88 | ClassName=rviz::CameraDisplay 89 | Name=Camera 90 | [Display3] 91 | ClassName=rviz::OdometryDisplay 92 | Name=Odometry 93 | [Display4] 94 | ClassName=rviz::TFDisplay 95 | Name=TF 96 | [TF.Frames.] 97 | base_link.Enabled=0 98 | odom.Enabled=1 99 | stereo.Enabled=0 100 | stereo_optical.Enabled=1 101 | [Window] 102 | Height=744 103 | Width=1366 104 | X=-16 105 | Y=-56 106 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/firewire_camera/format7_mode0.yaml: -------------------------------------------------------------------------------- 1 | # Example firewire camera parameters 2 | 3 | # Parameters set for Sony 3.5mm 1:1.4 1/2" (aperture, focus marked with screw) 4 | guid: 00b09d0100ab1324 # (defaults to first camera on bus) 5 | iso_speed: 800 # IEEE1394b 6 | video_mode: format7_mode0 # 1384x1036 @ 30fps bayer pattern 7 | # Note that frame_rate is overwritten by frame_rate_feature; some useful values: 8 | # 21fps (480) 9 | frame_rate: 21 # max fps (Hz) 10 | auto_frame_rate_feature: 3 # Manual (3) 11 | frame_rate_feature: 480 12 | format7_color_coding: raw8 # for bayer (we can use others, even rgb8 directly) 13 | # With raw8, we don't need to configure bayer pattern and method, actually we 14 | # cannot change them 15 | bayer_pattern: rggb 16 | bayer_method: HQ 17 | auto_brightness: 3 # Manual (3) 18 | brightness: 0 19 | auto_exposure: 3 # Manual (3) 20 | exposure: 350 21 | auto_gain: 3 # Manual (3) 22 | gain: 700 23 | # We cannot set gamma manually in ROS (diamondback), so we switch it off 24 | auto_gamma: 0 # Off (0) 25 | #gamma: 1024 # gamma 1 26 | auto_saturation: 3 # Manual (3) 27 | saturation: 1000 28 | auto_sharpness: 3 # Manual (3) 29 | sharpness: 1000 30 | auto_shutter: 3 # Manual (3) 31 | #shutter: 1000 # = 10ms 32 | shutter: 1512 # = 20ms (1/50Hz), max. in 30fps 33 | auto_white_balance: 3 # Manual (3) 34 | white_balance_BU: 820 35 | white_balance_RV: 520 36 | frame_id: firewire_camera 37 | camera_info_url: package://chapter6_tutorials/calibration/firewire_camera/calibration_firewire_camera.yaml 38 | 39 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/gscam/logitech.yaml: -------------------------------------------------------------------------------- 1 | # Example USB logitech camera parameters 2 | 3 | # Parameters 4 | gscam_config: v4l2src device=/dev/video0 ! video/x-raw-rgb,framerate=30/1 ! ffmpegcolorspace 5 | frame_id: gscam 6 | camera_info_url: package://chapter6_tutorials/calibration/gscam/calibration_gscam.yaml 7 | 8 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/usb_cam/logitech.yaml: -------------------------------------------------------------------------------- 1 | # Example USB logitech camera parameters 2 | 3 | # Parameters 4 | video_device: /dev/video0 5 | image_width: 640 6 | image_height: 480 7 | pixel_format: mjpeg 8 | io_method: mmap 9 | camera_frame_id: usb_cam 10 | frame_id: usb_cam 11 | camera_info_url: 12 | 13 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/viso2_demo/disparity.yaml: -------------------------------------------------------------------------------- 1 | {correlation_window_size: 23, disparity_range: 48, min_disparity: 77, prefilter_cap: 5, 2 | prefilter_size: 15, speckle_range: 5, speckle_size: 100, texture_threshold: 500, 3 | uniqueness_ratio: 5.0} 4 | -------------------------------------------------------------------------------- /chapter6_tutorials/params/viso2_demo/rviz.vcg: -------------------------------------------------------------------------------- 1 | Background\ ColorB=0 2 | Background\ ColorG=0 3 | Background\ ColorR=0 4 | Camera\ Config=0.000398465 0.965398 10 0 0 0 5 | Camera\ Type=rviz::OrbitViewController 6 | Camera.Enabled=1 7 | Camera.Image\ Rendering=background & overlay 8 | Camera.Image\ Topic=/stereo_down/left/image_rect_color 9 | Camera.Overlay\ Alpha=0 10 | Camera.Queue\ Size=2 11 | Camera.Transport\ Hint=raw 12 | Camera.Zoom\ Factor=1 13 | Fixed\ Frame=/odom 14 | Grid.Alpha=0.5 15 | Grid.Cell\ Size=1 16 | Grid.ColorB=0.5 17 | Grid.ColorG=0.5 18 | Grid.ColorR=0.5 19 | Grid.Enabled=1 20 | Grid.Line\ Style=0 21 | Grid.Line\ Width=0.03 22 | Grid.Normal\ Cell\ Count=0 23 | Grid.OffsetX=0 24 | Grid.OffsetY=0 25 | Grid.OffsetZ=0 26 | Grid.Plane=0 27 | Grid.Plane\ Cell\ Count=10 28 | Grid.Reference\ Frame= 29 | Odometry.Angle\ Tolerance=0.1 30 | Odometry.ColorB=0 31 | Odometry.ColorG=0.1 32 | Odometry.ColorR=1 33 | Odometry.Enabled=1 34 | Odometry.Keep=1 35 | Odometry.Length=0.5 36 | Odometry.Position\ Tolerance=0.1 37 | Odometry.Topic=/stereo_odometer/odometry 38 | PointCloud2..AxisColorAutocompute\ Value\ Bounds=1 39 | PointCloud2..AxisColorAxis=2 40 | PointCloud2..AxisColorMax\ Value=-1.04142 41 | PointCloud2..AxisColorMin\ Value=-1.21708 42 | PointCloud2..AxisColorUse\ Fixed\ Frame=1 43 | PointCloud2..FlatColorColorB=1 44 | PointCloud2..FlatColorColorG=1 45 | PointCloud2..FlatColorColorR=1 46 | PointCloud2..IntensityAutocompute\ Intensity\ Bounds=1 47 | PointCloud2..IntensityChannel\ Name=rgb 48 | PointCloud2..IntensityMax\ ColorB=1 49 | PointCloud2..IntensityMax\ ColorG=1 50 | PointCloud2..IntensityMax\ ColorR=1 51 | PointCloud2..IntensityMax\ Intensity=2.25879e-38 52 | PointCloud2..IntensityMin\ ColorB=0 53 | PointCloud2..IntensityMin\ ColorG=0 54 | PointCloud2..IntensityMin\ ColorR=0 55 | PointCloud2..IntensityMin\ Intensity=5.07076e-39 56 | PointCloud2..IntensityUse\ full\ RGB\ spectrum=0 57 | PointCloud2.Alpha=1 58 | PointCloud2.Billboard\ Size=0.01 59 | PointCloud2.Color\ Transformer=RGB8 60 | PointCloud2.Decay\ Time=0 61 | PointCloud2.Enabled=1 62 | PointCloud2.Position\ Transformer=XYZ 63 | PointCloud2.Queue\ Size=10 64 | PointCloud2.Selectable=1 65 | PointCloud2.Style=0 66 | PointCloud2.Topic=/stereo_down/points2 67 | Property\ Grid\ Splitter=399,78 68 | Property\ Grid\ State=expanded=.Global Options,PointCloud2.Enabled;splitterratio=0.640449 69 | QMainWindow=000000ff00000000fd00000003000000000000011d00000317fc0200000003fb000000100044006900730070006c006100790073010000001d0000022f000000ee00fffffffb0000000a0049006d00610067006500000001ea000000ba0000000000000000fb0000000c00430061006d0065007200610100000252000000e20000001900ffffff000000010000013100000317fc0200000003fb0000001e0054006f006f006c002000500072006f0070006500720074006900650073010000001d000000c90000006700fffffffb0000000a0056006900650077007301000000ec00000179000000bb00fffffffb0000001200530065006c0065006300740069006f006e010000026b000000c90000006700ffffff00000003000005960000003efc0100000001fb0000000800540069006d0065010000000000000596000002bf00ffffff0000033c0000031700000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 70 | TF.All\ Enabled=0 71 | TF.Enabled=1 72 | TF.Frame\ Timeout=15 73 | TF.Marker\ Scale=1 74 | TF.Show\ Arrows=1 75 | TF.Show\ Axes=1 76 | TF.Show\ Names=1 77 | TF.Update\ Interval=0 78 | Target\ Frame= 79 | Tool\ 2D\ Nav\ GoalTopic=goal 80 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 81 | [Display0] 82 | ClassName=rviz::GridDisplay 83 | Name=Grid 84 | [Display1] 85 | ClassName=rviz::PointCloud2Display 86 | Name=PointCloud2 87 | [Display2] 88 | ClassName=rviz::CameraDisplay 89 | Name=Camera 90 | [Display3] 91 | ClassName=rviz::OdometryDisplay 92 | Name=Odometry 93 | [Display4] 94 | ClassName=rviz::TFDisplay 95 | Name=TF 96 | [TF.Frames.] 97 | base_link.Enabled=0 98 | odom.Enabled=1 99 | stereo_down.Enabled=0 100 | stereo_down_optical.Enabled=1 101 | stereo_forward.Enabled=0 102 | stereo_forward_optical.Enabled=0 103 | [Window] 104 | Height=924 105 | Width=1446 106 | X=-51 107 | Y=-56 108 | -------------------------------------------------------------------------------- /chapter6_tutorials/src/.gitignore: -------------------------------------------------------------------------------- 1 | chapter6_tutorials 2 | -------------------------------------------------------------------------------- /chapter6_tutorials/src/camera_polling.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class CameraDriver 9 | { 10 | public: 11 | enum Default 12 | { 13 | DEFAULT_CAMERA_INDEX = 0, 14 | DEFAULT_FPS = 30 15 | }; 16 | 17 | CameraDriver( int camera_index = DEFAULT_CAMERA_INDEX ) 18 | : 19 | nh( "~" ), 20 | it( nh ), 21 | camera( camera_index ), 22 | last( 0 ) 23 | { 24 | nh.param( "camera_index", camera_index, DEFAULT_CAMERA_INDEX ); 25 | nh.param( "fps", fps, DEFAULT_FPS ); 26 | 27 | if ( not camera.isOpened() ) 28 | { 29 | ROS_ERROR_STREAM( "Failed to open camera device!" ); 30 | ros::shutdown(); 31 | } 32 | 33 | period = ros::Duration( 1. / fps ); 34 | 35 | pub_image_raw = it.advertise( "image_raw", 1 ); 36 | 37 | frame = boost::make_shared< cv_bridge::CvImage >(); 38 | frame->encoding = sensor_msgs::image_encodings::BGR8; 39 | } 40 | 41 | ~CameraDriver() 42 | { 43 | camera.release(); 44 | } 45 | 46 | void capture() 47 | { 48 | camera >> frame->image; // blocking, so it frees the CPU. 49 | if ( frame->image.empty() ) 50 | { 51 | ROS_ERROR_STREAM( "Failed to retrive new frame! " ); 52 | ros::shutdown(); 53 | } 54 | 55 | ros::Time now = ros::Time::now(); 56 | if ( ( now - last ) >= period ) 57 | { 58 | frame->header.stamp = now; 59 | pub_image_raw.publish( frame->toImageMsg() ); 60 | 61 | last = now; 62 | } 63 | } 64 | 65 | private: 66 | ros::NodeHandle nh; 67 | image_transport::ImageTransport it; 68 | image_transport::Publisher pub_image_raw; 69 | 70 | cv::VideoCapture camera; 71 | cv::Mat image; 72 | cv_bridge::CvImagePtr frame; 73 | 74 | ros::Time last; 75 | ros::Duration period; 76 | 77 | int camera_index; 78 | int fps; 79 | }; 80 | 81 | 82 | int main( int argc, char* argv[] ) 83 | { 84 | ros::init( argc, argv, "camera" ); 85 | 86 | ros::NodeHandle nh( "~" ); 87 | 88 | int camera_index; 89 | nh.param( "camera_index", camera_index, CameraDriver::DEFAULT_CAMERA_INDEX ); 90 | 91 | CameraDriver camera_driver( camera_index ); 92 | 93 | while( ros::ok() ) 94 | { 95 | camera_driver.capture(); 96 | 97 | ros::spinOnce(); 98 | } 99 | 100 | return EXIT_SUCCESS; 101 | } 102 | 103 | -------------------------------------------------------------------------------- /chapter6_tutorials/src/camera_timer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class CameraDriver 9 | { 10 | public: 11 | enum Default 12 | { 13 | DEFAULT_CAMERA_INDEX = 0, 14 | DEFAULT_FPS = 30 15 | }; 16 | 17 | CameraDriver( int camera_index = DEFAULT_CAMERA_INDEX ) 18 | : 19 | nh( "~" ), 20 | it( nh ), 21 | camera( camera_index ) 22 | { 23 | nh.param( "camera_index", camera_index, DEFAULT_CAMERA_INDEX ); 24 | if ( not camera.isOpened() ) 25 | { 26 | ROS_ERROR_STREAM( "Failed to open camera device!" ); 27 | ros::shutdown(); 28 | } 29 | 30 | nh.param( "fps", fps, DEFAULT_FPS ); 31 | ros::Duration period = ros::Duration( 1. / fps ); 32 | 33 | pub_image_raw = it.advertise( "image_raw", 1 ); 34 | 35 | frame = boost::make_shared< cv_bridge::CvImage >(); 36 | frame->encoding = sensor_msgs::image_encodings::BGR8; 37 | 38 | timer = nh.createTimer( period, &CameraDriver::capture, this ); 39 | } 40 | 41 | ~CameraDriver() 42 | { 43 | camera.release(); 44 | } 45 | 46 | void capture( const ros::TimerEvent& te ) 47 | { 48 | camera >> frame->image; 49 | if( not frame->image.empty() ) 50 | { 51 | frame->header.stamp = ros::Time::now(); 52 | pub_image_raw.publish( frame->toImageMsg() ); 53 | } 54 | } 55 | 56 | private: 57 | ros::NodeHandle nh; 58 | image_transport::ImageTransport it; 59 | image_transport::Publisher pub_image_raw; 60 | 61 | cv::VideoCapture camera; 62 | cv::Mat image; 63 | cv_bridge::CvImagePtr frame; 64 | 65 | ros::Timer timer; 66 | 67 | int camera_index; 68 | int fps; 69 | }; 70 | 71 | 72 | int main( int argc, char* argv[] ) 73 | { 74 | ros::init( argc, argv, "camera" ); 75 | 76 | ros::NodeHandle nh( "~" ); 77 | 78 | int camera_index; 79 | nh.param( "camera_index", camera_index, CameraDriver::DEFAULT_CAMERA_INDEX ); 80 | 81 | CameraDriver camera_driver( camera_index ); 82 | 83 | while( ros::ok() ) 84 | { 85 | ros::spin(); 86 | } 87 | 88 | return EXIT_SUCCESS; 89 | } 90 | 91 | -------------------------------------------------------------------------------- /chapter7_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | #uncomment if you have defined messages 20 | #rosbuild_genmsg() 21 | #uncomment if you have defined services 22 | #rosbuild_gensrv() 23 | 24 | #common commands for building c++ executables and libraries 25 | #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) 26 | #target_link_libraries(${PROJECT_NAME} another_library) 27 | #rosbuild_add_boost_directories() 28 | #rosbuild_link_boost(${PROJECT_NAME} thread) 29 | #rosbuild_add_executable(example examples/example.cpp) 30 | #target_link_libraries(example ${PROJECT_NAME}) 31 | 32 | rosbuild_add_executable(tf_broadcaster src/tf_broadcaster.cpp) 33 | rosbuild_add_executable(tf_listener src/tf_listener.cpp) 34 | rosbuild_add_executable(laser src/laser.cpp) 35 | rosbuild_add_executable(odometry src/odometry.cpp) 36 | rosbuild_add_executable(base_controller src/base_controller.cpp) 37 | -------------------------------------------------------------------------------- /chapter7_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter7_tutorials/launch/display.vcg: -------------------------------------------------------------------------------- 1 | Background\ ColorB=0 2 | Background\ ColorG=0 3 | Background\ ColorR=0 4 | Camera\ Config=0.695398 0.890398 3.90747 0 0 0 5 | Camera\ Type=rviz::OrbitViewController 6 | Fixed\ Frame=/odom 7 | Grid.Alpha=0.5 8 | Grid.Cell\ Size=1 9 | Grid.ColorB=0.5 10 | Grid.ColorG=0.5 11 | Grid.ColorR=0.5 12 | Grid.Enabled=1 13 | Grid.Line\ Style=0 14 | Grid.Line\ Width=0.03 15 | Grid.Normal\ Cell\ Count=0 16 | Grid.OffsetX=0 17 | Grid.OffsetY=0 18 | Grid.OffsetZ=0 19 | Grid.Plane=0 20 | Grid.Plane\ Cell\ Count=10 21 | Grid.Reference\ Frame= 22 | Odometry.Angle\ Tolerance=0.1 23 | Odometry.ColorB=0 24 | Odometry.ColorG=0.1 25 | Odometry.ColorR=1 26 | Odometry.Enabled=1 27 | Odometry.Keep=100 28 | Odometry.Length=1 29 | Odometry.Position\ Tolerance=0.1 30 | Odometry.Topic=/odom 31 | Property\ Grid\ Splitter=294,78 32 | Property\ Grid\ State=expanded=.Global Options,Odometry.Enabled;splitterratio=0.5 33 | QMainWindow=000000ff00000000fd00000003000000000000011d000001c6fc0200000001fb000000100044006900730070006c0061007900730100000036000001c6000000ee00ffffff0000000100000131000001c6fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000036000000730000006700fffffffb0000000a0056006900650077007301000000af000000d4000000bb00fffffffb0000001200530065006c0065006300740069006f006e0100000189000000730000006700ffffff00000003000003bf0000003efc0100000001fb0000000800540069006d00650100000000000003bf000002bf00ffffff00000165000001c600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 34 | Robot\ Model.Alpha=1 35 | Robot\ Model.Collision\ Enabled=0 36 | Robot\ Model.Enabled=1 37 | Robot\ Model.Robot\ Description=robot_description 38 | Robot\ Model.TF\ Prefix= 39 | Robot\ Model.Update\ Interval=0 40 | Robot\ Model.Visual\ Enabled=1 41 | Robot\:\ Robot\ Model\ Link\ base_footprintAlpha=1 42 | Robot\:\ Robot\ Model\ Link\ base_footprintEnabled=1 43 | Robot\:\ Robot\ Model\ Link\ base_footprintShow\ Axes=0 44 | Robot\:\ Robot\ Model\ Link\ base_footprintShow\ Trail=0 45 | Robot\:\ Robot\ Model\ Link\ base_linkAlpha=1 46 | Robot\:\ Robot\ Model\ Link\ base_linkEnabled=1 47 | Robot\:\ Robot\ Model\ Link\ base_linkShow\ Axes=0 48 | Robot\:\ Robot\ Model\ Link\ base_linkShow\ Trail=0 49 | Robot\:\ Robot\ Model\ Link\ base_scan_linkAlpha=1 50 | Robot\:\ Robot\ Model\ Link\ base_scan_linkEnabled=1 51 | Robot\:\ Robot\ Model\ Link\ base_scan_linkShow\ Axes=0 52 | Robot\:\ Robot\ Model\ Link\ base_scan_linkShow\ Trail=0 53 | Robot\:\ Robot\ Model\ Link\ laser_base_linkAlpha=1 54 | Robot\:\ Robot\ Model\ Link\ laser_base_linkEnabled=1 55 | Robot\:\ Robot\ Model\ Link\ laser_base_linkShow\ Axes=0 56 | Robot\:\ Robot\ Model\ Link\ laser_base_linkShow\ Trail=0 57 | Robot\:\ Robot\ Model\ Link\ wheel_1Alpha=1 58 | Robot\:\ Robot\ Model\ Link\ wheel_1Enabled=1 59 | Robot\:\ Robot\ Model\ Link\ wheel_1Show\ Axes=0 60 | Robot\:\ Robot\ Model\ Link\ wheel_1Show\ Trail=0 61 | Robot\:\ Robot\ Model\ Link\ wheel_2Alpha=1 62 | Robot\:\ Robot\ Model\ Link\ wheel_2Enabled=1 63 | Robot\:\ Robot\ Model\ Link\ wheel_2Show\ Axes=0 64 | Robot\:\ Robot\ Model\ Link\ wheel_2Show\ Trail=0 65 | Robot\:\ Robot\ Model\ Link\ wheel_3Alpha=1 66 | Robot\:\ Robot\ Model\ Link\ wheel_3Enabled=1 67 | Robot\:\ Robot\ Model\ Link\ wheel_3Show\ Axes=0 68 | Robot\:\ Robot\ Model\ Link\ wheel_3Show\ Trail=0 69 | Robot\:\ Robot\ Model\ Link\ wheel_4Alpha=1 70 | Robot\:\ Robot\ Model\ Link\ wheel_4Enabled=1 71 | Robot\:\ Robot\ Model\ Link\ wheel_4Show\ Axes=0 72 | Robot\:\ Robot\ Model\ Link\ wheel_4Show\ Trail=0 73 | Target\ Frame=/base_footprint 74 | Tool\ 2D\ Nav\ GoalTopic=goal 75 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 76 | [Display0] 77 | ClassName=rviz::RobotModelDisplay 78 | Name=Robot Model 79 | [Display1] 80 | ClassName=rviz::GridDisplay 81 | Name=Grid 82 | [Display2] 83 | ClassName=rviz::OdometryDisplay 84 | Name=Odometry 85 | [Window] 86 | Height=576 87 | Width=959 88 | X=-16 89 | Y=-56 90 | -------------------------------------------------------------------------------- /chapter7_tutorials/launch/display_xacro.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter7_tutorials/launch/gazebo_map_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /chapter7_tutorials/launch/gazebo_mapping_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /chapter7_tutorials/launch/gazebo_xacro.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /chapter7_tutorials/launch/mapping.vcg: -------------------------------------------------------------------------------- 1 | Background\ ColorB=0 2 | Background\ ColorG=0 3 | Background\ ColorR=0 4 | Camera\ Config=0.93279 2.8508 42.1018 0 0 0 5 | Camera\ Type=rviz::OrbitViewController 6 | Fixed\ Frame=/odom 7 | Grid.Alpha=0.5 8 | Grid.Cell\ Size=1 9 | Grid.ColorB=0.5 10 | Grid.ColorG=0.5 11 | Grid.ColorR=0.5 12 | Grid.Enabled=1 13 | Grid.Line\ Style=0 14 | Grid.Line\ Width=0.03 15 | Grid.Normal\ Cell\ Count=0 16 | Grid.OffsetX=0 17 | Grid.OffsetY=0 18 | Grid.OffsetZ=0 19 | Grid.Plane=0 20 | Grid.Plane\ Cell\ Count=10 21 | Grid.Reference\ Frame= 22 | Laser\ Scan..AxisColorAutocompute\ Value\ Bounds=1 23 | Laser\ Scan..AxisColorAxis=2 24 | Laser\ Scan..AxisColorMax\ Value=10 25 | Laser\ Scan..AxisColorMin\ Value=-10 26 | Laser\ Scan..AxisColorUse\ Fixed\ Frame=1 27 | Laser\ Scan..FlatColorColorB=1 28 | Laser\ Scan..FlatColorColorG=1 29 | Laser\ Scan..FlatColorColorR=1 30 | Laser\ Scan..IntensityAutocompute\ Intensity\ Bounds=1 31 | Laser\ Scan..IntensityChannel\ Name=intensity 32 | Laser\ Scan..IntensityMax\ ColorB=1 33 | Laser\ Scan..IntensityMax\ ColorG=1 34 | Laser\ Scan..IntensityMax\ ColorR=1 35 | Laser\ Scan..IntensityMax\ Intensity=101 36 | Laser\ Scan..IntensityMin\ ColorB=0 37 | Laser\ Scan..IntensityMin\ ColorG=0 38 | Laser\ Scan..IntensityMin\ ColorR=0 39 | Laser\ Scan..IntensityMin\ Intensity=101 40 | Laser\ Scan..IntensityUse\ full\ RGB\ spectrum=0 41 | Laser\ Scan.Alpha=1 42 | Laser\ Scan.Billboard\ Size=0.01 43 | Laser\ Scan.Color\ Transformer=Intensity 44 | Laser\ Scan.Decay\ Time=0 45 | Laser\ Scan.Enabled=1 46 | Laser\ Scan.Position\ Transformer=XYZ 47 | Laser\ Scan.Queue\ Size=10 48 | Laser\ Scan.Selectable=1 49 | Laser\ Scan.Style=0 50 | Laser\ Scan.Topic=/base_scan/scan 51 | Map.Alpha=0.7 52 | Map.Draw\ Behind=0 53 | Map.Enabled=1 54 | Map.Topic=/map 55 | Property\ Grid\ Splitter=294,78 56 | Property\ Grid\ State=expanded=.Global Options;splitterratio=0.5 57 | QMainWindow=000000ff00000000fd00000003000000000000011d000001c6fc0200000001fb000000100044006900730070006c0061007900730100000036000001c6000000ee00ffffff0000000100000131000001c6fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000036000000730000006700fffffffb0000000a0056006900650077007301000000af000000d4000000bb00fffffffb0000001200530065006c0065006300740069006f006e0100000189000000730000006700ffffff00000003000003bf0000003efc0100000001fb0000000800540069006d00650100000000000003bf000002bf00ffffff00000165000001c600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 58 | Robot\ Model.Alpha=1 59 | Robot\ Model.Collision\ Enabled=0 60 | Robot\ Model.Enabled=1 61 | Robot\ Model.Robot\ Description=robot_description 62 | Robot\ Model.TF\ Prefix= 63 | Robot\ Model.Update\ Interval=0 64 | Robot\ Model.Visual\ Enabled=1 65 | Robot\:\ Robot\ Model\ Link\ base_footprintAlpha=1 66 | Robot\:\ Robot\ Model\ Link\ base_footprintEnabled=1 67 | Robot\:\ Robot\ Model\ Link\ base_footprintShow\ Axes=0 68 | Robot\:\ Robot\ Model\ Link\ base_footprintShow\ Trail=0 69 | Robot\:\ Robot\ Model\ Link\ base_linkAlpha=1 70 | Robot\:\ Robot\ Model\ Link\ base_linkEnabled=1 71 | Robot\:\ Robot\ Model\ Link\ base_linkShow\ Axes=0 72 | Robot\:\ Robot\ Model\ Link\ base_linkShow\ Trail=0 73 | Robot\:\ Robot\ Model\ Link\ base_scan_linkAlpha=1 74 | Robot\:\ Robot\ Model\ Link\ base_scan_linkEnabled=1 75 | Robot\:\ Robot\ Model\ Link\ base_scan_linkShow\ Axes=0 76 | Robot\:\ Robot\ Model\ Link\ base_scan_linkShow\ Trail=0 77 | Robot\:\ Robot\ Model\ Link\ laser_base_linkAlpha=1 78 | Robot\:\ Robot\ Model\ Link\ laser_base_linkEnabled=1 79 | Robot\:\ Robot\ Model\ Link\ laser_base_linkShow\ Axes=0 80 | Robot\:\ Robot\ Model\ Link\ laser_base_linkShow\ Trail=0 81 | Robot\:\ Robot\ Model\ Link\ wheel_1Alpha=1 82 | Robot\:\ Robot\ Model\ Link\ wheel_1Enabled=1 83 | Robot\:\ Robot\ Model\ Link\ wheel_1Show\ Axes=0 84 | Robot\:\ Robot\ Model\ Link\ wheel_1Show\ Trail=0 85 | Robot\:\ Robot\ Model\ Link\ wheel_2Alpha=1 86 | Robot\:\ Robot\ Model\ Link\ wheel_2Enabled=1 87 | Robot\:\ Robot\ Model\ Link\ wheel_2Show\ Axes=0 88 | Robot\:\ Robot\ Model\ Link\ wheel_2Show\ Trail=0 89 | Robot\:\ Robot\ Model\ Link\ wheel_3Alpha=1 90 | Robot\:\ Robot\ Model\ Link\ wheel_3Enabled=1 91 | Robot\:\ Robot\ Model\ Link\ wheel_3Show\ Axes=0 92 | Robot\:\ Robot\ Model\ Link\ wheel_3Show\ Trail=0 93 | Robot\:\ Robot\ Model\ Link\ wheel_4Alpha=1 94 | Robot\:\ Robot\ Model\ Link\ wheel_4Enabled=1 95 | Robot\:\ Robot\ Model\ Link\ wheel_4Show\ Axes=0 96 | Robot\:\ Robot\ Model\ Link\ wheel_4Show\ Trail=0 97 | Target\ Frame= 98 | Tool\ 2D\ Nav\ GoalTopic=goal 99 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 100 | [Display0] 101 | ClassName=rviz::RobotModelDisplay 102 | Name=Robot Model 103 | [Display1] 104 | ClassName=rviz::GridDisplay 105 | Name=Grid 106 | [Display2] 107 | ClassName=rviz::LaserScanDisplay 108 | Name=Laser Scan 109 | [Display3] 110 | ClassName=rviz::MapDisplay 111 | Name=Map 112 | [Window] 113 | Height=576 114 | Width=959 115 | X=-16 116 | Y=-56 117 | -------------------------------------------------------------------------------- /chapter7_tutorials/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 7 tutorials. 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /chapter7_tutorials/maps/map.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter7_tutorials/maps/map.pgm -------------------------------------------------------------------------------- /chapter7_tutorials/maps/map.yaml: -------------------------------------------------------------------------------- 1 | image: map.pgm 2 | resolution: 0.050000 3 | origin: [-100.000000, -100.000000, 0.000000] 4 | negate: 0 5 | occupied_thresh: 0.65 6 | free_thresh: 0.196 7 | 8 | -------------------------------------------------------------------------------- /chapter7_tutorials/src/base_controller.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | double width_robot = 0.1; 10 | double vl = 0.0; 11 | double vr = 0.0; 12 | ros::Time last_time; 13 | double right_enc = 0.0; 14 | double left_enc = 0.0; 15 | double right_enc_old = 0.0; 16 | double left_enc_old = 0.0; 17 | double distance_left = 0.0; 18 | double distance_right = 0.0; 19 | double ticks_per_meter = 100; 20 | double x = 0.0; 21 | double y = 0.0; 22 | double th = 0.0; 23 | geometry_msgs::Quaternion odom_quat; 24 | 25 | void cmd_velCallback(const geometry_msgs::Twist &twist_aux) 26 | { 27 | geometry_msgs::Twist twist = twist_aux; 28 | double vel_x = twist_aux.linear.x; 29 | double vel_th = twist_aux.angular.z; 30 | double right_vel = 0.0; 31 | double left_vel = 0.0; 32 | 33 | if(vel_x == 0){ // turning 34 | right_vel = vel_th * width_robot / 2.0; 35 | left_vel = (-1) * right_vel; 36 | }else if(vel_th == 0){ // fordward / backward 37 | left_vel = right_vel = vel_x; 38 | }else{ // moving doing arcs 39 | left_vel = vel_x - vel_th * width_robot / 2.0; 40 | right_vel = vel_x + vel_th * width_robot / 2.0; 41 | } 42 | vl = left_vel; 43 | vr = right_vel; 44 | } 45 | 46 | 47 | int main(int argc, char** argv){ 48 | ros::init(argc, argv, "base_controller"); 49 | ros::NodeHandle n; 50 | ros::Subscriber cmd_vel_sub = n.subscribe("cmd_vel", 10, cmd_velCallback); 51 | ros::Rate loop_rate(10); 52 | 53 | while(ros::ok()) 54 | { 55 | 56 | double dxy = 0.0; 57 | double dth = 0.0; 58 | ros::Time current_time = ros::Time::now(); 59 | double dt; 60 | double velxy = dxy / dt; 61 | double velth = dth / dt; 62 | 63 | ros::spinOnce(); 64 | dt = (current_time - last_time).toSec();; 65 | last_time = current_time; 66 | 67 | // calculate odomety 68 | if(right_enc == 0.0){ 69 | distance_left = 0.0; 70 | distance_right = 0.0; 71 | }else{ 72 | distance_left = (left_enc - left_enc_old) / ticks_per_meter; 73 | distance_right = (right_enc - right_enc_old) / ticks_per_meter; 74 | } 75 | 76 | left_enc_old = left_enc; 77 | right_enc_old = right_enc; 78 | 79 | dxy = (distance_left + distance_right) / 2.0; 80 | dth = (distance_right - distance_left) / width_robot; 81 | 82 | if(dxy != 0){ 83 | x += dxy * cosf(dth); 84 | y += dxy * sinf(dth); 85 | } 86 | 87 | if(dth != 0){ 88 | th += dth; 89 | } 90 | odom_quat = tf::createQuaternionMsgFromRollPitchYaw(0,0,th); 91 | loop_rate.sleep(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /chapter7_tutorials/src/laser.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main(int argc, char** argv){ 6 | 7 | ros::init(argc, argv, "laser_scan_publisher"); 8 | 9 | ros::NodeHandle n; 10 | 11 | ros::Publisher scan_pub = n.advertise("scan", 50); 12 | 13 | unsigned int num_readings = 100; 14 | 15 | double laser_frequency = 40; 16 | 17 | double ranges[num_readings]; 18 | 19 | double intensities[num_readings]; 20 | 21 | int count = 0; 22 | 23 | ros::Rate r(1.0); 24 | 25 | while(n.ok()){ 26 | 27 | //generate some fake data for our laser scan 28 | 29 | for(unsigned int i = 0; i < num_readings; ++i){ 30 | 31 | ranges[i] = count; 32 | 33 | intensities[i] = 100 + count; 34 | 35 | } 36 | 37 | ros::Time scan_time = ros::Time::now(); 38 | 39 | //populate the LaserScan message 40 | 41 | sensor_msgs::LaserScan scan; 42 | 43 | scan.header.stamp = scan_time; 44 | 45 | scan.header.frame_id = "base_link"; 46 | 47 | scan.angle_min = -1.57; 48 | 49 | scan.angle_max = 1.57; 50 | 51 | scan.angle_increment = 3.14 / num_readings; 52 | 53 | scan.time_increment = (1 / laser_frequency) / (num_readings); 54 | 55 | scan.range_min = 0.0; 56 | 57 | scan.range_max = 100.0; 58 | 59 | scan.ranges.resize(num_readings); 60 | 61 | scan.intensities.resize(num_readings); 62 | 63 | for(unsigned int i = 0; i < num_readings; ++i){ 64 | 65 | scan.ranges[i] = ranges[i]; 66 | 67 | scan.intensities[i] = intensities[i]; 68 | 69 | } 70 | 71 | scan_pub.publish(scan); 72 | 73 | ++count; 74 | 75 | r.sleep(); 76 | 77 | } 78 | 79 | } 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /chapter7_tutorials/src/odometry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | int main(int argc, char** argv) { 9 | 10 | ros::init(argc, argv, "state_publisher"); 11 | ros::NodeHandle n; 12 | ros::Publisher odom_pub = n.advertise("odom", 10); 13 | 14 | // initial position 15 | double x = 0.0; 16 | double y = 0.0; 17 | double th = 0; 18 | 19 | // velocity 20 | double vx = 0.4; 21 | double vy = 0.0; 22 | double vth = 0.4; 23 | 24 | ros::Time current_time; 25 | ros::Time last_time; 26 | current_time = ros::Time::now(); 27 | last_time = ros::Time::now(); 28 | 29 | tf::TransformBroadcaster broadcaster; 30 | ros::Rate loop_rate(20); 31 | 32 | const double degree = M_PI/180; 33 | 34 | // message declarations 35 | geometry_msgs::TransformStamped odom_trans; 36 | odom_trans.header.frame_id = "odom"; 37 | odom_trans.child_frame_id = "base_footprint"; 38 | 39 | while (ros::ok()) { 40 | current_time = ros::Time::now(); 41 | 42 | double dt = (current_time - last_time).toSec(); 43 | double delta_x = (vx * cos(th) - vy * sin(th)) * dt; 44 | double delta_y = (vx * sin(th) + vy * cos(th)) * dt; 45 | double delta_th = vth * dt; 46 | 47 | x += delta_x; 48 | y += delta_y; 49 | th += delta_th; 50 | 51 | geometry_msgs::Quaternion odom_quat; 52 | odom_quat = tf::createQuaternionMsgFromRollPitchYaw(0,0,th); 53 | 54 | // update transform 55 | odom_trans.header.stamp = current_time; 56 | odom_trans.transform.translation.x = x; 57 | odom_trans.transform.translation.y = y; 58 | odom_trans.transform.translation.z = 0.0; 59 | odom_trans.transform.rotation = tf::createQuaternionMsgFromYaw(th); 60 | 61 | //filling the odometry 62 | nav_msgs::Odometry odom; 63 | odom.header.stamp = current_time; 64 | odom.header.frame_id = "odom"; 65 | odom.child_frame_id = "base_footprint"; 66 | 67 | // position 68 | odom.pose.pose.position.x = x; 69 | odom.pose.pose.position.y = y; 70 | odom.pose.pose.position.z = 0.0; 71 | odom.pose.pose.orientation = odom_quat; 72 | 73 | //velocity 74 | odom.twist.twist.linear.x = vx; 75 | odom.twist.twist.linear.y = vy; 76 | odom.twist.twist.linear.z = 0.0; 77 | odom.twist.twist.angular.x = 0.0; 78 | odom.twist.twist.angular.y = 0.0; 79 | odom.twist.twist.angular.z = vth; 80 | 81 | last_time = current_time; 82 | 83 | // publishing the odometry and the new tf 84 | broadcaster.sendTransform(odom_trans); 85 | odom_pub.publish(odom); 86 | 87 | loop_rate.sleep(); 88 | } 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /chapter7_tutorials/src/tf_broadcaster.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char** argv){ 5 | ros::init(argc, argv, "robot_tf_publisher"); 6 | ros::NodeHandle n; 7 | 8 | ros::Rate r(100); 9 | 10 | tf::TransformBroadcaster broadcaster; 11 | 12 | while(n.ok()){ 13 | broadcaster.sendTransform( 14 | tf::StampedTransform( 15 | tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(0.0, 0.0, 0.0)), 16 | ros::Time::now(),"base_link", "base_laser")); 17 | r.sleep(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapter7_tutorials/src/tf_listener.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void transformPoint(const tf::TransformListener& listener){ 6 | //we'll create a point in the base_laser frame that we'd like to transform to the base_link frame 7 | 8 | geometry_msgs::PointStamped laser_point; 9 | laser_point.header.frame_id = "base_laser"; 10 | 11 | //we'll just use the most recent transform available for our simple example 12 | laser_point.header.stamp = ros::Time(); 13 | 14 | //just an arbitrary point in space 15 | laser_point.point.x = 1.0; 16 | laser_point.point.y = 2.0; 17 | laser_point.point.z = 0.0; 18 | 19 | geometry_msgs::PointStamped base_point; 20 | 21 | 22 | //listener.waitForTransform( 23 | 24 | listener.transformPoint("base_link", laser_point, base_point); 25 | 26 | 27 | // listener.lookupTransform("base_link", "wheel_2", ros::Time(0), ros::Duration(10.0)); 28 | ROS_INFO("base_laser: (%.2f, %.2f. %.2f) -----> base_link: (%.2f, %.2f, %.2f) at time %.2f", 29 | laser_point.point.x, laser_point.point.y, laser_point.point.z, 30 | base_point.point.x, base_point.point.y, base_point.point.z, base_point.header.stamp.toSec()); 31 | 32 | } 33 | 34 | int main(int argc, char** argv){ 35 | ros::init(argc, argv, "robot_tf_listener"); 36 | ros::NodeHandle n; 37 | 38 | tf::TransformListener listener(ros::Duration(10)); 39 | 40 | //we'll transform a point once every second 41 | ros::Timer timer = n.createTimer(ros::Duration(1.0), boost::bind(&transformPoint, boost::ref(listener))); 42 | 43 | ros::spin(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /chapter8_tutorials/.tipos.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter8_tutorials/.tipos.swp -------------------------------------------------------------------------------- /chapter8_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | #uncomment if you have defined messages 20 | #rosbuild_genmsg() 21 | #uncomment if you have defined services 22 | #rosbuild_gensrv() 23 | 24 | #common commands for building c++ executables and libraries 25 | #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) 26 | #target_link_libraries(${PROJECT_NAME} another_library) 27 | #rosbuild_add_boost_directories() 28 | #rosbuild_add_executable(example examples/example.cpp) 29 | #target_link_libraries(lib ${PROJECT_NAME}) 30 | rosbuild_add_executable(sendGoals src/sendGoals.cpp) 31 | #rosbuild_link_boost(${PROJECT_NAME} thread) 32 | 33 | -------------------------------------------------------------------------------- /chapter8_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter8_tutorials/launch/base_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | TrajectoryPlannerROS: 2 | max_vel_x: 1 3 | min_vel_x: 0.8 4 | max_rotational_vel: 0.5 5 | min_in_place_rotational_vel: 0.2 6 | 7 | acc_lim_th: 3.2 8 | acc_lim_x: 2.5 9 | acc_lim_y: 2.5 10 | 11 | holonomic_robot: false 12 | -------------------------------------------------------------------------------- /chapter8_tutorials/launch/chapter8_configuration_gazebo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /chapter8_tutorials/launch/chapter8_configuration_gazebo_taliarte.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /chapter8_tutorials/launch/costmap_common_params.yaml: -------------------------------------------------------------------------------- 1 | obstacle_range: 10 2 | raytrace_range: 3.0 3 | footprint: [[-0.2,-0.2],[-0.2,0.2], [0.2, 0.2], [0.2,-0.2]] 4 | #robot_radius: ir_of_robot 5 | inflation_radius: 0.55 6 | 7 | observation_sources: laser_scan_sensor 8 | 9 | laser_scan_sensor: {sensor_frame: laser_base_link, data_type: LaserScan, topic: /scan, marking: true, clearing: true} 10 | 11 | -------------------------------------------------------------------------------- /chapter8_tutorials/launch/display.vcg: -------------------------------------------------------------------------------- 1 | Background\ ColorB=0 2 | Background\ ColorG=0 3 | Background\ ColorR=0 4 | Camera\ Config=0.695398 0.890398 3.90747 0 0 0 5 | Camera\ Type=rviz::OrbitViewController 6 | Fixed\ Frame=/odom 7 | Grid.Alpha=0.5 8 | Grid.Cell\ Size=1 9 | Grid.ColorB=0.5 10 | Grid.ColorG=0.5 11 | Grid.ColorR=0.5 12 | Grid.Enabled=1 13 | Grid.Line\ Style=0 14 | Grid.Line\ Width=0.03 15 | Grid.Normal\ Cell\ Count=0 16 | Grid.OffsetX=0 17 | Grid.OffsetY=0 18 | Grid.OffsetZ=0 19 | Grid.Plane=0 20 | Grid.Plane\ Cell\ Count=10 21 | Grid.Reference\ Frame= 22 | Odometry.Angle\ Tolerance=0.1 23 | Odometry.ColorB=0 24 | Odometry.ColorG=0.1 25 | Odometry.ColorR=1 26 | Odometry.Enabled=1 27 | Odometry.Keep=100 28 | Odometry.Length=1 29 | Odometry.Position\ Tolerance=0.1 30 | Odometry.Topic=/odom 31 | Property\ Grid\ Splitter=294,78 32 | Property\ Grid\ State=expanded=.Global Options,Odometry.Enabled;splitterratio=0.5 33 | QMainWindow=000000ff00000000fd00000003000000000000011d000001c6fc0200000001fb000000100044006900730070006c0061007900730100000036000001c6000000ee00ffffff0000000100000131000001c6fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000036000000730000006700fffffffb0000000a0056006900650077007301000000af000000d4000000bb00fffffffb0000001200530065006c0065006300740069006f006e0100000189000000730000006700ffffff00000003000003bf0000003efc0100000001fb0000000800540069006d00650100000000000003bf000002bf00ffffff00000165000001c600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 34 | Robot\ Model.Alpha=1 35 | Robot\ Model.Collision\ Enabled=0 36 | Robot\ Model.Enabled=1 37 | Robot\ Model.Robot\ Description=robot_description 38 | Robot\ Model.TF\ Prefix= 39 | Robot\ Model.Update\ Interval=0 40 | Robot\ Model.Visual\ Enabled=1 41 | Robot\:\ Robot\ Model\ Link\ base_footprintAlpha=1 42 | Robot\:\ Robot\ Model\ Link\ base_footprintEnabled=1 43 | Robot\:\ Robot\ Model\ Link\ base_footprintShow\ Axes=0 44 | Robot\:\ Robot\ Model\ Link\ base_footprintShow\ Trail=0 45 | Robot\:\ Robot\ Model\ Link\ base_linkAlpha=1 46 | Robot\:\ Robot\ Model\ Link\ base_linkEnabled=1 47 | Robot\:\ Robot\ Model\ Link\ base_linkShow\ Axes=0 48 | Robot\:\ Robot\ Model\ Link\ base_linkShow\ Trail=0 49 | Robot\:\ Robot\ Model\ Link\ base_scan_linkAlpha=1 50 | Robot\:\ Robot\ Model\ Link\ base_scan_linkEnabled=1 51 | Robot\:\ Robot\ Model\ Link\ base_scan_linkShow\ Axes=0 52 | Robot\:\ Robot\ Model\ Link\ base_scan_linkShow\ Trail=0 53 | Robot\:\ Robot\ Model\ Link\ laser_base_linkAlpha=1 54 | Robot\:\ Robot\ Model\ Link\ laser_base_linkEnabled=1 55 | Robot\:\ Robot\ Model\ Link\ laser_base_linkShow\ Axes=0 56 | Robot\:\ Robot\ Model\ Link\ laser_base_linkShow\ Trail=0 57 | Robot\:\ Robot\ Model\ Link\ wheel_1Alpha=1 58 | Robot\:\ Robot\ Model\ Link\ wheel_1Enabled=1 59 | Robot\:\ Robot\ Model\ Link\ wheel_1Show\ Axes=0 60 | Robot\:\ Robot\ Model\ Link\ wheel_1Show\ Trail=0 61 | Robot\:\ Robot\ Model\ Link\ wheel_2Alpha=1 62 | Robot\:\ Robot\ Model\ Link\ wheel_2Enabled=1 63 | Robot\:\ Robot\ Model\ Link\ wheel_2Show\ Axes=0 64 | Robot\:\ Robot\ Model\ Link\ wheel_2Show\ Trail=0 65 | Robot\:\ Robot\ Model\ Link\ wheel_3Alpha=1 66 | Robot\:\ Robot\ Model\ Link\ wheel_3Enabled=1 67 | Robot\:\ Robot\ Model\ Link\ wheel_3Show\ Axes=0 68 | Robot\:\ Robot\ Model\ Link\ wheel_3Show\ Trail=0 69 | Robot\:\ Robot\ Model\ Link\ wheel_4Alpha=1 70 | Robot\:\ Robot\ Model\ Link\ wheel_4Enabled=1 71 | Robot\:\ Robot\ Model\ Link\ wheel_4Show\ Axes=0 72 | Robot\:\ Robot\ Model\ Link\ wheel_4Show\ Trail=0 73 | Target\ Frame=/base_footprint 74 | Tool\ 2D\ Nav\ GoalTopic=goal 75 | Tool\ 2D\ Pose\ EstimateTopic=initialpose 76 | [Display0] 77 | ClassName=rviz::RobotModelDisplay 78 | Name=Robot Model 79 | [Display1] 80 | ClassName=rviz::GridDisplay 81 | Name=Grid 82 | [Display2] 83 | ClassName=rviz::OdometryDisplay 84 | Name=Odometry 85 | [Window] 86 | Height=576 87 | Width=959 88 | X=-16 89 | Y=-56 90 | -------------------------------------------------------------------------------- /chapter8_tutorials/launch/global_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | global_costmap: 2 | global_frame: /map 3 | robot_base_frame: /base_footprint 4 | update_frequency: 5.0 5 | static_map: true 6 | -------------------------------------------------------------------------------- /chapter8_tutorials/launch/local_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | local_costmap: 2 | global_frame: /map 3 | robot_base_frame: /base_footprint 4 | update_frequency: 5.0 5 | publish_frequency: 2.0 6 | static_map: false 7 | rolling_window: true 8 | width: 5.0 9 | height: 5.0 10 | resolution: 0.1 11 | -------------------------------------------------------------------------------- /chapter8_tutorials/launch/move_base.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter8_tutorials/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 8 tutorials. 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /chapter8_tutorials/maps/map.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AaronMR/Learning_ROS_for_Robotics_Programming/e2acb65d439c013eecc27522a4e974595f00c18c/chapter8_tutorials/maps/map.pgm -------------------------------------------------------------------------------- /chapter8_tutorials/maps/map.yaml: -------------------------------------------------------------------------------- 1 | image: map.pgm 2 | resolution: 0.050000 3 | origin: [-100.000000, -100.000000, 0.000000] 4 | negate: 0 5 | occupied_thresh: 0.65 6 | free_thresh: 0.196 7 | 8 | -------------------------------------------------------------------------------- /chapter8_tutorials/src/sendGoals.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | typedef actionlib::SimpleActionClient MoveBaseClient; 8 | 9 | int main(int argc, char** argv){ 10 | ros::init(argc, argv, "navigation_goals"); 11 | 12 | MoveBaseClient ac("move_base", true); 13 | 14 | while(!ac.waitForServer(ros::Duration(5.0))){ 15 | ROS_INFO("Waiting for the move_base action server"); 16 | } 17 | 18 | move_base_msgs::MoveBaseGoal goal; 19 | 20 | goal.target_pose.header.frame_id = "map"; 21 | goal.target_pose.header.stamp = ros::Time::now(); 22 | 23 | goal.target_pose.pose.position.x = 1.0; 24 | goal.target_pose.pose.position.y = 1.0; 25 | goal.target_pose.pose.orientation.w = 1.0; 26 | 27 | ROS_INFO("Sending goal"); 28 | ac.sendGoal(goal); 29 | 30 | ac.waitForResult(); 31 | 32 | if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED) 33 | ROS_INFO("You have arrived to the goal position"); 34 | else{ 35 | ROS_INFO("The base failed for some reason"); 36 | } 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /chapter9_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | set(ROSPACK_MAKEDIST true) 5 | 6 | rosbuild_make_distribution(1.9.2) 7 | -------------------------------------------------------------------------------- /chapter9_tutorials/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake_stack.mk 2 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | #uncomment if you have defined messages 20 | #rosbuild_genmsg() 21 | #uncomment if you have defined services 22 | #rosbuild_gensrv() 23 | 24 | #common commands for building c++ executables and libraries 25 | #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) 26 | #target_link_libraries(${PROJECT_NAME} another_library) 27 | #rosbuild_add_boost_directories() 28 | #rosbuild_link_boost(${PROJECT_NAME} thread) 29 | #rosbuild_add_executable(example examples/example.cpp) 30 | #target_link_libraries(example ${PROJECT_NAME}) 31 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/launch/pr2_mapping.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/launch/pr2_navigation.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/launch/pr2_no_arms_empty_world.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/launch/pr2_no_arms_simple_world.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/launch/simple_world.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b pr2 6 | 7 | 10 | 11 | --> 12 | 13 | 14 | */ 15 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 9 tutorials (PR2). 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapter9_tutorials/pr2/worlds/models/simple/model.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Simple Room 5 | 1.0 6 | model-1_3.sdf 7 | model.sdf 8 | 9 | 10 | Enrique Fernández Perdomo 11 | enrique.fernandez.perdomo@gmail.com 12 | 13 | 14 | 15 | A model of a simple room. 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter9_tutorials/reem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.4.6) 2 | include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) 3 | 4 | # Set the build type. Options are: 5 | # Coverage : w/ debug symbols, w/o optimization, w/ code-coverage 6 | # Debug : w/ debug symbols, w/o optimization 7 | # Release : w/o debug symbols, w/ optimization 8 | # RelWithDebInfo : w/ debug symbols, w/ optimization 9 | # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries 10 | #set(ROS_BUILD_TYPE RelWithDebInfo) 11 | 12 | rosbuild_init() 13 | 14 | #set the default path for built executables to the "bin" directory 15 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) 16 | #set the default path for built libraries to the "lib" directory 17 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 18 | 19 | #uncomment if you have defined messages 20 | #rosbuild_genmsg() 21 | #uncomment if you have defined services 22 | #rosbuild_gensrv() 23 | 24 | #common commands for building c++ executables and libraries 25 | #rosbuild_add_library(${PROJECT_NAME} src/example.cpp) 26 | #target_link_libraries(${PROJECT_NAME} another_library) 27 | #rosbuild_add_boost_directories() 28 | #rosbuild_link_boost(${PROJECT_NAME} thread) 29 | #rosbuild_add_executable(example examples/example.cpp) 30 | #target_link_libraries(example ${PROJECT_NAME}) 31 | -------------------------------------------------------------------------------- /chapter9_tutorials/reem/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell rospack find mk)/cmake.mk -------------------------------------------------------------------------------- /chapter9_tutorials/reem/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \mainpage 3 | \htmlinclude manifest.html 4 | 5 | \b reem 6 | 7 | 10 | 11 | --> 12 | 13 | 14 | */ 15 | -------------------------------------------------------------------------------- /chapter9_tutorials/reem/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Chapter 9 tutorials (REEM). 4 | Learning ROS for Robotics Programming 5 | 6 | Aaron Martinez, Enrique Fernández 7 | GPL 8 | 9 | http://www.packtpub.com/learning-ros-for-robotics-programming/book 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapter9_tutorials/reem/scripts/environment/pal_ros_pkg_environment.sh: -------------------------------------------------------------------------------- 1 | # Gazebo - atlas_msgs; not required if drcsim is installed 2 | export GAZEBO_PLUGIN_PATH="`rospack find atlas_msgs`/lib:$GAZEBO_PLUGIN_PATH" 3 | export LD_LIBRARY_PATH="`rospack find atlas_msgs`/lib:$LD_LIBRARY_PATH" 4 | 5 | # Gazebo - PAL 6 | export GAZEBO_PLUGIN_PATH="`rospack find pal_gazebo_plugins`/lib:$GAZEBO_PLUGIN_PATH" 7 | export LD_LIBRARY_PATH="`rospack find pal_gazebo_plugins`/lib:$LD_LIBRARY_PATH" 8 | 9 | # Gazebo - REEM-H3 10 | export GAZEBO_MODEL_PATH="`rospack find reem_gazebo`/models:$GAZEBO_MODEL_PATH" 11 | export GAZEBO_RESOURCE_PATH="`rospack find reem_gazebo`/worlds:$GAZEBO_RESOURCE_PATH" 12 | 13 | -------------------------------------------------------------------------------- /chapter9_tutorials/reem/scripts/gazebo_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Setup packages.osrfoundation.org sources: 4 | sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu quantal main" > /etc/apt/sources.list.d/gazebo-latest.list' 5 | wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - 6 | 7 | # Instal gazebo: 8 | sudo apt-get update 9 | sudo apt-get install gazebo 10 | 11 | # Source setup.sh in .bashrc: 12 | echo "source /usr/share/gazebo/setup.sh" >> ~/.bashrc 13 | source ~/.bashrc 14 | 15 | -------------------------------------------------------------------------------- /chapter9_tutorials/reem/scripts/osrf_common_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Download osrf-common: 4 | cd $HOME/ros/stacks 5 | hg clone ssh://hg@bitbucket.org/osrf/osrf-common 6 | 7 | # Make and install osrf-common: 8 | cd osrf-common 9 | mkdir build 10 | cd build 11 | cmake .. 12 | make 13 | sudo make install 14 | 15 | -------------------------------------------------------------------------------- /chapter9_tutorials/reem/scripts/pal_ros_pkg_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install dependencies: 4 | ./gazebo_install.sh 5 | ./osrf_common_install.sh 6 | 7 | sudo apt-get install ros-groovy-pr2-simulator 8 | sudo apt-get install libglew-dev libdevil-dev 9 | 10 | # Set environment: 11 | roscd pal_install 12 | cd scripts 13 | cat environment/pal_ros_pkg_environment.sh >> ~/.bashrc 14 | 15 | # Create pal-ros-pkg dir: 16 | mkdir -p ~/ros/stacks/pal-ros-pkg 17 | cd ~/ros/stacks/pal-ros-pkg 18 | 19 | # Download repositories: 20 | rosinstall . https://raw.github.com/pal-robotics/pal-ros-pkg/master/pal-ros-pkg-gazebo-standalone.rosinstall 21 | 22 | # Update environment: 23 | rosstack profile && rospack profile 24 | source ~/.bashrc 25 | 26 | # Build everything (atlas_msgs not if drcsim install; move_arm not if ros-*-arm-experimental installed): 27 | stacks=(atlas_msgs pal_gazebo_plugins pal_image_processing perception_blort reem_arm_navigation reem_common reem_controllers reem_kinematics reem_msgs reem_robot reem_simulation) 28 | 29 | for stack in ${stacks[@]} 30 | do 31 | rosmake -i $stack 32 | done 33 | 34 | -------------------------------------------------------------------------------- /chapter9_tutorials/stack.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ROS Book. Chapter 9 tutorials. 5 | 6 | 7 | Maintained by Enrique Fernández and Aaron Martínez 8 | BSD 9 | 10 | http://ros.org 11 | 12 | 13 | 14 | --------------------------------------------------------------------------------