├── chapter_2_code └── README.txt ├── chapter_8_code ├── chefbot_bringup │ ├── param │ │ ├── joystick.yaml │ │ ├── .svn │ │ │ ├── text-base │ │ │ │ ├── joystick.yaml.svn-base │ │ │ │ ├── teleop.yaml.svn-base │ │ │ │ ├── global_costmap_params.yaml.svn-base │ │ │ │ ├── local_costmap_params.yaml.svn-base │ │ │ │ ├── costmap_common_params.yaml.svn-base │ │ │ │ ├── ardros.yaml.svn-base │ │ │ │ └── base_local_planner_params.yaml.svn-base │ │ │ ├── all-wcprops │ │ │ └── entries │ │ ├── serial.yaml │ │ ├── board_config.yaml │ │ ├── teleop.yaml │ │ ├── global_costmap_params.yaml │ │ ├── local_costmap_params.yaml │ │ ├── encoders.yaml │ │ ├── move_base_params.yaml │ │ ├── mux.yaml │ │ ├── base_local_planner_params.yaml │ │ ├── ardros.yaml │ │ ├── costmap_common_params.yaml │ │ └── dwa_local_planner_params.yaml │ ├── map │ │ ├── hotel1.pgm │ │ └── hotel1.yaml │ ├── scripts │ │ ├── SerialDataGateway.pyc │ │ ├── simple_navig_goals.py │ │ ├── SerialDataGateway.py │ │ └── twist_to_motors.py │ ├── launch │ │ ├── view_navigation.launch │ │ ├── view_robot.launch │ │ ├── keyboard_teleop.launch │ │ ├── gmapping_demo.launch │ │ ├── includes │ │ │ ├── safety_controller.launch.xml │ │ │ ├── velocity_smoother.launch.xml │ │ │ ├── move_base.launch.xml │ │ │ ├── move_base.launch.xml~ │ │ │ ├── gmapping.launch.xml │ │ │ ├── gmapping.launch.xml~ │ │ │ └── amcl.launch.xml │ │ ├── model_robot.launch │ │ ├── amcl_demo.launch │ │ ├── robot_standalone.launch │ │ └── 3dsensor_astra.launch │ ├── src │ │ └── send_robot_goal.cpp │ └── package.xml ├── chefbot_gazebo │ ├── maps │ │ ├── hotel.pgm │ │ └── hotel.yaml │ ├── launch │ │ ├── gmapping_demo.launch │ │ ├── keyboard_teleop.launch │ │ ├── includes │ │ │ ├── safety_controller.launch.xml │ │ │ ├── velocity_smoother.launch.xml │ │ │ ├── move_base.launch.xml │ │ │ ├── gmapping.launch.xml │ │ │ └── amcl.launch.xml │ │ ├── amcl_demo.launch │ │ ├── chefbot_empty_world.launch │ │ └── chefbot_hotel_world.launch │ ├── param │ │ ├── global_costmap_params.yaml │ │ ├── local_costmap_params.yaml │ │ ├── move_base_params.yaml │ │ ├── base_local_planner_params.yaml │ │ ├── costmap_common_params.yaml │ │ └── dwa_local_planner_params.yaml │ └── package.xml └── chefbot_description │ ├── meshes │ └── astra.jpg │ ├── launch │ ├── upload_model.launch │ ├── view_model.launch │ ├── view_robot.launch │ ├── view_navigation.launch │ └── view_robot_gazebo.launch │ ├── CMakeLists.txt │ ├── package.xml │ └── urdf │ └── common_properties.xacro ├── chapter_9_code └── chefbot_bringup │ ├── param │ ├── joystick.yaml │ ├── .svn │ │ ├── text-base │ │ │ ├── joystick.yaml.svn-base │ │ │ ├── teleop.yaml.svn-base │ │ │ ├── global_costmap_params.yaml.svn-base │ │ │ ├── local_costmap_params.yaml.svn-base │ │ │ ├── costmap_common_params.yaml.svn-base │ │ │ ├── ardros.yaml.svn-base │ │ │ └── base_local_planner_params.yaml.svn-base │ │ ├── all-wcprops │ │ └── entries │ ├── serial.yaml │ ├── board_config.yaml │ ├── teleop.yaml │ ├── global_costmap_params.yaml │ ├── local_costmap_params.yaml │ ├── encoders.yaml │ ├── move_base_params.yaml │ ├── mux.yaml │ ├── base_local_planner_params.yaml │ ├── ardros.yaml │ ├── costmap_common_params.yaml │ └── dwa_local_planner_params.yaml │ ├── map │ ├── hotel1.pgm │ └── hotel1.yaml │ ├── scripts │ ├── SerialDataGateway.pyc │ ├── simple_navig_goals.py │ └── SerialDataGateway.py │ ├── launch │ ├── view_navigation.launch │ ├── view_robot.launch │ ├── keyboard_teleop.launch │ ├── gmapping_demo.launch │ ├── includes │ │ ├── safety_controller.launch.xml │ │ ├── velocity_smoother.launch.xml │ │ ├── move_base.launch.xml │ │ ├── move_base.launch.xml~ │ │ ├── gmapping.launch.xml │ │ ├── gmapping.launch.xml~ │ │ └── amcl.launch.xml │ ├── model_robot.launch │ ├── amcl_demo.launch │ ├── robot_standalone.launch │ └── 3dsensor_astra.launch │ ├── src │ └── send_robot_goal.cpp │ └── package.xml ├── chapter_7_code ├── robot.png ├── img_read.py ├── cam.py └── sample_opencv_pkg │ └── package.xml ├── chapter_3_code ├── FINAL_IN_WINDOWS.blend └── chefbot_description │ ├── meshes │ └── astra.jpg │ ├── launch │ ├── upload_model.launch │ ├── view_model.launch │ ├── view_robot.launch │ ├── view_navigation.launch │ └── view_robot_gazebo.launch │ ├── CMakeLists.txt │ ├── package.xml │ └── urdf │ └── common_properties.xacro ├── chapter_6_code ├── code_sensor │ ├── HC-SR04.fzpz │ ├── python_script │ │ └── read_ultr.py │ ├── 7536OS_06_02.ino │ ├── IMU │ │ └── IMU.ino │ ├── test_imu │ │ └── test_imu.ino │ ├── hc_sr04.ino │ ├── 7536OS_06_01.ino │ ├── 7536OS_06_03.ino │ ├── ultrasonic_sensor │ │ └── ultrasonic_sensor.ino │ └── new_robot_code_with_sensors │ │ └── new_robot_code_with_sensors.ino └── code_motor │ ├── dynamixel_test_code.py │ ├── simple_encoder_test.ino │ ├── motor_test │ └── motor_test.ino │ ├── encoder_test_stellaris_test │ ├── encoder_test_stellaris_test.ino │ └── motor_test │ │ └── motor_test.ino │ ├── simple_motor_test │ └── simple_motor_test.ino ├── chapter_4_code ├── chefbot_gazebo │ ├── maps │ │ ├── hotel.pgm │ │ └── hotel.yaml │ ├── launch │ │ ├── gmapping_demo.launch │ │ ├── keyboard_teleop.launch │ │ ├── amcl_demo.launch │ │ ├── includes │ │ │ ├── move_base.launch.xml │ │ │ ├── gmapping.launch.xml │ │ │ └── amcl.launch.xml │ │ ├── chefbot_empty_world.launch │ │ └── chefbot_hotel_world.launch │ ├── param │ │ ├── global_costmap_params.yaml │ │ ├── local_costmap_params.yaml │ │ ├── move_base_params.yaml │ │ ├── base_local_planner_params.yaml │ │ ├── costmap_common_params.yaml │ │ └── dwa_local_planner_params.yaml │ └── package.xml └── chefbot_description │ ├── meshes │ └── astra.jpg │ ├── launch │ ├── upload_model.launch │ ├── view_model.launch │ ├── view_robot.launch │ ├── view_navigation.launch │ └── view_robot_gazebo.launch │ ├── CMakeLists.txt │ ├── package.xml │ └── urdf │ └── common_properties.xacro ├── chapter_1_code └── hello_world │ ├── scripts │ ├── hello_world_publisher.py │ └── hello_world_subscriber.py │ └── package.xml └── LICENSE /chapter_2_code/README.txt: -------------------------------------------------------------------------------- 1 | No code 2 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/joystick.yaml: -------------------------------------------------------------------------------- 1 | dev: /dev/input/js0 2 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/joystick.yaml: -------------------------------------------------------------------------------- 1 | dev: /dev/input/js0 2 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/text-base/joystick.yaml.svn-base: -------------------------------------------------------------------------------- 1 | dev: /dev/input/js0 2 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/text-base/joystick.yaml.svn-base: -------------------------------------------------------------------------------- 1 | dev: /dev/input/js0 2 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/serial.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | baudRate: 115200 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/serial.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | baudRate: 115200 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /chapter_7_code/robot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_7_code/robot.png -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/board_config.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | #port: /dev/ttyUSB0 3 | baudRate: 115200 4 | 5 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/board_config.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | #port: /dev/ttyUSB0 3 | baudRate: 115200 4 | 5 | -------------------------------------------------------------------------------- /chapter_3_code/FINAL_IN_WINDOWS.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_3_code/FINAL_IN_WINDOWS.blend -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/HC-SR04.fzpz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_6_code/code_sensor/HC-SR04.fzpz -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/teleop.yaml: -------------------------------------------------------------------------------- 1 | linearAxisIndex: 3 2 | angularAxisIndex: 2 3 | linearScalingFactor: 0.4 4 | angularScalingFactor: 0.5 5 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/teleop.yaml: -------------------------------------------------------------------------------- 1 | linearAxisIndex: 3 2 | angularAxisIndex: 2 3 | linearScalingFactor: 0.4 4 | angularScalingFactor: 0.5 5 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/maps/hotel.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_4_code/chefbot_gazebo/maps/hotel.pgm -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/map/hotel1.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_8_code/chefbot_bringup/map/hotel1.pgm -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/maps/hotel.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_8_code/chefbot_gazebo/maps/hotel.pgm -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/map/hotel1.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_9_code/chefbot_bringup/map/hotel1.pgm -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/gmapping_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/gmapping_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/meshes/astra.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_3_code/chefbot_description/meshes/astra.jpg -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/meshes/astra.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_4_code/chefbot_description/meshes/astra.jpg -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/text-base/teleop.yaml.svn-base: -------------------------------------------------------------------------------- 1 | linearAxisIndex: 3 2 | angularAxisIndex: 2 3 | linearScalingFactor: 0.4 4 | angularScalingFactor: 0.5 5 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/meshes/astra.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_8_code/chefbot_description/meshes/astra.jpg -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/text-base/teleop.yaml.svn-base: -------------------------------------------------------------------------------- 1 | linearAxisIndex: 3 2 | angularAxisIndex: 2 3 | linearScalingFactor: 0.4 4 | angularScalingFactor: 0.5 5 | -------------------------------------------------------------------------------- /chapter_7_code/img_read.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | 4 | img = cv2.imread("robot.png",0) 5 | cv2.imshow('image',img) 6 | cv2.waitKey(0) 7 | cv2.destroyAllWindows() 8 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/scripts/SerialDataGateway.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_8_code/chefbot_bringup/scripts/SerialDataGateway.pyc -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/scripts/SerialDataGateway.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qboticslabs/learning_robotics_2nd_ed/HEAD/chapter_9_code/chefbot_bringup/scripts/SerialDataGateway.pyc -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/maps/hotel.yaml: -------------------------------------------------------------------------------- 1 | image: hotel.pgm 2 | resolution: 0.010000 3 | origin: [-11.240000, -11.240000, 0.000000] 4 | negate: 0 5 | occupied_thresh: 0.65 6 | free_thresh: 0.196 7 | 8 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/maps/hotel.yaml: -------------------------------------------------------------------------------- 1 | image: hotel.pgm 2 | resolution: 0.010000 3 | origin: [-11.240000, -11.240000, 0.000000] 4 | negate: 0 5 | occupied_thresh: 0.65 6 | free_thresh: 0.196 7 | 8 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/map/hotel1.yaml: -------------------------------------------------------------------------------- 1 | image: /home/lentin/hotel1.pgm 2 | resolution: 0.050000 3 | origin: [-12.200000, -12.200000, 0.000000] 4 | negate: 0 5 | occupied_thresh: 0.65 6 | free_thresh: 0.196 7 | 8 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/map/hotel1.yaml: -------------------------------------------------------------------------------- 1 | image: /home/lentin/hotel1.pgm 2 | resolution: 0.050000 3 | origin: [-12.200000, -12.200000, 0.000000] 4 | negate: 0 5 | occupied_thresh: 0.65 6 | free_thresh: 0.196 7 | 8 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/launch/upload_model.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/launch/upload_model.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/launch/upload_model.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/param/global_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | global_costmap: 2 | global_frame: /map 3 | robot_base_frame: /base_footprint 4 | update_frequency: 1.0 5 | publish_frequency: 0.5 6 | static_map: true 7 | transform_tolerance: 0.5 8 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/global_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | global_costmap: 2 | global_frame: /map 3 | robot_base_frame: /base_footprint 4 | update_frequency: 1.0 5 | publish_frequency: 0.5 6 | static_map: true 7 | transform_tolerance: 0.5 8 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/param/global_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | global_costmap: 2 | global_frame: /map 3 | robot_base_frame: /base_footprint 4 | update_frequency: 1.0 5 | publish_frequency: 0.5 6 | static_map: true 7 | transform_tolerance: 0.5 8 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/global_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | global_costmap: 2 | global_frame: /map 3 | robot_base_frame: /base_footprint 4 | update_frequency: 1.0 5 | publish_frequency: 0.5 6 | static_map: true 7 | transform_tolerance: 0.5 8 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/view_navigation.launch: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/text-base/global_costmap_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | global_costmap: 2 | global_frame: /map 3 | robot_base_frame: base_link 4 | update_frequency: 2.0 5 | static_map: true 6 | 7 | transform_tolerance: 0.5 # seconds 8 | publish_frequency: 1.0 9 | 10 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/view_navigation.launch: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/text-base/global_costmap_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | global_costmap: 2 | global_frame: /map 3 | robot_base_frame: base_link 4 | update_frequency: 2.0 5 | static_map: true 6 | 7 | transform_tolerance: 0.5 # seconds 8 | publish_frequency: 1.0 9 | 10 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(chefbot_description) 3 | 4 | 5 | find_package(catkin REQUIRED COMPONENTS 6 | urdf 7 | xacro 8 | ) 9 | 10 | 11 | catkin_package() 12 | 13 | 14 | include_directories( 15 | # include 16 | ${catkin_INCLUDE_DIRS} 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(chefbot_description) 3 | 4 | 5 | find_package(catkin REQUIRED COMPONENTS 6 | urdf 7 | xacro 8 | ) 9 | 10 | 11 | catkin_package() 12 | 13 | 14 | include_directories( 15 | # include 16 | ${catkin_INCLUDE_DIRS} 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(chefbot_description) 3 | 4 | 5 | find_package(catkin REQUIRED COMPONENTS 6 | urdf 7 | xacro 8 | ) 9 | 10 | 11 | catkin_package() 12 | 13 | 14 | include_directories( 15 | # include 16 | ${catkin_INCLUDE_DIRS} 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/view_robot.launch: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/view_robot.launch: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/param/local_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | local_costmap: 2 | global_frame: odom 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: 4.0 9 | height: 4.0 10 | resolution: 0.05 11 | transform_tolerance: 0.5 12 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/local_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | local_costmap: 2 | global_frame: odom 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: 4.0 9 | height: 4.0 10 | resolution: 0.05 11 | transform_tolerance: 0.5 12 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/param/local_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | local_costmap: 2 | global_frame: odom 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: 4.0 9 | height: 4.0 10 | resolution: 0.05 11 | transform_tolerance: 0.5 12 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/local_costmap_params.yaml: -------------------------------------------------------------------------------- 1 | local_costmap: 2 | global_frame: odom 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: 4.0 9 | height: 4.0 10 | resolution: 0.05 11 | transform_tolerance: 0.5 12 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/text-base/local_costmap_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | local_costmap: 2 | global_frame: /odom 3 | robot_base_frame: /base_link 4 | update_frequency: 5.0 5 | publish_frequency: 2.0 6 | static_map: false 7 | rolling_window: true 8 | width: 4.0 9 | height: 4.0 10 | # origin_x: -0.115 11 | resolution: 0.05 12 | transform_tolerance: 0.5 # seconds 13 | 14 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/text-base/local_costmap_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | local_costmap: 2 | global_frame: /odom 3 | robot_base_frame: /base_link 4 | update_frequency: 5.0 5 | publish_frequency: 2.0 6 | static_map: false 7 | rolling_window: true 8 | width: 4.0 9 | height: 4.0 10 | # origin_x: -0.115 11 | resolution: 0.05 12 | transform_tolerance: 0.5 # seconds 13 | 14 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/python_script/read_ultr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import serial 4 | import sys 5 | 6 | 7 | try: 8 | ser = serial.Serial('/dev/ttyACM0',115200) 9 | 10 | 11 | except: 12 | print "Unable to open serial port" 13 | 14 | while True: 15 | 16 | try: 17 | line = ser.readline() 18 | print line 19 | except: 20 | print "Unable to read from device" 21 | 22 | sys.exit(0) 23 | 24 | 25 | -------------------------------------------------------------------------------- /chapter_7_code/cam.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | cap = cv2.VideoCapture(0) 4 | 5 | while(True): 6 | # Capture frame-by-frame 7 | ret, frame = cap.read() 8 | # Display the resulting frame 9 | cv2.imshow('frame',frame) 10 | k = cv2.waitKey(30) 11 | if k == 27: 12 | break 13 | # When everything done, release the capture 14 | cap.release() 15 | cv2.destroyAllWindows() 16 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/param/move_base_params.yaml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # http://www.ros.org/wiki/move_base 4 | # 5 | shutdown_costmaps: false 6 | 7 | controller_frequency: 5.0 8 | controller_patience: 3.0 9 | 10 | planner_frequency: 1.0 11 | planner_patience: 5.0 12 | 13 | oscillation_timeout: 10.0 14 | oscillation_distance: 0.2 15 | 16 | # local planner - default is trajectory rollout 17 | base_local_planner: "dwa_local_planner/DWAPlannerROS" 18 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/param/move_base_params.yaml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # http://www.ros.org/wiki/move_base 4 | # 5 | shutdown_costmaps: false 6 | 7 | controller_frequency: 5.0 8 | controller_patience: 3.0 9 | 10 | planner_frequency: 1.0 11 | planner_patience: 5.0 12 | 13 | oscillation_timeout: 10.0 14 | oscillation_distance: 0.2 15 | 16 | # local planner - default is trajectory rollout 17 | base_local_planner: "dwa_local_planner/DWAPlannerROS" 18 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/keyboard_teleop.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/keyboard_teleop.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/launch/view_model.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/launch/view_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/launch/view_model.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/launch/view_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/launch/view_model.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/launch/view_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/launch/view_navigation.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/launch/view_navigation.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/encoders.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyUSB1 2 | baudRate: 115200 3 | # trackwidth [m], distancePerCount [m] 4 | # http://learn.parallax.com/activitybot/calculating-angles-rotation 5 | # Distance Per Tick for Arlo: http://forums.parallax.com/showthread.php/154274-The-quot-Artist-quot-robot?p=1271544&viewfull=1#post1271544 6 | # Track Width for Arlo is from measurement and then testing 7 | #driveGeometry: {trackWidth: 0.403, distancePerCount: 0.00676} 8 | driveGeometry: {trackWidth: 0.3, distancePerCount: 0.00676} 9 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/launch/view_navigation.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/encoders.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyUSB1 2 | baudRate: 115200 3 | # trackwidth [m], distancePerCount [m] 4 | # http://learn.parallax.com/activitybot/calculating-angles-rotation 5 | # Distance Per Tick for Arlo: http://forums.parallax.com/showthread.php/154274-The-quot-Artist-quot-robot?p=1271544&viewfull=1#post1271544 6 | # Track Width for Arlo is from measurement and then testing 7 | #driveGeometry: {trackWidth: 0.403, distancePerCount: 0.00676} 8 | driveGeometry: {trackWidth: 0.3, distancePerCount: 0.00676} 9 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/keyboard_teleop.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/move_base_params.yaml: -------------------------------------------------------------------------------- 1 | # Move base node parameters. For full documentation of the parameters in this file, please see 2 | # 3 | # http://www.ros.org/wiki/move_base 4 | # 5 | shutdown_costmaps: false 6 | 7 | controller_frequency: 5.0 8 | controller_patience: 3.0 9 | 10 | planner_frequency: 1.0 11 | planner_patience: 5.0 12 | 13 | oscillation_timeout: 10.0 14 | oscillation_distance: 0.2 15 | 16 | # local planner - default is trajectory rollout 17 | base_local_planner: "dwa_local_planner/DWAPlannerROS" 18 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/keyboard_teleop.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/move_base_params.yaml: -------------------------------------------------------------------------------- 1 | # Move base node parameters. For full documentation of the parameters in this file, please see 2 | # 3 | # http://www.ros.org/wiki/move_base 4 | # 5 | shutdown_costmaps: false 6 | 7 | controller_frequency: 5.0 8 | controller_patience: 3.0 9 | 10 | planner_frequency: 1.0 11 | planner_patience: 5.0 12 | 13 | oscillation_timeout: 10.0 14 | oscillation_distance: 0.2 15 | 16 | # local planner - default is trajectory rollout 17 | base_local_planner: "dwa_local_planner/DWAPlannerROS" 18 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chefbot_description 4 | 0.0.1 5 | The chefbot_description package 6 | 7 | 8 | Lentin Joseph 9 | 10 | BSD 11 | 12 | 13 | catkin 14 | xacro 15 | xacro 16 | xacro 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chefbot_description 4 | 0.0.1 5 | The chefbot_description package 6 | 7 | 8 | Lentin Joseph 9 | 10 | BSD 11 | 12 | 13 | catkin 14 | xacro 15 | xacro 16 | xacro 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chefbot_description 4 | 0.0.1 5 | The chefbot_description package 6 | 7 | 8 | Lentin Joseph 9 | 10 | BSD 11 | 12 | 13 | catkin 14 | xacro 15 | xacro 16 | xacro 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/gmapping_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/gmapping_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapter_1_code/hello_world/scripts/hello_world_publisher.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # license removed for brevity 3 | import rospy 4 | from std_msgs.msg import String 5 | 6 | def talker(): 7 | pub = rospy.Publisher('hello_pub', String, queue_size=10) 8 | rospy.init_node('hello_world_publisher', anonymous=True) 9 | r = rospy.Rate(10) # 10hz 10 | while not rospy.is_shutdown(): 11 | str = "hello world %s"%rospy.get_time() 12 | rospy.loginfo(str) 13 | pub.publish(str) 14 | r.sleep() 15 | 16 | if __name__ == '__main__': 17 | try: 18 | talker() 19 | except rospy.ROSInterruptException: pass 20 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/includes/safety_controller.launch.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/includes/safety_controller.launch.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/includes/safety_controller.launch.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/7536OS_06_02.ino: -------------------------------------------------------------------------------- 1 | 2 | int IR_SENSOR = 18; // Sensor is connected to the analog A3 3 | int intSensorResult = 0; //Sensor result 4 | float fltSensorCalc = 0; //Calculated value 5 | 6 | 7 | void setup() 8 | { 9 | Serial.begin(115200); // Setup communication with computer to present results serial monitor 10 | } 11 | 12 | 13 | void loop() 14 | { 15 | // read the value from the ir sensor 16 | 17 | 18 | intSensorResult = analogRead(IR_SENSOR); //Get sensor value 19 | fltSensorCalc = (6787.0 / (intSensorResult - 3.0)) - 4.0; //Calculate distance in cm 20 | 21 | 22 | Serial.print(fltSensorCalc); //Send distance to computer 23 | Serial.println(" cm"); //Add cm to result 24 | delay(200); //Wait 25 | } 26 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/includes/velocity_smoother.launch.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/includes/velocity_smoother.launch.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/includes/velocity_smoother.launch.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/model_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/model_robot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/text-base/costmap_common_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | # for details see: http://www.ros.org/wiki/navigation/Tutorials/RobotSetup 2 | 3 | obstacle_range: 2.5 4 | raytrace_range: 3.0 5 | footprint: [[0.265, 0.278], [0.04, 0.193], [-0.04, 0.193], [-0.282, 0.178], [-0.282, -0.178], [-0.04, -0.193], [0.04, -0.193], [0.265, -0.278]] 6 | #footprint: [[0.075, 0.178], [0.04, 0.193], [-0.04, 0.193], [-0.282, 0.178], [-0.282, -0.178], [-0.04, -0.193], [0.04, -0.193], [0.075, -0.178]] 7 | #robot_radius: ir_of_robot 8 | inflation_radius: 0.4 9 | 10 | observation_sources: laser_scan_sensor 11 | 12 | laser_scan_sensor: {sensor_frame: openni_depth_frame, data_type: LaserScan, topic: scan, marking: true, clearing: true} 13 | 14 | map_type: costmap 15 | transform_tolerance: 0.4 # seconds 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/text-base/costmap_common_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | # for details see: http://www.ros.org/wiki/navigation/Tutorials/RobotSetup 2 | 3 | obstacle_range: 2.5 4 | raytrace_range: 3.0 5 | footprint: [[0.265, 0.278], [0.04, 0.193], [-0.04, 0.193], [-0.282, 0.178], [-0.282, -0.178], [-0.04, -0.193], [0.04, -0.193], [0.265, -0.278]] 6 | #footprint: [[0.075, 0.178], [0.04, 0.193], [-0.04, 0.193], [-0.282, 0.178], [-0.282, -0.178], [-0.04, -0.193], [0.04, -0.193], [0.075, -0.178]] 7 | #robot_radius: ir_of_robot 8 | inflation_radius: 0.4 9 | 10 | observation_sources: laser_scan_sensor 11 | 12 | laser_scan_sensor: {sensor_frame: openni_depth_frame, data_type: LaserScan, topic: scan, marking: true, clearing: true} 13 | 14 | map_type: costmap 15 | transform_tolerance: 0.4 # seconds 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter_1_code/hello_world/scripts/hello_world_subscriber.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import rospy 3 | from std_msgs.msg import String 4 | 5 | def callback(data): 6 | rospy.loginfo(rospy.get_caller_id()+"I heard %s",data.data) 7 | 8 | def listener(): 9 | 10 | # in ROS, nodes are unique named. If two nodes with the same 11 | # node are launched, the previous one is kicked off. The 12 | # anonymous=True flag means that rospy will choose a unique 13 | # name for our 'listener' node so that multiple listeners can 14 | # run simultaenously. 15 | rospy.init_node('hello_world_subscriber', anonymous=True) 16 | 17 | rospy.Subscriber("hello_pub", String, callback) 18 | 19 | # spin() simply keeps python from exiting until this node is stopped 20 | rospy.spin() 21 | 22 | if __name__ == '__main__': 23 | listener() 24 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/amcl_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/amcl_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/mux.yaml: -------------------------------------------------------------------------------- 1 | # Created on: Oct 29, 2012 2 | # Author: jorge 3 | # Configuration for subscribers to multiple cmd_vel sources. 4 | # 5 | # Individual subscriber configuration: 6 | # name: Source name 7 | # topic: The topic that provides cmd_vel messages 8 | # timeout: Time in seconds without incoming messages to consider this topic inactive 9 | # priority: Priority: an UNIQUE unsigned integer from 0 (lowest) to MAX_INT 10 | # short_desc: Short description (optional) 11 | 12 | subscribers: 13 | - name: "Safe reactive controller" 14 | topic: "input/safety_controller" 15 | timeout: 0.2 16 | priority: 10 17 | - name: "Teleoperation" 18 | topic: "input/teleop" 19 | timeout: 1.0 20 | priority: 7 21 | - name: "Navigation" 22 | topic: "input/navi" 23 | timeout: 1.0 24 | priority: 5 25 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/mux.yaml: -------------------------------------------------------------------------------- 1 | # Created on: Oct 29, 2012 2 | # Author: jorge 3 | # Configuration for subscribers to multiple cmd_vel sources. 4 | # 5 | # Individual subscriber configuration: 6 | # name: Source name 7 | # topic: The topic that provides cmd_vel messages 8 | # timeout: Time in seconds without incoming messages to consider this topic inactive 9 | # priority: Priority: an UNIQUE unsigned integer from 0 (lowest) to MAX_INT 10 | # short_desc: Short description (optional) 11 | 12 | subscribers: 13 | - name: "Safe reactive controller" 14 | topic: "input/safety_controller" 15 | timeout: 0.2 16 | priority: 10 17 | - name: "Teleoperation" 18 | topic: "input/teleop" 19 | timeout: 1.0 20 | priority: 7 21 | - name: "Navigation" 22 | topic: "input/navi" 23 | timeout: 1.0 24 | priority: 5 25 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/param/base_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | TrajectoryPlannerROS: 2 | 3 | # Robot Configuration Parameters 4 | max_vel_x: 0.3 5 | min_vel_x: 0.1 6 | 7 | max_vel_theta: 1.0 8 | min_vel_theta: -1.0 9 | min_in_place_vel_theta: 0.6 10 | 11 | acc_lim_x: 0.5 12 | acc_lim_theta: 1.0 13 | 14 | # Goal Tolerance Parameters 15 | yaw_goal_tolerance: 0.3 16 | xy_goal_tolerance: 0.15 17 | 18 | # Forward Simulation Parameters 19 | sim_time: 3.0 20 | vx_samples: 6 21 | vtheta_samples: 20 22 | 23 | # Trajectory Scoring Parameters 24 | meter_scoring: true 25 | pdist_scale: 0.6 26 | gdist_scale: 0.8 27 | occdist_scale: 0.01 28 | heading_lookahead: 0.325 29 | dwa: true 30 | 31 | # Oscillation Prevention Parameters 32 | oscillation_reset_dist: 0.05 33 | 34 | # Differential-drive robot configuration 35 | holonomic_robot: false 36 | max_vel_y: 0.0 37 | min_vel_y: 0.0 38 | acc_lim_y: 0.0 39 | vy_samples: 1 40 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/base_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | TrajectoryPlannerROS: 2 | 3 | # Robot Configuration Parameters 4 | max_vel_x: 0.3 5 | min_vel_x: 0.1 6 | 7 | max_vel_theta: 1.0 8 | min_vel_theta: -1.0 9 | min_in_place_vel_theta: 0.6 10 | 11 | acc_lim_x: 0.5 12 | acc_lim_theta: 1.0 13 | 14 | # Goal Tolerance Parameters 15 | yaw_goal_tolerance: 0.3 16 | xy_goal_tolerance: 0.15 17 | 18 | # Forward Simulation Parameters 19 | sim_time: 3.0 20 | vx_samples: 6 21 | vtheta_samples: 20 22 | 23 | # Trajectory Scoring Parameters 24 | meter_scoring: true 25 | pdist_scale: 0.6 26 | gdist_scale: 0.8 27 | occdist_scale: 0.01 28 | heading_lookahead: 0.325 29 | dwa: true 30 | 31 | # Oscillation Prevention Parameters 32 | oscillation_reset_dist: 0.05 33 | 34 | # Differential-drive robot configuration 35 | holonomic_robot: false 36 | max_vel_y: 0.0 37 | min_vel_y: 0.0 38 | acc_lim_y: 0.0 39 | vy_samples: 1 40 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/param/base_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | TrajectoryPlannerROS: 2 | 3 | # Robot Configuration Parameters 4 | max_vel_x: 0.3 5 | min_vel_x: 0.1 6 | 7 | max_vel_theta: 1.0 8 | min_vel_theta: -1.0 9 | min_in_place_vel_theta: 0.6 10 | 11 | acc_lim_x: 0.5 12 | acc_lim_theta: 1.0 13 | 14 | # Goal Tolerance Parameters 15 | yaw_goal_tolerance: 0.3 16 | xy_goal_tolerance: 0.15 17 | 18 | # Forward Simulation Parameters 19 | sim_time: 3.0 20 | vx_samples: 6 21 | vtheta_samples: 20 22 | 23 | # Trajectory Scoring Parameters 24 | meter_scoring: true 25 | pdist_scale: 0.6 26 | gdist_scale: 0.8 27 | occdist_scale: 0.01 28 | heading_lookahead: 0.325 29 | dwa: true 30 | 31 | # Oscillation Prevention Parameters 32 | oscillation_reset_dist: 0.05 33 | 34 | # Differential-drive robot configuration 35 | holonomic_robot: false 36 | max_vel_y: 0.0 37 | min_vel_y: 0.0 38 | acc_lim_y: 0.0 39 | vy_samples: 1 40 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/base_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | TrajectoryPlannerROS: 2 | 3 | # Robot Configuration Parameters 4 | max_vel_x: 0.3 5 | min_vel_x: 0.1 6 | 7 | max_vel_theta: 1.0 8 | min_vel_theta: -1.0 9 | min_in_place_vel_theta: 0.6 10 | 11 | acc_lim_x: 0.5 12 | acc_lim_theta: 1.0 13 | 14 | # Goal Tolerance Parameters 15 | yaw_goal_tolerance: 0.3 16 | xy_goal_tolerance: 0.15 17 | 18 | # Forward Simulation Parameters 19 | sim_time: 3.0 20 | vx_samples: 6 21 | vtheta_samples: 20 22 | 23 | # Trajectory Scoring Parameters 24 | meter_scoring: true 25 | pdist_scale: 0.6 26 | gdist_scale: 0.8 27 | occdist_scale: 0.01 28 | heading_lookahead: 0.325 29 | dwa: true 30 | 31 | # Oscillation Prevention Parameters 32 | oscillation_reset_dist: 0.05 33 | 34 | # Differential-drive robot configuration 35 | holonomic_robot: false 36 | max_vel_y: 0.0 37 | min_vel_y: 0.0 38 | acc_lim_y: 0.0 39 | vy_samples: 1 40 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/includes/move_base.launch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/includes/move_base.launch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/includes/move_base.launch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/includes/move_base.launch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 39 4 | /svn/!svn/ver/107/trunk/ros/ardros/info 5 | END 6 | global_costmap_params.yaml 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 66 10 | /svn/!svn/ver/105/trunk/ros/ardros/info/global_costmap_params.yaml 11 | END 12 | ardros.yaml 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 51 16 | /svn/!svn/ver/105/trunk/ros/ardros/info/ardros.yaml 17 | END 18 | joystick.yaml 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 52 22 | /svn/!svn/ver/54/trunk/ros/ardros/info/joystick.yaml 23 | END 24 | costmap_common_params.yaml 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 66 28 | /svn/!svn/ver/107/trunk/ros/ardros/info/costmap_common_params.yaml 29 | END 30 | local_costmap_params.yaml 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 65 34 | /svn/!svn/ver/105/trunk/ros/ardros/info/local_costmap_params.yaml 35 | END 36 | base_local_planner_params.yaml 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 70 40 | /svn/!svn/ver/107/trunk/ros/ardros/info/base_local_planner_params.yaml 41 | END 42 | teleop.yaml 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 50 46 | /svn/!svn/ver/54/trunk/ros/ardros/info/teleop.yaml 47 | END 48 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 39 4 | /svn/!svn/ver/107/trunk/ros/ardros/info 5 | END 6 | global_costmap_params.yaml 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 66 10 | /svn/!svn/ver/105/trunk/ros/ardros/info/global_costmap_params.yaml 11 | END 12 | ardros.yaml 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 51 16 | /svn/!svn/ver/105/trunk/ros/ardros/info/ardros.yaml 17 | END 18 | joystick.yaml 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 52 22 | /svn/!svn/ver/54/trunk/ros/ardros/info/joystick.yaml 23 | END 24 | costmap_common_params.yaml 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 66 28 | /svn/!svn/ver/107/trunk/ros/ardros/info/costmap_common_params.yaml 29 | END 30 | local_costmap_params.yaml 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 65 34 | /svn/!svn/ver/105/trunk/ros/ardros/info/local_costmap_params.yaml 35 | END 36 | base_local_planner_params.yaml 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 70 40 | /svn/!svn/ver/107/trunk/ros/ardros/info/base_local_planner_params.yaml 41 | END 42 | teleop.yaml 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 50 46 | /svn/!svn/ver/54/trunk/ros/ardros/info/teleop.yaml 47 | END 48 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/scripts/simple_navig_goals.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import rospy 4 | import actionlib 5 | 6 | import sys 7 | 8 | #move_base_msgs 9 | from move_base_msgs.msg import * 10 | 11 | def simple_move(x,w): 12 | 13 | rospy.init_node('simple_move') 14 | 15 | #Simple Action Client 16 | sac = actionlib.SimpleActionClient('move_base', MoveBaseAction ) 17 | 18 | #create goal 19 | goal = MoveBaseGoal() 20 | 21 | #use self? 22 | #set goal 23 | 24 | rospy.loginfo("Set X = "+x) 25 | rospy.loginfo("Set W = "+w) 26 | 27 | goal.target_pose.pose.position.x = float(x) 28 | goal.target_pose.pose.orientation.w = float(w) 29 | goal.target_pose.header.frame_id = 'first_move' 30 | goal.target_pose.header.stamp = rospy.Time.now() 31 | 32 | #start listner 33 | rospy.loginfo("Waiting for server") 34 | 35 | sac.wait_for_server() 36 | 37 | 38 | rospy.loginfo("Sending Goals") 39 | 40 | #send goal 41 | 42 | sac.send_goal(goal) 43 | rospy.loginfo("Waiting for server") 44 | 45 | #finish 46 | sac.wait_for_result() 47 | 48 | #print result 49 | print sac.get_result() 50 | 51 | 52 | if __name__ == '__main__': 53 | try: 54 | simple_move(sys.argv[1],sys.argv[2]) 55 | except rospy.ROSInterruptException: 56 | print "Keyboard Interrupt" 57 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/scripts/simple_navig_goals.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import rospy 4 | import actionlib 5 | 6 | import sys 7 | 8 | #move_base_msgs 9 | from move_base_msgs.msg import * 10 | 11 | def simple_move(x,w): 12 | 13 | rospy.init_node('simple_move') 14 | 15 | #Simple Action Client 16 | sac = actionlib.SimpleActionClient('move_base', MoveBaseAction ) 17 | 18 | #create goal 19 | goal = MoveBaseGoal() 20 | 21 | #use self? 22 | #set goal 23 | 24 | rospy.loginfo("Set X = "+x) 25 | rospy.loginfo("Set W = "+w) 26 | 27 | goal.target_pose.pose.position.x = float(x) 28 | goal.target_pose.pose.orientation.w = float(w) 29 | goal.target_pose.header.frame_id = 'first_move' 30 | goal.target_pose.header.stamp = rospy.Time.now() 31 | 32 | #start listner 33 | rospy.loginfo("Waiting for server") 34 | 35 | sac.wait_for_server() 36 | 37 | 38 | rospy.loginfo("Sending Goals") 39 | 40 | #send goal 41 | 42 | sac.send_goal(goal) 43 | rospy.loginfo("Waiting for server") 44 | 45 | #finish 46 | sac.wait_for_result() 47 | 48 | #print result 49 | print sac.get_result() 50 | 51 | 52 | if __name__ == '__main__': 53 | try: 54 | simple_move(sys.argv[1],sys.argv[2]) 55 | except rospy.ROSInterruptException: 56 | print "Keyboard Interrupt" 57 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/chefbot_empty_world.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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/chefbot_empty_world.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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/launch/view_robot_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 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/launch/view_robot_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 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/launch/view_robot_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 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/includes/move_base.launch.xml~: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/includes/move_base.launch.xml~: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/src/send_robot_goal.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | typedef actionlib::SimpleActionClient MoveBaseClient; 9 | 10 | int main(int argc, char** argv){ 11 | ros::init(argc, argv, "navigation_goals"); 12 | 13 | MoveBaseClient ac("move_base", true); 14 | 15 | while(!ac.waitForServer(ros::Duration(5.0))){ 16 | ROS_INFO("Waiting for the move_base action server"); 17 | } 18 | 19 | move_base_msgs::MoveBaseGoal goal; 20 | 21 | goal.target_pose.header.frame_id = "map"; 22 | goal.target_pose.header.stamp = ros::Time::now(); 23 | try{ 24 | goal.target_pose.pose.position.x = atof(argv[1]); 25 | goal.target_pose.pose.position.y = atof(argv[2]); 26 | goal.target_pose.pose.orientation.w = atof(argv[3]); 27 | } 28 | catch(int e){ 29 | 30 | 31 | goal.target_pose.pose.position.x = 1.0; 32 | goal.target_pose.pose.position.y = 1.0; 33 | goal.target_pose.pose.orientation.w = 1.0; 34 | 35 | 36 | } 37 | ROS_INFO("Sending move base goal"); 38 | ac.sendGoal(goal); 39 | 40 | ac.waitForResult(); 41 | 42 | if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED) 43 | ROS_INFO("Robot has arrived to the goal position"); 44 | else{ 45 | ROS_INFO("The base failed for some reason"); 46 | } 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/src/send_robot_goal.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | typedef actionlib::SimpleActionClient MoveBaseClient; 9 | 10 | int main(int argc, char** argv){ 11 | ros::init(argc, argv, "navigation_goals"); 12 | 13 | MoveBaseClient ac("move_base", true); 14 | 15 | while(!ac.waitForServer(ros::Duration(5.0))){ 16 | ROS_INFO("Waiting for the move_base action server"); 17 | } 18 | 19 | move_base_msgs::MoveBaseGoal goal; 20 | 21 | goal.target_pose.header.frame_id = "map"; 22 | goal.target_pose.header.stamp = ros::Time::now(); 23 | try{ 24 | goal.target_pose.pose.position.x = atof(argv[1]); 25 | goal.target_pose.pose.position.y = atof(argv[2]); 26 | goal.target_pose.pose.orientation.w = atof(argv[3]); 27 | } 28 | catch(int e){ 29 | 30 | 31 | goal.target_pose.pose.position.x = 1.0; 32 | goal.target_pose.pose.position.y = 1.0; 33 | goal.target_pose.pose.orientation.w = 1.0; 34 | 35 | 36 | } 37 | ROS_INFO("Sending move base goal"); 38 | ac.sendGoal(goal); 39 | 40 | ac.waitForResult(); 41 | 42 | if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED) 43 | ROS_INFO("Robot has arrived to the goal position"); 44 | else{ 45 | ROS_INFO("The base failed for some reason"); 46 | } 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/chefbot_hotel_world.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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/chefbot_hotel_world.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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/IMU/IMU.ino: -------------------------------------------------------------------------------- 1 | /* Service robot code, sensor only version 2 | 3 | */ 4 | //MPU 6050 Interfacing libraries 5 | 6 | #include "Wire.h" 7 | 8 | #include "I2Cdev.h" 9 | #include "MPU6050.h" 10 | 11 | MPU6050 accelgyro(0x68); 12 | 13 | void setup() 14 | { 15 | 16 | //Init Serial port with 115200 buad rate 17 | Serial.begin(115200); 18 | Setup_MPU6050(); 19 | } 20 | 21 | void Setup_MPU6050() 22 | { 23 | Wire.begin(); 24 | 25 | // initialize device 26 | Serial.println("Initializing I2C devices..."); 27 | accelgyro.initialize(); 28 | 29 | // verify connection 30 | Serial.println("Testing device connections..."); 31 | Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed"); 32 | 33 | } 34 | 35 | void loop() 36 | { 37 | 38 | //Update MPU 6050 39 | Update_MPU6050(); 40 | 41 | } 42 | 43 | void Update_MPU6050() 44 | { 45 | 46 | int16_t ax, ay, az; 47 | int16_t gx, gy, gz; 48 | 49 | // read raw accel/gyro measurements from device 50 | accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); 51 | 52 | // display tab-separated accel/gyro x/y/z values 53 | Serial.print("i");Serial.print("\t"); 54 | Serial.print(ax); Serial.print("\t"); 55 | Serial.print(ay); Serial.print("\t"); 56 | Serial.print(az); Serial.print("\t"); 57 | Serial.print(gx); Serial.print("\t"); 58 | Serial.print(gy); Serial.print("\t"); 59 | Serial.println(gz); 60 | Serial.print("\n"); 61 | 62 | } 63 | 64 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/test_imu/test_imu.ino: -------------------------------------------------------------------------------- 1 | /* Service robot code, sensor only version 2 | 3 | */ 4 | //MPU 6050 Interfacing libraries 5 | 6 | #include 7 | 8 | //#include "I2Cdev.h" 9 | #include "MPU6050.h" 10 | 11 | MPU6050 accelgyro(0x68); 12 | 13 | void setup() 14 | { 15 | 16 | //Init Serial port with 115200 buad rate 17 | Serial.begin(115200); 18 | Setup_MPU6050(); 19 | } 20 | 21 | void Setup_MPU6050() 22 | { 23 | Wire.begin(); 24 | 25 | // initialize device 26 | Serial.println("Initializing I2C devices..."); 27 | accelgyro.initialize(); 28 | 29 | // verify connection 30 | Serial.println("Testing device connections..."); 31 | Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed"); 32 | 33 | } 34 | 35 | void loop() 36 | { 37 | 38 | //Update MPU 6050 39 | Update_MPU6050(); 40 | 41 | } 42 | 43 | void Update_MPU6050() 44 | { 45 | 46 | int16_t ax, ay, az; 47 | int16_t gx, gy, gz; 48 | 49 | // read raw accel/gyro measurements from device 50 | accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); 51 | 52 | // display tab-separated accel/gyro x/y/z values 53 | Serial.print("i");Serial.print("\t"); 54 | Serial.print(ax); Serial.print("\t"); 55 | Serial.print(ay); Serial.print("\t"); 56 | Serial.print(az); Serial.print("\t"); 57 | Serial.print(gx); Serial.print("\t"); 58 | Serial.print(gy); Serial.print("\t"); 59 | Serial.println(gz); 60 | Serial.print("\n"); 61 | 62 | } 63 | 64 | 65 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/amcl_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/text-base/ardros.yaml.svn-base: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | #port: /dev/ttyUSB0 3 | baudRate: 115200 4 | batteryStateParams: {voltageLowlimit: 12.0, voltageLowLowlimit: 11.7} 5 | 6 | # wheel diameter [m], trackwidth [m], ticks per revolution 7 | driveGeometry: {wheelDiameter: 0.0763, trackWidth: 0.379, countsPerRevolution: 9750} 8 | #driveGeometry: {wheelDiameter: 0.077, trackWidth: 0.373, countsPerRevolution: 9750} 9 | 10 | # The speed controller parameters inlcude the P and I gains for the three PI controllers and the command timeout for the speed controller in seconds. 11 | # If no velocity command arrives for more than the specified timeout then the speed controller will stop the robot. 12 | #speedController: {velocityPParam: 0.1, velocityIParam: 0.1, turnPParam: 0.4, turnIParam: 0.5, commandTimeout: 1.0} 13 | #speedController: {velocityPParam: 0.01, velocityIParam: 0.01, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 14 | #speedController: {velocityPParam: 0.03, velocityIParam: 0.03, turnPParam: 0.04, turnIParam: 0.03, commandTimeout: 1.0} 15 | #speedController: {velocityPParam: 0.02, velocityIParam: 0.06, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 16 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.001, turnIParam: 0.02, commandTimeout: 1.0} 17 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.1, turnIParam: 0.1, commandTimeout: 1.0} 18 | speedController: {velocityPParam: 1.0, velocityIParam: 0.2, turnPParam: 0.05, turnIParam: 0.05, commandTimeout: 1.0} 19 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/amcl_demo.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/text-base/ardros.yaml.svn-base: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | #port: /dev/ttyUSB0 3 | baudRate: 115200 4 | batteryStateParams: {voltageLowlimit: 12.0, voltageLowLowlimit: 11.7} 5 | 6 | # wheel diameter [m], trackwidth [m], ticks per revolution 7 | driveGeometry: {wheelDiameter: 0.0763, trackWidth: 0.379, countsPerRevolution: 9750} 8 | #driveGeometry: {wheelDiameter: 0.077, trackWidth: 0.373, countsPerRevolution: 9750} 9 | 10 | # The speed controller parameters inlcude the P and I gains for the three PI controllers and the command timeout for the speed controller in seconds. 11 | # If no velocity command arrives for more than the specified timeout then the speed controller will stop the robot. 12 | #speedController: {velocityPParam: 0.1, velocityIParam: 0.1, turnPParam: 0.4, turnIParam: 0.5, commandTimeout: 1.0} 13 | #speedController: {velocityPParam: 0.01, velocityIParam: 0.01, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 14 | #speedController: {velocityPParam: 0.03, velocityIParam: 0.03, turnPParam: 0.04, turnIParam: 0.03, commandTimeout: 1.0} 15 | #speedController: {velocityPParam: 0.02, velocityIParam: 0.06, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 16 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.001, turnIParam: 0.02, commandTimeout: 1.0} 17 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.1, turnIParam: 0.1, commandTimeout: 1.0} 18 | speedController: {velocityPParam: 1.0, velocityIParam: 0.2, turnPParam: 0.05, turnIParam: 0.05, commandTimeout: 1.0} 19 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/ardros.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | #port: /dev/ttyUSB0 3 | baudRate: 115200 4 | batteryStateParams: {voltageLowlimit: 12.0, voltageLowLowlimit: 11.7} 5 | 6 | # wheel diameter [m], trackwidth [m], ticks per revolution 7 | driveGeometry: {wheelDiameter: 0.09, trackWidth: 0.01, countsPerRevolution: 4200} 8 | #driveGeometry: {wheelDiameter: 0.077, trackWidth: 0.373, countsPerRevolution: 9750} 9 | 10 | # The speed controller parameters inlcude the P and I gains for the three PI controllers and the command timeout for the speed controller in seconds. 11 | # If no velocity command arrives for more than the specified timeout then the speed controller will stop the robot. 12 | #speedController: {velocityPParam: 0.1, velocityIParam: 0.1, turnPParam: 0.4, turnIParam: 0.5, commandTimeout: 1.0} 13 | speedController: {velocityPParam: 0, velocityIParam: 0, turnPParam: 0, turnIParam: 0, commandTimeout: 1.0} 14 | 15 | #speedController: {velocityPParam: 0.01, velocityIParam: 0.01, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 16 | #speedController: {velocityPParam: 0.03, velocityIParam: 0.03, turnPParam: 0.04, turnIParam: 0.03, commandTimeout: 1.0} 17 | #speedController: {velocityPParam: 0.02, velocityIParam: 0.06, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 18 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.001, turnIParam: 0.02, commandTimeout: 1.0} 19 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.1, turnIParam: 0.1, commandTimeout: 1.0} 20 | #speedController: {velocityPParam: 0.1, velocityIParam: 0.2, turnPParam: 0.05, turnIParam: 0.5, commandTimeout: 1.0} 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/ardros.yaml: -------------------------------------------------------------------------------- 1 | port: /dev/ttyACM0 2 | #port: /dev/ttyUSB0 3 | baudRate: 115200 4 | batteryStateParams: {voltageLowlimit: 12.0, voltageLowLowlimit: 11.7} 5 | 6 | # wheel diameter [m], trackwidth [m], ticks per revolution 7 | driveGeometry: {wheelDiameter: 0.09, trackWidth: 0.01, countsPerRevolution: 4200} 8 | #driveGeometry: {wheelDiameter: 0.077, trackWidth: 0.373, countsPerRevolution: 9750} 9 | 10 | # The speed controller parameters inlcude the P and I gains for the three PI controllers and the command timeout for the speed controller in seconds. 11 | # If no velocity command arrives for more than the specified timeout then the speed controller will stop the robot. 12 | #speedController: {velocityPParam: 0.1, velocityIParam: 0.1, turnPParam: 0.4, turnIParam: 0.5, commandTimeout: 1.0} 13 | speedController: {velocityPParam: 0, velocityIParam: 0, turnPParam: 0, turnIParam: 0, commandTimeout: 1.0} 14 | 15 | #speedController: {velocityPParam: 0.01, velocityIParam: 0.01, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 16 | #speedController: {velocityPParam: 0.03, velocityIParam: 0.03, turnPParam: 0.04, turnIParam: 0.03, commandTimeout: 1.0} 17 | #speedController: {velocityPParam: 0.02, velocityIParam: 0.06, turnPParam: 0.04, turnIParam: 0.05, commandTimeout: 1.0} 18 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.001, turnIParam: 0.02, commandTimeout: 1.0} 19 | #speedController: {velocityPParam: 1.5, velocityIParam: 0.2, turnPParam: 0.1, turnIParam: 0.1, commandTimeout: 1.0} 20 | #speedController: {velocityPParam: 0.1, velocityIParam: 0.2, turnPParam: 0.05, turnIParam: 0.5, commandTimeout: 1.0} 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/param/costmap_common_params.yaml: -------------------------------------------------------------------------------- 1 | 2 | max_obstacle_height: 0.60 # assume something like an arm is mounted on top of the robot 3 | obstacle_range: 2.5 4 | raytrace_range: 3.0 5 | 6 | # Obstacle Cost Shaping (http://wiki.ros.org/costmap_2d/hydro/inflation) 7 | robot_radius: 0.20 # distance a circular robot should be clear of the obstacle (kobuki: 0.18) 8 | #robot_radius: 0.4509 # ArloBot 9 | # footprint: [[x0, y0], [x1, y1], ... [xn, yn]] # if the robot is not circular 10 | inflation_radius: 0.50 # max. distance from an obstacle at which costs are incurred for planning paths. 11 | cost_scaling_factor: 5 # exponential rate at which the obstacle cost drops off (default: 10) 12 | 13 | # voxel map configuration; z-voxels 0 are filled by bumpers and 1 by laser scan (kinect) 14 | map_type: voxel 15 | origin_z: 0.0 16 | z_resolution: 0.2 17 | z_voxels: 2 18 | publish_voxel_map: false 19 | 20 | observation_sources: scan bump 21 | #observation_sources: scan 22 | 23 | # scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.25, max_obstacle_height: 0.35} 24 | # Our lasers (Xtion and fake) either needs to publish a height, or set min_obstacle_height to 0.0: 25 | # http://wiki.ros.org/navigation/Troubleshooting#Missing_Obstacles_in_Costmap2D 26 | # Note taht the max_obstacle_height is very important too! 27 | scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.0, max_obstacle_height: 3} 28 | # Can we just set up two of these here? 29 | bump: {data_type: PointCloud2, topic: mobile_base/sensors/bumper_pointcloud, marking: true, clearing: false, min_obstacle_height: 0.0, max_obstacle_height: 0.15} 30 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/param/costmap_common_params.yaml: -------------------------------------------------------------------------------- 1 | 2 | max_obstacle_height: 0.60 # assume something like an arm is mounted on top of the robot 3 | obstacle_range: 2.5 4 | raytrace_range: 3.0 5 | 6 | # Obstacle Cost Shaping (http://wiki.ros.org/costmap_2d/hydro/inflation) 7 | robot_radius: 0.20 # distance a circular robot should be clear of the obstacle (kobuki: 0.18) 8 | #robot_radius: 0.4509 # ArloBot 9 | # footprint: [[x0, y0], [x1, y1], ... [xn, yn]] # if the robot is not circular 10 | inflation_radius: 0.50 # max. distance from an obstacle at which costs are incurred for planning paths. 11 | cost_scaling_factor: 5 # exponential rate at which the obstacle cost drops off (default: 10) 12 | 13 | # voxel map configuration; z-voxels 0 are filled by bumpers and 1 by laser scan (kinect) 14 | map_type: voxel 15 | origin_z: 0.0 16 | z_resolution: 0.2 17 | z_voxels: 2 18 | publish_voxel_map: false 19 | 20 | observation_sources: scan bump 21 | #observation_sources: scan 22 | 23 | # scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.25, max_obstacle_height: 0.35} 24 | # Our lasers (Xtion and fake) either needs to publish a height, or set min_obstacle_height to 0.0: 25 | # http://wiki.ros.org/navigation/Troubleshooting#Missing_Obstacles_in_Costmap2D 26 | # Note taht the max_obstacle_height is very important too! 27 | scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.0, max_obstacle_height: 3} 28 | # Can we just set up two of these here? 29 | bump: {data_type: PointCloud2, topic: mobile_base/sensors/bumper_pointcloud, marking: true, clearing: false, min_obstacle_height: 0.0, max_obstacle_height: 0.15} 30 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/costmap_common_params.yaml: -------------------------------------------------------------------------------- 1 | # Customized for ArloBot 2 | max_obstacle_height: 0.60 # assume something like an arm is mounted on top of the robot 3 | obstacle_range: 2.5 4 | raytrace_range: 3.0 5 | 6 | # Obstacle Cost Shaping (http://wiki.ros.org/costmap_2d/hydro/inflation) 7 | robot_radius: 0.20 # distance a circular robot should be clear of the obstacle (kobuki: 0.18) 8 | #robot_radius: 0.4509 # ArloBot 9 | # footprint: [[x0, y0], [x1, y1], ... [xn, yn]] # if the robot is not circular 10 | inflation_radius: 0.50 # max. distance from an obstacle at which costs are incurred for planning paths. 11 | cost_scaling_factor: 5 # exponential rate at which the obstacle cost drops off (default: 10) 12 | 13 | # voxel map configuration; z-voxels 0 are filled by bumpers and 1 by laser scan (kinect) 14 | map_type: voxel 15 | origin_z: 0.0 16 | z_resolution: 0.2 17 | z_voxels: 2 18 | publish_voxel_map: false 19 | 20 | observation_sources: scan bump 21 | #observation_sources: scan 22 | 23 | # scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.25, max_obstacle_height: 0.35} 24 | # Our lasers (Xtion and fake) either needs to publish a height, or set min_obstacle_height to 0.0: 25 | # http://wiki.ros.org/navigation/Troubleshooting#Missing_Obstacles_in_Costmap2D 26 | # Note taht the max_obstacle_height is very important too! 27 | scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.0, max_obstacle_height: 3} 28 | # Can we just set up two of these here? 29 | bump: {data_type: PointCloud2, topic: mobile_base/sensors/bumper_pointcloud, marking: true, clearing: false, min_obstacle_height: 0.0, max_obstacle_height: 0.15} 30 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/costmap_common_params.yaml: -------------------------------------------------------------------------------- 1 | # Customized for ArloBot 2 | max_obstacle_height: 0.60 # assume something like an arm is mounted on top of the robot 3 | obstacle_range: 2.5 4 | raytrace_range: 3.0 5 | 6 | # Obstacle Cost Shaping (http://wiki.ros.org/costmap_2d/hydro/inflation) 7 | robot_radius: 0.20 # distance a circular robot should be clear of the obstacle (kobuki: 0.18) 8 | #robot_radius: 0.4509 # ArloBot 9 | # footprint: [[x0, y0], [x1, y1], ... [xn, yn]] # if the robot is not circular 10 | inflation_radius: 0.50 # max. distance from an obstacle at which costs are incurred for planning paths. 11 | cost_scaling_factor: 5 # exponential rate at which the obstacle cost drops off (default: 10) 12 | 13 | # voxel map configuration; z-voxels 0 are filled by bumpers and 1 by laser scan (kinect) 14 | map_type: voxel 15 | origin_z: 0.0 16 | z_resolution: 0.2 17 | z_voxels: 2 18 | publish_voxel_map: false 19 | 20 | observation_sources: scan bump 21 | #observation_sources: scan 22 | 23 | # scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.25, max_obstacle_height: 0.35} 24 | # Our lasers (Xtion and fake) either needs to publish a height, or set min_obstacle_height to 0.0: 25 | # http://wiki.ros.org/navigation/Troubleshooting#Missing_Obstacles_in_Costmap2D 26 | # Note taht the max_obstacle_height is very important too! 27 | scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: 0.0, max_obstacle_height: 3} 28 | # Can we just set up two of these here? 29 | bump: {data_type: PointCloud2, topic: mobile_base/sensors/bumper_pointcloud, marking: true, clearing: false, min_obstacle_height: 0.0, max_obstacle_height: 0.15} 30 | -------------------------------------------------------------------------------- /chapter_6_code/code_motor/dynamixel_test_code.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import dynamixel 5 | import time 6 | import random 7 | 8 | 9 | # The number of Dynamixels on our bus. 10 | nServos = 1 11 | 12 | # Set your serial port accordingly. 13 | if os.name == "posix": 14 | portName = "/dev/ttyUSB0" 15 | else: 16 | portName = "COM6" 17 | 18 | # Default baud rate of the USB2Dynamixel device. 19 | baudRate = 1000000 20 | 21 | # Connect to the serial port 22 | print "Connecting to serial port", portName, '...', 23 | serial = dynamixel.serial_stream.SerialStream( port=portName, baudrate=baudRate, timeout=1) 24 | print "Connected!" 25 | net = dynamixel.dynamixel_network.DynamixelNetwork( serial ) 26 | net.scan( 1, nServos ) 27 | 28 | # A list to hold the dynamixels 29 | myActuators = list() 30 | print myActuators 31 | 32 | This will create a list for storing dynamixel actuators details. 33 | 34 | print "Scanning for Dynamixels...", 35 | for dyn in net.get_dynamixels(): 36 | print dyn.id, 37 | myActuators.append(net[dyn.id]) 38 | print "...Done" 39 | 40 | 41 | # Set the default speed and torque 42 | for actuator in myActuators: 43 | actuator.moving_speed = 50 44 | actuator.synchronized = True 45 | actuator.torque_enable = True 46 | actuator.torque_limit = 800 47 | actuator.max_torque = 800 48 | 49 | # Move the servos randomly and print out their current positions 50 | while True: 51 | for actuator in myActuators: 52 | actuator.goal_position = random.randrange(450, 600) 53 | net.synchronize() 54 | for actuator in myActuators: 55 | actuator.read_all() 56 | time.sleep(0.01) 57 | 58 | for actuator in myActuators: 59 | print actuator.cache[dynamixel.defs.REGISTER['Id']], actuator.cache[dynamixel.defs.REGISTER['CurrentPosition']] 60 | 61 | time.sleep(2) 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /chapter_3_code/chefbot_description/urdf/common_properties.xacro: -------------------------------------------------------------------------------- 1 | 2 | 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 | 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 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_description/urdf/common_properties.xacro: -------------------------------------------------------------------------------- 1 | 2 | 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 | 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 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_description/urdf/common_properties.xacro: -------------------------------------------------------------------------------- 1 | 2 | 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 | 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 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/scripts/SerialDataGateway.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | Created on November 20, 2010 4 | 5 | @author: Dr. Rainer Hessmer 6 | ''' 7 | import threading 8 | import serial 9 | from cStringIO import StringIO 10 | import time 11 | import rospy 12 | 13 | def _OnLineReceived(line): 14 | print(line) 15 | 16 | 17 | class SerialDataGateway(object): 18 | ''' 19 | Helper class for receiving lines from a serial port 20 | ''' 21 | 22 | def __init__(self, port="/dev/ttyUSB0", baudrate=115200, lineHandler = _OnLineReceived): 23 | ''' 24 | Initializes the receiver class. 25 | port: The serial port to listen to. 26 | receivedLineHandler: The function to call when a line was received. 27 | ''' 28 | self._Port = port 29 | self._Baudrate = baudrate 30 | self.ReceivedLineHandler = lineHandler 31 | self._KeepRunning = False 32 | 33 | def Start(self): 34 | self._Serial = serial.Serial(port = self._Port, baudrate = self._Baudrate, timeout = 1) 35 | 36 | self._KeepRunning = True 37 | self._ReceiverThread = threading.Thread(target=self._Listen) 38 | self._ReceiverThread.setDaemon(True) 39 | self._ReceiverThread.start() 40 | 41 | def Stop(self): 42 | rospy.loginfo("Stopping serial gateway") 43 | self._KeepRunning = False 44 | time.sleep(.1) 45 | self._Serial.close() 46 | 47 | def _Listen(self): 48 | stringIO = StringIO() 49 | while self._KeepRunning: 50 | data = self._Serial.read() 51 | if data == '\r': 52 | pass 53 | if data == '\n': 54 | self.ReceivedLineHandler(stringIO.getvalue()) 55 | stringIO.close() 56 | stringIO = StringIO() 57 | else: 58 | stringIO.write(data) 59 | 60 | def Write(self, data): 61 | info = "Writing to serial port: %s" %data 62 | rospy.loginfo(info) 63 | self._Serial.write(data) 64 | 65 | if __name__ == '__main__': 66 | dataReceiver = SerialDataGateway("/dev/ttyUSB0", 115200) 67 | dataReceiver.Start() 68 | 69 | raw_input("Hit to end.") 70 | dataReceiver.Stop() 71 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/scripts/SerialDataGateway.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | Created on November 20, 2010 4 | 5 | @author: Dr. Rainer Hessmer 6 | ''' 7 | import threading 8 | import serial 9 | from cStringIO import StringIO 10 | import time 11 | import rospy 12 | 13 | def _OnLineReceived(line): 14 | print(line) 15 | 16 | 17 | class SerialDataGateway(object): 18 | ''' 19 | Helper class for receiving lines from a serial port 20 | ''' 21 | 22 | def __init__(self, port="/dev/ttyUSB0", baudrate=115200, lineHandler = _OnLineReceived): 23 | ''' 24 | Initializes the receiver class. 25 | port: The serial port to listen to. 26 | receivedLineHandler: The function to call when a line was received. 27 | ''' 28 | self._Port = port 29 | self._Baudrate = baudrate 30 | self.ReceivedLineHandler = lineHandler 31 | self._KeepRunning = False 32 | 33 | def Start(self): 34 | self._Serial = serial.Serial(port = self._Port, baudrate = self._Baudrate, timeout = 1) 35 | 36 | self._KeepRunning = True 37 | self._ReceiverThread = threading.Thread(target=self._Listen) 38 | self._ReceiverThread.setDaemon(True) 39 | self._ReceiverThread.start() 40 | 41 | def Stop(self): 42 | rospy.loginfo("Stopping serial gateway") 43 | self._KeepRunning = False 44 | time.sleep(.1) 45 | self._Serial.close() 46 | 47 | def _Listen(self): 48 | stringIO = StringIO() 49 | while self._KeepRunning: 50 | data = self._Serial.read() 51 | if data == '\r': 52 | pass 53 | if data == '\n': 54 | self.ReceivedLineHandler(stringIO.getvalue()) 55 | stringIO.close() 56 | stringIO = StringIO() 57 | else: 58 | stringIO.write(data) 59 | 60 | def Write(self, data): 61 | info = "Writing to serial port: %s" %data 62 | rospy.loginfo(info) 63 | self._Serial.write(data) 64 | 65 | if __name__ == '__main__': 66 | dataReceiver = SerialDataGateway("/dev/ttyUSB0", 115200) 67 | dataReceiver.Start() 68 | 69 | raw_input("Hit to end.") 70 | dataReceiver.Stop() 71 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/hc_sr04.ino: -------------------------------------------------------------------------------- 1 | /* 2 | HC-SR04 for Arduino 3 | 4 | Original project from http://www.swanrobotics.com 5 | 6 | This project demonstrates the HC-SR 7 | The distance presented in the code is in mm, but you can uncomment the line for distance in inches. 8 | The schematics for this project can be found on http://www.swanrobotics.com 9 | 10 | This example code is in the public domain. 11 | */ 12 | 13 | const int TriggerPin = 8; //Trig pin 14 | const int EchoPin = 9; //Echo pin 15 | long Duration = 0; 16 | 17 | void setup(){ 18 | pinMode(TriggerPin,OUTPUT); // Trigger is an output pin 19 | pinMode(EchoPin,INPUT); // Echo is an input pin 20 | Serial.begin(9600); // Serial Output 21 | } 22 | 23 | void loop(){ 24 | digitalWrite(TriggerPin, LOW); 25 | delayMicroseconds(2); 26 | digitalWrite(TriggerPin, HIGH); // Trigger pin to HIGH 27 | delayMicroseconds(10); // 10us high 28 | digitalWrite(TriggerPin, LOW); // Trigger pin to HIGH 29 | 30 | Duration = pulseIn(EchoPin,HIGH); // Waits for the echo pin to get high 31 | // returns the Duration in microseconds 32 | long Distance_mm = Distance(Duration); // Use function to calculate the distance 33 | 34 | Serial.print("Distance = "); // Output to serial 35 | Serial.print(Distance_mm); 36 | Serial.println(" mm"); 37 | 38 | delay(1000); // Wait to do next measurement 39 | } 40 | 41 | long Distance(long time) 42 | { 43 | // Calculates the Distance in mm 44 | // ((time)*(Speed of sound))/ toward and backward of object) * 10 45 | 46 | long DistanceCalc; // Calculation variable 47 | DistanceCalc = ((time /2.9) / 2); // Actual calculation in mm 48 | //DistanceCalc = time / 74 / 2; // Actual calculation in inches 49 | return DistanceCalc; // return calculated value 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /chapter_6_code/code_motor/simple_encoder_test.ino: -------------------------------------------------------------------------------- 1 | //Encoder pins definition 2 | 3 | // Left encoder 4 | 5 | #define Left_Encoder_PinA 31 6 | #define Left_Encoder_PinB 32 7 | 8 | volatile long Left_Encoder_Ticks = 0; 9 | 10 | //Variable to read current state of left encoder pin 11 | volatile bool LeftEncoderBSet; 12 | 13 | //Right Encoder 14 | 15 | #define Right_Encoder_PinA 33 16 | #define Right_Encoder_PinB 34 17 | volatile long Right_Encoder_Ticks = 0; 18 | //Variable to read current state of right encoder pin 19 | volatile bool RightEncoderBSet; 20 | 21 | 22 | void setup() 23 | { 24 | //Init Serial port with 115200 buad rate 25 | Serial.begin(115200); 26 | SetupEncoders(); 27 | } 28 | 29 | 30 | void SetupEncoders() 31 | { 32 | // Quadrature encoders 33 | // Left encoder 34 | pinMode(Left_Encoder_PinA, INPUT_PULLUP); // sets pin A as input 35 | pinMode(Left_Encoder_PinB, INPUT_PULLUP); // sets pin B as input 36 | attachInterrupt(Left_Encoder_PinA, do_Left_Encoder, RISING); 37 | 38 | 39 | // Right encoder 40 | pinMode(Right_Encoder_PinA, INPUT_PULLUP); // sets pin A as input 41 | pinMode(Right_Encoder_PinB, INPUT_PULLUP); // sets pin B as input 42 | 43 | attachInterrupt(Right_Encoder_PinA, do_Right_Encoder, RISING); 44 | 45 | } 46 | 47 | void loop() 48 | { 49 | Update_Encoders(); 50 | } 51 | 52 | 53 | void Update_Encoders() 54 | { 55 | Serial.print("e"); 56 | Serial.print("\t"); 57 | Serial.print(Left_Encoder_Ticks); 58 | Serial.print("\t"); 59 | Serial.print(Right_Encoder_Ticks); 60 | Serial.print("\n"); 61 | } 62 | 63 | void do_Left_Encoder() 64 | { 65 | LeftEncoderBSet = digitalRead(Left_Encoder_PinB); // read the input pin 66 | Left_Encoder_Ticks -= LeftEncoderBSet ? -1 : +1; 67 | 68 | } 69 | void do_Right_Encoder() 70 | { 71 | RightEncoderBSet = digitalRead(Right_Encoder_PinB); // read the input pin 72 | Right_Encoder_Ticks += RightEncoderBSet ? -1 : +1; 73 | } 74 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/includes/gmapping.launch.xml: -------------------------------------------------------------------------------- 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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/includes/gmapping.launch.xml: -------------------------------------------------------------------------------- 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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/includes/gmapping.launch.xml: -------------------------------------------------------------------------------- 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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/includes/gmapping.launch.xml~: -------------------------------------------------------------------------------- 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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/includes/gmapping.launch.xml: -------------------------------------------------------------------------------- 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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/includes/gmapping.launch.xml~: -------------------------------------------------------------------------------- 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 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/7536OS_06_01.ino: -------------------------------------------------------------------------------- 1 | 2 | // this constant won't change. It's the pin number 3 | // of the sensor's output: 4 | const int pingPin = 7; 5 | 6 | void setup() { 7 | // initialize serial communication: 8 | Serial.begin(9600); 9 | } 10 | 11 | void loop() 12 | { 13 | // establish variables for duration of the ping, 14 | // and the distance result in inches and centimeters: 15 | long duration, inches, cm; 16 | 17 | // The PING))) is triggered by a HIGH pulse of 2 or more microseconds. 18 | // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: 19 | pinMode(pingPin, OUTPUT); 20 | digitalWrite(pingPin, LOW); 21 | delayMicroseconds(2); 22 | digitalWrite(pingPin, HIGH); 23 | delayMicroseconds(5); 24 | digitalWrite(pingPin, LOW); 25 | 26 | // The same pin is used to read the signal from the PING))): a HIGH 27 | // pulse whose duration is the time (in microseconds) from the sending 28 | // of the ping to the reception of its echo off of an object. 29 | pinMode(pingPin, INPUT); 30 | duration = pulseIn(pingPin, HIGH); 31 | 32 | // convert the time into a distance 33 | inches = microsecondsToInches(duration); 34 | cm = microsecondsToCentimeters(duration); 35 | 36 | Serial.print(inches); 37 | Serial.print("in, "); 38 | Serial.print(cm); 39 | Serial.print("cm"); 40 | Serial.println(); 41 | 42 | delay(100); 43 | } 44 | 45 | long microsecondsToInches(long microseconds) 46 | { 47 | // According to Parallax's datasheet for the PING))), there are 48 | // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per 49 | // second). This gives the distance travelled by the ping, outbound 50 | // and return, so we divide by 2 to get the distance of the obstacle. 51 | // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf 52 | return microseconds / 74 / 2; 53 | } 54 | 55 | long microsecondsToCentimeters(long microseconds) 56 | { 57 | // The speed of sound is 340 m/s or 29 microseconds per centimeter. 58 | // The ping travels out and back, so to find the distance of the 59 | // object we take half of the distance travelled. 60 | return microseconds / 29 / 2; 61 | } -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/7536OS_06_03.ino: -------------------------------------------------------------------------------- 1 | 2 | // Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation 3 | // is used in I2Cdev.h 4 | #include "Wire.h" 5 | 6 | // I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files 7 | // for both classes must be in the include path of your project 8 | #include "I2Cdev.h" 9 | #include "MPU6050.h" 10 | 11 | // class default I2C address is 0x68 12 | // specific I2C addresses may be passed as a parameter here 13 | // AD0 low = 0x68 (default for InvenSense evaluation board) 14 | // AD0 high = 0x69 15 | MPU6050 accelgyro; 16 | 17 | int16_t ax, ay, az; 18 | int16_t gx, gy, gz; 19 | 20 | #define LED_PIN 13 21 | bool blinkState = false; 22 | 23 | void setup() { 24 | // join I2C bus (I2Cdev library doesn't do this automatically) 25 | Wire.begin(3); 26 | Wire.setModule(3); 27 | Wire.begin(); 28 | // initialize serial communication 29 | // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but 30 | // it's really up to you depending on your project) 31 | Serial.begin(38400); 32 | 33 | // initialize device 34 | Serial.println("Initializing I2C devices..."); 35 | accelgyro.initialize(); 36 | 37 | // verify connection 38 | Serial.println("Testing device connections..."); 39 | Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed"); 40 | 41 | // configure Arduino LED for 42 | pinMode(LED_PIN, OUTPUT); 43 | } 44 | 45 | void loop() { 46 | // read raw accel/gyro measurements from device 47 | accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); 48 | 49 | // these methods (and a few others) are also available 50 | //accelgyro.getAcceleration(&ax, &ay, &az); 51 | //accelgyro.getRotation(&gx, &gy, &gz); 52 | 53 | // display tab-separated accel/gyro x/y/z values 54 | Serial.print("a/g:\t"); 55 | Serial.print(ax); Serial.print("\t"); 56 | Serial.print(ay); Serial.print("\t"); 57 | Serial.print(az); Serial.print("\t"); 58 | Serial.print(gx); Serial.print("\t"); 59 | Serial.print(gy); Serial.print("\t"); 60 | Serial.println(gz); 61 | 62 | // blink LED to indicate activity 63 | blinkState = !blinkState; 64 | digitalWrite(LED_PIN, blinkState); 65 | } 66 | -------------------------------------------------------------------------------- /chapter_1_code/hello_world/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | hello_world 4 | 0.0.0 5 | The hello_world package 6 | 7 | 8 | 9 | 10 | lentin 11 | 12 | 13 | 14 | 15 | 16 | TODO 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 | catkin 43 | rospy 44 | std_msgs 45 | rospy 46 | std_msgs 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/param/dwa_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | DWAPlannerROS: 2 | 3 | max_vel_x: 0.5 # 0.55 4 | min_vel_x: 0.0 5 | 6 | max_vel_y: 0.0 # diff drive robot 7 | min_vel_y: 0.0 # diff drive robot 8 | 9 | max_trans_vel: 0.5 # choose slightly less than the base's capability 10 | min_trans_vel: 0.1 # this is the min trans velocity when there is negligible rotational velocity 11 | trans_stopped_vel: 0.1 12 | 13 | # Warning! 14 | # do not set min_trans_vel to 0.0 otherwise dwa will always think translational velocities 15 | # are non-negligible and small in place rotational velocities will be created. 16 | 17 | max_rot_vel: 5.0 # choose slightly less than the base's capability 18 | min_rot_vel: 0.4 # this is the min angular velocity when there is negligible translational velocity 19 | rot_stopped_vel: 0.4 20 | 21 | acc_lim_x: 1.0 # maximum is theoretically 2.0, but we 22 | acc_lim_theta: 2.0 23 | acc_lim_y: 0.0 # diff drive robot 24 | 25 | # Goal Tolerance Parameters 26 | yaw_goal_tolerance: 0.3 # 0.05 27 | xy_goal_tolerance: 0.15 # 0.10 28 | # latch_xy_goal_tolerance: false 29 | 30 | # Forward Simulation Parameters 31 | sim_time: 1.0 # 1.7 32 | vx_samples: 6 # 3 33 | vy_samples: 1 # diff drive robot, there is only one sample 34 | vtheta_samples: 20 # 20 35 | 36 | # Trajectory Scoring Parameters 37 | path_distance_bias: 64.0 # 32.0 - weighting for how much it should stick to the global path plan 38 | goal_distance_bias: 24.0 # 24.0 - wighting for how much it should attempt to reach its goal 39 | occdist_scale: 0.50 # 0.01 - weighting for how much the controller should avoid obstacles 40 | forward_point_distance: 0.325 # 0.325 - how far along to place an additional scoring point 41 | stop_time_buffer: 0.2 # 0.2 - amount of time a robot must stop in before colliding for a valid traj. 42 | scaling_speed: 0.25 # 0.25 - absolute velocity at which to start scaling the robot's footprint 43 | max_scaling_factor: 0.2 # 0.2 - how much to scale the robot's footprint when at speed. 44 | 45 | # Oscillation Prevention Parameters 46 | oscillation_reset_dist: 0.05 # 0.05 - how far to travel before resetting oscillation flags 47 | 48 | # Debugging 49 | publish_traj_pc : true 50 | publish_cost_grid_pc: true 51 | global_frame_id: odom 52 | 53 | 54 | # Differential-drive robot configuration - necessary? 55 | # holonomic_robot: false 56 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/param/dwa_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | DWAPlannerROS: 2 | 3 | max_vel_x: 0.5 # 0.55 4 | min_vel_x: 0.0 5 | 6 | max_vel_y: 0.0 # diff drive robot 7 | min_vel_y: 0.0 # diff drive robot 8 | 9 | max_trans_vel: 0.5 # choose slightly less than the base's capability 10 | min_trans_vel: 0.1 # this is the min trans velocity when there is negligible rotational velocity 11 | trans_stopped_vel: 0.1 12 | 13 | # Warning! 14 | # do not set min_trans_vel to 0.0 otherwise dwa will always think translational velocities 15 | # are non-negligible and small in place rotational velocities will be created. 16 | 17 | max_rot_vel: 5.0 # choose slightly less than the base's capability 18 | min_rot_vel: 0.4 # this is the min angular velocity when there is negligible translational velocity 19 | rot_stopped_vel: 0.4 20 | 21 | acc_lim_x: 1.0 # maximum is theoretically 2.0, but we 22 | acc_lim_theta: 2.0 23 | acc_lim_y: 0.0 # diff drive robot 24 | 25 | # Goal Tolerance Parameters 26 | yaw_goal_tolerance: 0.3 # 0.05 27 | xy_goal_tolerance: 0.15 # 0.10 28 | # latch_xy_goal_tolerance: false 29 | 30 | # Forward Simulation Parameters 31 | sim_time: 1.0 # 1.7 32 | vx_samples: 6 # 3 33 | vy_samples: 1 # diff drive robot, there is only one sample 34 | vtheta_samples: 20 # 20 35 | 36 | # Trajectory Scoring Parameters 37 | path_distance_bias: 64.0 # 32.0 - weighting for how much it should stick to the global path plan 38 | goal_distance_bias: 24.0 # 24.0 - wighting for how much it should attempt to reach its goal 39 | occdist_scale: 0.50 # 0.01 - weighting for how much the controller should avoid obstacles 40 | forward_point_distance: 0.325 # 0.325 - how far along to place an additional scoring point 41 | stop_time_buffer: 0.2 # 0.2 - amount of time a robot must stop in before colliding for a valid traj. 42 | scaling_speed: 0.25 # 0.25 - absolute velocity at which to start scaling the robot's footprint 43 | max_scaling_factor: 0.2 # 0.2 - how much to scale the robot's footprint when at speed. 44 | 45 | # Oscillation Prevention Parameters 46 | oscillation_reset_dist: 0.05 # 0.05 - how far to travel before resetting oscillation flags 47 | 48 | # Debugging 49 | publish_traj_pc : true 50 | publish_cost_grid_pc: true 51 | global_frame_id: odom 52 | 53 | 54 | # Differential-drive robot configuration - necessary? 55 | # holonomic_robot: false 56 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/dwa_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | DWAPlannerROS: 2 | 3 | # Robot Configuration Parameters - Kobuki 4 | max_vel_x: 0.5 # 0.55 5 | min_vel_x: 0.0 6 | 7 | max_vel_y: 0.0 # diff drive robot 8 | min_vel_y: 0.0 # diff drive robot 9 | 10 | max_trans_vel: 0.5 # choose slightly less than the base's capability 11 | min_trans_vel: 0.1 # this is the min trans velocity when there is negligible rotational velocity 12 | trans_stopped_vel: 0.1 13 | 14 | # Warning! 15 | # do not set min_trans_vel to 0.0 otherwise dwa will always think translational velocities 16 | # are non-negligible and small in place rotational velocities will be created. 17 | 18 | max_rot_vel: 5.0 # choose slightly less than the base's capability 19 | min_rot_vel: 0.4 # this is the min angular velocity when there is negligible translational velocity 20 | rot_stopped_vel: 0.4 21 | 22 | acc_lim_x: 1.0 # maximum is theoretically 2.0, but we 23 | acc_lim_theta: 2.0 24 | acc_lim_y: 0.0 # diff drive robot 25 | 26 | # Goal Tolerance Parameters 27 | yaw_goal_tolerance: 0.3 # 0.05 28 | xy_goal_tolerance: 0.15 # 0.10 29 | # latch_xy_goal_tolerance: false 30 | 31 | # Forward Simulation Parameters 32 | sim_time: 1.0 # 1.7 33 | vx_samples: 6 # 3 34 | vy_samples: 1 # diff drive robot, there is only one sample 35 | vtheta_samples: 20 # 20 36 | 37 | # Trajectory Scoring Parameters 38 | path_distance_bias: 64.0 # 32.0 - weighting for how much it should stick to the global path plan 39 | goal_distance_bias: 24.0 # 24.0 - wighting for how much it should attempt to reach its goal 40 | occdist_scale: 0.50 # 0.01 - weighting for how much the controller should avoid obstacles 41 | forward_point_distance: 0.325 # 0.325 - how far along to place an additional scoring point 42 | stop_time_buffer: 0.2 # 0.2 - amount of time a robot must stop in before colliding for a valid traj. 43 | scaling_speed: 0.25 # 0.25 - absolute velocity at which to start scaling the robot's footprint 44 | max_scaling_factor: 0.2 # 0.2 - how much to scale the robot's footprint when at speed. 45 | 46 | # Oscillation Prevention Parameters 47 | oscillation_reset_dist: 0.05 # 0.05 - how far to travel before resetting oscillation flags 48 | 49 | # Debugging 50 | publish_traj_pc : true 51 | publish_cost_grid_pc: true 52 | global_frame_id: odom 53 | 54 | 55 | # Differential-drive robot configuration - necessary? 56 | # holonomic_robot: false 57 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/dwa_local_planner_params.yaml: -------------------------------------------------------------------------------- 1 | DWAPlannerROS: 2 | 3 | # Robot Configuration Parameters - Kobuki 4 | max_vel_x: 0.5 # 0.55 5 | min_vel_x: 0.0 6 | 7 | max_vel_y: 0.0 # diff drive robot 8 | min_vel_y: 0.0 # diff drive robot 9 | 10 | max_trans_vel: 0.5 # choose slightly less than the base's capability 11 | min_trans_vel: 0.1 # this is the min trans velocity when there is negligible rotational velocity 12 | trans_stopped_vel: 0.1 13 | 14 | # Warning! 15 | # do not set min_trans_vel to 0.0 otherwise dwa will always think translational velocities 16 | # are non-negligible and small in place rotational velocities will be created. 17 | 18 | max_rot_vel: 5.0 # choose slightly less than the base's capability 19 | min_rot_vel: 0.4 # this is the min angular velocity when there is negligible translational velocity 20 | rot_stopped_vel: 0.4 21 | 22 | acc_lim_x: 1.0 # maximum is theoretically 2.0, but we 23 | acc_lim_theta: 2.0 24 | acc_lim_y: 0.0 # diff drive robot 25 | 26 | # Goal Tolerance Parameters 27 | yaw_goal_tolerance: 0.3 # 0.05 28 | xy_goal_tolerance: 0.15 # 0.10 29 | # latch_xy_goal_tolerance: false 30 | 31 | # Forward Simulation Parameters 32 | sim_time: 1.0 # 1.7 33 | vx_samples: 6 # 3 34 | vy_samples: 1 # diff drive robot, there is only one sample 35 | vtheta_samples: 20 # 20 36 | 37 | # Trajectory Scoring Parameters 38 | path_distance_bias: 64.0 # 32.0 - weighting for how much it should stick to the global path plan 39 | goal_distance_bias: 24.0 # 24.0 - wighting for how much it should attempt to reach its goal 40 | occdist_scale: 0.50 # 0.01 - weighting for how much the controller should avoid obstacles 41 | forward_point_distance: 0.325 # 0.325 - how far along to place an additional scoring point 42 | stop_time_buffer: 0.2 # 0.2 - amount of time a robot must stop in before colliding for a valid traj. 43 | scaling_speed: 0.25 # 0.25 - absolute velocity at which to start scaling the robot's footprint 44 | max_scaling_factor: 0.2 # 0.2 - how much to scale the robot's footprint when at speed. 45 | 46 | # Oscillation Prevention Parameters 47 | oscillation_reset_dist: 0.05 # 0.05 - how far to travel before resetting oscillation flags 48 | 49 | # Debugging 50 | publish_traj_pc : true 51 | publish_cost_grid_pc: true 52 | global_frame_id: odom 53 | 54 | 55 | # Differential-drive robot configuration - necessary? 56 | # holonomic_robot: false 57 | -------------------------------------------------------------------------------- /chapter_7_code/sample_opencv_pkg/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | sample_opencv_pkg 4 | 0.0.0 5 | The sample_opencv_pkg package 6 | 7 | 8 | 9 | 10 | lentin 11 | 12 | 13 | 14 | 15 | 16 | TODO 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 | catkin 43 | cv_bridge 44 | rospy 45 | sensor_msgs 46 | std_msgs 47 | cv_bridge 48 | rospy 49 | sensor_msgs 50 | std_msgs 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/text-base/base_local_planner_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | TrajectoryPlannerROS: 2 | # for details see: http://www.ros.org/wiki/base_local_planner 3 | max_vel_x: 0.5 4 | min_vel_x: 0.02 5 | max_rotational_vel: 1.0 # 0.1 rad/sec = 5.7 degree/sec 6 | min_in_place_rotational_vel: 0.2 7 | 8 | acc_lim_th: 1.0 9 | acc_lim_x: 0.2 10 | acc_lim_y: 0.2 11 | 12 | holonomic_robot: false 13 | 14 | # goal tolerance parameters 15 | yaw_goal_tolerance: 0.1 # 0.1 means 5.7 degrees 16 | xy_goal_tolerance: 0.2 17 | latch_xy_goal_tolerance: true 18 | 19 | # Forward Simulation Parameters 20 | sim_time: 1.5 # The amount of time to forward-simulate trajectories in seconds 21 | sim_granularity: 0.025 # The step size, in meters, to take between points on a given trajectory 22 | angular_sim_granularity: 0.05 # The step size, in radians, to take between angular samples on a given trajectory. 23 | vx_samples: 10 # The number of samples to use when exploring the x velocity space 24 | vtheta_samples: 20 # The number of samples to use when exploring the theta velocity space 25 | 26 | 27 | # Trajectory Scoring Parameters 28 | meter_scoring: true # If true, distances are expressed in meters; otherwise grid cells 29 | path_distance_bias: 0.6 # The weighting for how much the controller should stay close to the path it was given 30 | goal_distance_bias: 0.8 # The weighting for how much the controller should attempt to reach its local goal, also controls speed 31 | occdist_scale: 0.01 # The weighting for how much the controller should attempt to avoid obstacles 32 | # occdist_scale * (maximum obstacle cost along the trajectory in obstacle cost (0-254)) 33 | 34 | heading_lookahead: 0.325 # How far to look ahead in meters when scoring different in-place-rotation trajectories 35 | oscillation_reset_dist: 0.05 # How far the robot must travel in meters before oscillation flags are reset 36 | 37 | publish_cost_grid: true 38 | dwa: false # Whether to use the Dynamic Window Approach (DWA)_ or whether to use Trajectory Rollout 39 | # (NOTE: In our experience DWA worked as well as Trajectory Rollout and is computationally less expensive. 40 | # It is possible that robots with extremely poor acceleration limits could gain from running Trajectory Rollout, 41 | # but we recommend trying DWA first.) 42 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/text-base/base_local_planner_params.yaml.svn-base: -------------------------------------------------------------------------------- 1 | TrajectoryPlannerROS: 2 | # for details see: http://www.ros.org/wiki/base_local_planner 3 | max_vel_x: 0.5 4 | min_vel_x: 0.02 5 | max_rotational_vel: 1.0 # 0.1 rad/sec = 5.7 degree/sec 6 | min_in_place_rotational_vel: 0.2 7 | 8 | acc_lim_th: 1.0 9 | acc_lim_x: 0.2 10 | acc_lim_y: 0.2 11 | 12 | holonomic_robot: false 13 | 14 | # goal tolerance parameters 15 | yaw_goal_tolerance: 0.1 # 0.1 means 5.7 degrees 16 | xy_goal_tolerance: 0.2 17 | latch_xy_goal_tolerance: true 18 | 19 | # Forward Simulation Parameters 20 | sim_time: 1.5 # The amount of time to forward-simulate trajectories in seconds 21 | sim_granularity: 0.025 # The step size, in meters, to take between points on a given trajectory 22 | angular_sim_granularity: 0.05 # The step size, in radians, to take between angular samples on a given trajectory. 23 | vx_samples: 10 # The number of samples to use when exploring the x velocity space 24 | vtheta_samples: 20 # The number of samples to use when exploring the theta velocity space 25 | 26 | 27 | # Trajectory Scoring Parameters 28 | meter_scoring: true # If true, distances are expressed in meters; otherwise grid cells 29 | path_distance_bias: 0.6 # The weighting for how much the controller should stay close to the path it was given 30 | goal_distance_bias: 0.8 # The weighting for how much the controller should attempt to reach its local goal, also controls speed 31 | occdist_scale: 0.01 # The weighting for how much the controller should attempt to avoid obstacles 32 | # occdist_scale * (maximum obstacle cost along the trajectory in obstacle cost (0-254)) 33 | 34 | heading_lookahead: 0.325 # How far to look ahead in meters when scoring different in-place-rotation trajectories 35 | oscillation_reset_dist: 0.05 # How far the robot must travel in meters before oscillation flags are reset 36 | 37 | publish_cost_grid: true 38 | dwa: false # Whether to use the Dynamic Window Approach (DWA)_ or whether to use Trajectory Rollout 39 | # (NOTE: In our experience DWA worked as well as Trajectory Rollout and is computationally less expensive. 40 | # It is possible that robots with extremely poor acceleration limits could gain from running Trajectory Rollout, 41 | # but we recommend trying DWA first.) 42 | -------------------------------------------------------------------------------- /chapter_6_code/code_motor/motor_test/motor_test.ino: -------------------------------------------------------------------------------- 1 | 2 | // Quadrature encoders 3 | // Left encoder 4 | /// Pin 11 = PA_2 5 | ///Pin 31 = PF_4 6 | #define c_LeftEncoderPinA 11 7 | #define c_LeftEncoderPinB 31 8 | #define LeftEncoderIsReversed 9 | volatile bool _LeftEncoderBSet; 10 | volatile long _LeftEncoderTicks = 0; 11 | 12 | // Right encoder 13 | ///Pin 12 = PA_3 14 | ///Pin 32 = PD_7 15 | #define c_RightEncoderPinA 12 16 | #define c_RightEncoderPinB 32 17 | volatile bool _RightEncoderBSet; 18 | volatile long _RightEncoderTicks = 0; 19 | 20 | 21 | void setup() 22 | { 23 | Serial.begin(9600); 24 | 25 | 26 | // Quadrature encoders 27 | // Left encoder 28 | pinMode(c_LeftEncoderPinA, INPUT_PULLUP); // sets pin A as input 29 | pinMode(c_LeftEncoderPinB, INPUT_PULLUP); // sets pin B as input 30 | attachInterrupt(c_LeftEncoderPinA, HandleLeftMotorInterruptA, RISING); 31 | 32 | // Right encoder 33 | pinMode(c_RightEncoderPinA, INPUT_PULLUP); // sets pin A as input 34 | pinMode(c_RightEncoderPinB, INPUT_PULLUP); // sets pin B as input 35 | attachInterrupt(c_RightEncoderPinA, HandleRightMotorInterruptA, RISING); 36 | } 37 | 38 | void loop() 39 | { 40 | 41 | 42 | Serial.print("LeftEncoderTicks"); 43 | Serial.print("\t"); 44 | Serial.print(_LeftEncoderTicks); 45 | Serial.print("\t"); 46 | Serial.print("RightEncoderTicks"); 47 | Serial.print("\t"); 48 | Serial.print(_RightEncoderTicks); 49 | Serial.print("\n"); 50 | 51 | 52 | delay(20); // Wait for x milliseconds 53 | } 54 | 55 | 56 | // Interrupt service routines for the left motor's quadrature encoder 57 | void HandleLeftMotorInterruptA() 58 | { 59 | // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A 60 | _LeftEncoderBSet = digitalRead(c_LeftEncoderPinB); // read the input pin 61 | 62 | // and adjust counter + if A leads B 63 | #ifdef LeftEncoderIsReversed 64 | _LeftEncoderTicks -= _LeftEncoderBSet ? -1 : +1; 65 | #else 66 | _LeftEncoderTicks += _LeftEncoderBSet ? -1 : +1; 67 | #endif 68 | } 69 | 70 | // Interrupt service routines for the right motor's quadrature encoder 71 | void HandleRightMotorInterruptA() 72 | { 73 | // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A 74 | _RightEncoderBSet = digitalRead(c_RightEncoderPinB); // read the input pin 75 | 76 | // and adjust counter + if A leads B 77 | #ifdef RightEncoderIsReversed 78 | _RightEncoderTicks -= _RightEncoderBSet ? -1 : +1; 79 | #else 80 | _RightEncoderTicks += _RightEncoderBSet ? -1 : +1; 81 | #endif 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /chapter_6_code/code_motor/encoder_test_stellaris_test/encoder_test_stellaris_test.ino: -------------------------------------------------------------------------------- 1 | 2 | // Quadrature encoders 3 | // Left encoder 4 | /// Pin 11 = PA_2 5 | ///Pin 31 = PF_4 6 | #define c_LeftEncoderPinA 11 7 | #define c_LeftEncoderPinB 31 8 | #define LeftEncoderIsReversed 9 | volatile bool _LeftEncoderBSet; 10 | volatile long _LeftEncoderTicks = 0; 11 | 12 | // Right encoder 13 | ///Pin 12 = PA_3 14 | ///Pin 32 = PD_7 15 | #define c_RightEncoderPinA 12 16 | #define c_RightEncoderPinB 32 17 | volatile bool _RightEncoderBSet; 18 | volatile long _RightEncoderTicks = 0; 19 | 20 | 21 | void setup() 22 | { 23 | Serial.begin(9600); 24 | 25 | 26 | // Quadrature encoders 27 | // Left encoder 28 | pinMode(c_LeftEncoderPinA, INPUT_PULLUP); // sets pin A as input 29 | pinMode(c_LeftEncoderPinB, INPUT_PULLUP); // sets pin B as input 30 | attachInterrupt(c_LeftEncoderPinA, HandleLeftMotorInterruptA, RISING); 31 | 32 | // Right encoder 33 | pinMode(c_RightEncoderPinA, INPUT_PULLUP); // sets pin A as input 34 | pinMode(c_RightEncoderPinB, INPUT_PULLUP); // sets pin B as input 35 | attachInterrupt(c_RightEncoderPinA, HandleRightMotorInterruptA, RISING); 36 | } 37 | 38 | void loop() 39 | { 40 | 41 | 42 | Serial.print("LeftEncoderTicks"); 43 | Serial.print("\t"); 44 | Serial.print(_LeftEncoderTicks); 45 | Serial.print("\t"); 46 | Serial.print("RightEncoderTicks"); 47 | Serial.print("\t"); 48 | Serial.print(_RightEncoderTicks); 49 | Serial.print("\n"); 50 | 51 | 52 | delay(20); // Wait for x milliseconds 53 | } 54 | 55 | 56 | // Interrupt service routines for the left motor's quadrature encoder 57 | void HandleLeftMotorInterruptA() 58 | { 59 | // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A 60 | _LeftEncoderBSet = digitalRead(c_LeftEncoderPinB); // read the input pin 61 | 62 | // and adjust counter + if A leads B 63 | #ifdef LeftEncoderIsReversed 64 | _LeftEncoderTicks -= _LeftEncoderBSet ? -1 : +1; 65 | #else 66 | _LeftEncoderTicks += _LeftEncoderBSet ? -1 : +1; 67 | #endif 68 | } 69 | 70 | // Interrupt service routines for the right motor's quadrature encoder 71 | void HandleRightMotorInterruptA() 72 | { 73 | // Test transition; since the interrupt will only fire on 'rising' we don't need to read pin A 74 | _RightEncoderBSet = digitalRead(c_RightEncoderPinB); // read the input pin 75 | 76 | // and adjust counter + if A leads B 77 | #ifdef RightEncoderIsReversed 78 | _RightEncoderTicks -= _RightEncoderBSet ? -1 : +1; 79 | #else 80 | _RightEncoderTicks += _RightEncoderBSet ? -1 : +1; 81 | #endif 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /chapter_6_code/code_motor/encoder_test_stellaris_test/motor_test/motor_test.ino: -------------------------------------------------------------------------------- 1 | 2 | ///Left Motor Pins 3 | #define INA_1 PF_2 4 | #define INB_1 PF_3 5 | #define PWM_1 PB_3 6 | 7 | ///Right Motor Pins 8 | #define INA_2 PC_4 9 | #define INB_2 PC_5 10 | #define PWM_2 PC_6 11 | 12 | void move_forward() 13 | { 14 | ///Setting CW rotation to and Left Motor and CCW to Right Motor 15 | ///Left Motor 16 | digitalWrite(INA_1,HIGH); 17 | digitalWrite(INB_1,LOW); 18 | analogWrite(PWM_1,255); 19 | ///Right Motor 20 | digitalWrite(INA_2,LOW); 21 | digitalWrite(INB_2,HIGH); 22 | analogWrite(PWM_2,255); 23 | 24 | } 25 | 26 | void move_left() 27 | { 28 | ///Left Motor 29 | digitalWrite(INA_1,HIGH); 30 | digitalWrite(INB_1,HIGH); 31 | analogWrite(PWM_1,0); 32 | ///Right Motor 33 | digitalWrite(INA_2,LOW); 34 | digitalWrite(INB_2,HIGH); 35 | analogWrite(PWM_2,255); 36 | 37 | 38 | } 39 | 40 | void move_right() 41 | { 42 | ///Left Motor 43 | digitalWrite(INA_1,HIGH); 44 | digitalWrite(INB_1,LOW); 45 | analogWrite(PWM_1,255); 46 | ///Right Motor 47 | digitalWrite(INA_2,HIGH); 48 | digitalWrite(INB_2,HIGH); 49 | analogWrite(PWM_2,0); 50 | } 51 | 52 | void stop() 53 | { 54 | ///Left Motor 55 | digitalWrite(INA_1,HIGH); 56 | digitalWrite(INB_1,HIGH); 57 | analogWrite(PWM_1,0); 58 | ///Right Motor 59 | digitalWrite(INA_2,HIGH); 60 | digitalWrite(INB_2,HIGH); 61 | analogWrite(PWM_2,0); 62 | } 63 | 64 | void move_backward() 65 | 66 | { 67 | ///Left Motor 68 | digitalWrite(INA_1,LOW); 69 | digitalWrite(INB_1,HIGH); 70 | analogWrite(PWM_1,255); 71 | ///Right Motor 72 | digitalWrite(INA_2,HIGH); 73 | digitalWrite(INB_2,LOW); 74 | analogWrite(PWM_2,255); 75 | } 76 | void setup() 77 | { 78 | ///Setting Left Motor pin as OUTPUT 79 | pinMode(INA_1,OUTPUT); 80 | pinMode(INB_1,OUTPUT); 81 | pinMode(PWM_1,OUTPUT); 82 | 83 | ///Setting Right Motor pin as OUTPUT 84 | pinMode(INA_2,OUTPUT); 85 | pinMode(INB_2,OUTPUT); 86 | pinMode(PWM_2,OUTPUT); 87 | } 88 | void loop() 89 | { 90 | 91 | ///Move forward for 5 sec 92 | move_forward(); 93 | delay(5000); 94 | ///Stop for 1 sec 95 | stop(); 96 | delay(1000); 97 | ///Move backward for 5 sec 98 | move_backward(); 99 | delay(5000); 100 | ///Stop for 1 sec 101 | stop(); 102 | delay(1000); 103 | ///Move left for 5 sec 104 | move_left(); 105 | delay(5000); 106 | ///Stop for 1 sec 107 | stop(); 108 | delay(1000); 109 | ///Move right for 5 sec 110 | move_right(); 111 | delay(5000); 112 | ///Stop for 1 sec 113 | stop(); 114 | delay(1000); 115 | 116 | } 117 | 118 | 119 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/robot_standalone.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 0.3 19 | 14865 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 400 35 | 100 36 | 0 37 | -1023 38 | 1023 39 | 30 40 | 4 41 | 5 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 400 51 | 100 52 | 0 53 | -1023 54 | 1023 55 | 30 56 | 4 57 | 5 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/robot_standalone.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 0.3 19 | 14865 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 400 35 | 100 36 | 0 37 | -1023 38 | 1023 39 | 30 40 | 4 41 | 5 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 400 51 | 100 52 | 0 53 | -1023 54 | 1023 55 | 30 56 | 4 57 | 5 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /chapter_6_code/code_motor/simple_motor_test: -------------------------------------------------------------------------------- 1 | ///Left Motor Pins 2 | #define INA_1 12 3 | #define INB_1 13 4 | #define PWM_1 35 5 | 6 | ///Right Motor Pins 7 | #define INA_2 5 8 | #define INB_2 6 9 | #define PWM_2 36 10 | 11 | 12 | 13 | void setup() 14 | { 15 | 16 | //Setting Left Motor pin as OUTPUT 17 | pinMode(INA_1,OUTPUT); 18 | pinMode(INB_1,OUTPUT); 19 | 20 | //Setting Right Motor pin as OUTPUT 21 | pinMode(INA_2,OUTPUT); 22 | pinMode(INB_2,OUTPUT); 23 | } 24 | 25 | 26 | void loop() 27 | { 28 | 29 | //Move forward for 5 sec 30 | move_forward(); 31 | delay(5000); 32 | 33 | //Stop for 1 sec 34 | stop(); 35 | delay(1000); 36 | 37 | //Move backward for 5 sec 38 | move_backward(); 39 | delay(5000); 40 | 41 | //Stop for 1 sec 42 | stop(); 43 | delay(1000); 44 | 45 | //Move left for 5 sec 46 | move_left(); 47 | delay(5000); 48 | 49 | //Stop for 1 sec 50 | stop(); 51 | delay(1000); 52 | 53 | //Move right for 5 sec 54 | move_right(); 55 | delay(5000); 56 | 57 | //Stop for 1 sec 58 | stop(); 59 | delay(1000); 60 | 61 | } 62 | 63 | void move_forward() 64 | { 65 | //Setting CW rotation to and Left Motor and CCW to Right Motor 66 | //Left Motor 67 | 68 | digitalWrite(INA_1,HIGH); 69 | digitalWrite(INB_1,LOW); 70 | analogWrite(PWM_1,255); 71 | 72 | //Right Motor 73 | digitalWrite(INA_2,LOW); 74 | digitalWrite(INB_2,HIGH); 75 | analogWrite(PWM_2,255); 76 | 77 | } 78 | 79 | 80 | 81 | void move_left() 82 | { 83 | 84 | //Left Motor 85 | digitalWrite(INA_1,HIGH); 86 | digitalWrite(INB_1,HIGH); 87 | analogWrite(PWM_1,0); 88 | 89 | //Right Motor 90 | digitalWrite(INA_2,LOW); 91 | digitalWrite(INB_2,HIGH); 92 | analogWrite(PWM_2,255); 93 | 94 | 95 | } 96 | 97 | void move_right() 98 | { 99 | 100 | //Left Motor 101 | digitalWrite(INA_1,HIGH); 102 | digitalWrite(INB_1,LOW); 103 | analogWrite(PWM_1,255); 104 | 105 | //Right Motor 106 | digitalWrite(INA_2,HIGH); 107 | digitalWrite(INB_2,HIGH); 108 | analogWrite(PWM_2,0); 109 | } 110 | 111 | void stop() 112 | { 113 | 114 | //Left Motor 115 | digitalWrite(INA_1,HIGH); 116 | digitalWrite(INB_1,HIGH); 117 | analogWrite(PWM_1,0); 118 | 119 | //Right Motor 120 | digitalWrite(INA_2,HIGH); 121 | digitalWrite(INB_2,HIGH); 122 | analogWrite(PWM_2,0); 123 | } 124 | 125 | ///////////////////////////////////////////////// 126 | 127 | void move_backward() 128 | 129 | { 130 | 131 | //Left Motor 132 | digitalWrite(INA_1,LOW); 133 | digitalWrite(INB_1,HIGH); 134 | analogWrite(PWM_1,255); 135 | 136 | //Right Motor 137 | digitalWrite(INA_2,HIGH); 138 | digitalWrite(INB_2,LOW); 139 | analogWrite(PWM_2,255); 140 | } 141 | -------------------------------------------------------------------------------- /chapter_6_code/code_motor/simple_motor_test.ino: -------------------------------------------------------------------------------- 1 | ///Left Motor Pins 2 | #define INA_1 12 3 | #define INB_1 13 4 | #define PWM_1 35 5 | 6 | ///Right Motor Pins 7 | #define INA_2 5 8 | #define INB_2 6 9 | #define PWM_2 36 10 | 11 | 12 | 13 | void setup() 14 | { 15 | 16 | //Setting Left Motor pin as OUTPUT 17 | pinMode(INA_1,OUTPUT); 18 | pinMode(INB_1,OUTPUT); 19 | 20 | //Setting Right Motor pin as OUTPUT 21 | pinMode(INA_2,OUTPUT); 22 | pinMode(INB_2,OUTPUT); 23 | } 24 | 25 | 26 | void loop() 27 | { 28 | 29 | //Move forward for 5 sec 30 | move_forward(); 31 | delay(5000); 32 | 33 | //Stop for 1 sec 34 | stop(); 35 | delay(1000); 36 | 37 | //Move backward for 5 sec 38 | move_backward(); 39 | delay(5000); 40 | 41 | //Stop for 1 sec 42 | stop(); 43 | delay(1000); 44 | 45 | //Move left for 5 sec 46 | move_left(); 47 | delay(5000); 48 | 49 | //Stop for 1 sec 50 | stop(); 51 | delay(1000); 52 | 53 | //Move right for 5 sec 54 | move_right(); 55 | delay(5000); 56 | 57 | //Stop for 1 sec 58 | stop(); 59 | delay(1000); 60 | 61 | } 62 | 63 | void move_forward() 64 | { 65 | //Setting CW rotation to and Left Motor and CCW to Right Motor 66 | //Left Motor 67 | 68 | digitalWrite(INA_1,HIGH); 69 | digitalWrite(INB_1,LOW); 70 | analogWrite(PWM_1,255); 71 | 72 | //Right Motor 73 | digitalWrite(INA_2,LOW); 74 | digitalWrite(INB_2,HIGH); 75 | analogWrite(PWM_2,255); 76 | 77 | } 78 | 79 | 80 | 81 | void move_left() 82 | { 83 | 84 | //Left Motor 85 | digitalWrite(INA_1,HIGH); 86 | digitalWrite(INB_1,HIGH); 87 | analogWrite(PWM_1,0); 88 | 89 | //Right Motor 90 | digitalWrite(INA_2,LOW); 91 | digitalWrite(INB_2,HIGH); 92 | analogWrite(PWM_2,255); 93 | 94 | 95 | } 96 | 97 | void move_right() 98 | { 99 | 100 | //Left Motor 101 | digitalWrite(INA_1,HIGH); 102 | digitalWrite(INB_1,LOW); 103 | analogWrite(PWM_1,255); 104 | 105 | //Right Motor 106 | digitalWrite(INA_2,HIGH); 107 | digitalWrite(INB_2,HIGH); 108 | analogWrite(PWM_2,0); 109 | } 110 | 111 | void stop() 112 | { 113 | 114 | //Left Motor 115 | digitalWrite(INA_1,HIGH); 116 | digitalWrite(INB_1,HIGH); 117 | analogWrite(PWM_1,0); 118 | 119 | //Right Motor 120 | digitalWrite(INA_2,HIGH); 121 | digitalWrite(INB_2,HIGH); 122 | analogWrite(PWM_2,0); 123 | } 124 | 125 | ///////////////////////////////////////////////// 126 | 127 | void move_backward() 128 | 129 | { 130 | 131 | //Left Motor 132 | digitalWrite(INA_1,LOW); 133 | digitalWrite(INB_1,HIGH); 134 | analogWrite(PWM_1,255); 135 | 136 | //Right Motor 137 | digitalWrite(INA_2,HIGH); 138 | digitalWrite(INB_2,LOW); 139 | analogWrite(PWM_2,255); 140 | } 141 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/launch/includes/amcl.launch.xml: -------------------------------------------------------------------------------- 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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/launch/includes/amcl.launch.xml: -------------------------------------------------------------------------------- 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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/includes/amcl.launch.xml: -------------------------------------------------------------------------------- 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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/includes/amcl.launch.xml: -------------------------------------------------------------------------------- 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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/param/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 108 5 | http://drh-robotics-ros.googlecode.com/svn/trunk/ros/ardros/info 6 | http://drh-robotics-ros.googlecode.com/svn 7 | 8 | 9 | 10 | 2012-02-12T02:56:32.317308Z 11 | 107 12 | rainer.hessmer@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 68273211-c61b-7362-29f3-f04ef5221297 28 | 29 | global_costmap_params.yaml 30 | file 31 | 32 | 33 | 34 | 35 | 2014-06-20T12:39:09.847319Z 36 | c68c7ceb113b3b757645ce2752d6989d 37 | 2012-02-05T18:40:17.337678Z 38 | 105 39 | rainer.hessmer@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 174 62 | 63 | ardros.yaml 64 | file 65 | 66 | 67 | 68 | 69 | 2014-06-20T12:39:09.847319Z 70 | e0272821405b642a0586ea07e9f6e6b1 71 | 2012-02-05T18:40:17.337678Z 72 | 105 73 | rainer.hessmer@gmail.com 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1458 96 | 97 | joystick.yaml 98 | file 99 | 100 | 101 | 102 | 103 | 2014-06-20T12:39:09.839319Z 104 | 94e19b29093627ec1db6b5914ec07583 105 | 2011-02-20T22:28:44.452775Z 106 | 54 107 | rainer.hessmer 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 20 130 | 131 | costmap_common_params.yaml 132 | file 133 | 134 | 135 | 136 | 137 | 2014-06-20T12:39:09.839319Z 138 | 0f6a9214fe2e4c2f8f399d97b8f68a31 139 | 2012-02-12T02:56:32.317308Z 140 | 107 141 | rainer.hessmer@gmail.com 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 672 164 | 165 | local_costmap_params.yaml 166 | file 167 | 168 | 169 | 170 | 171 | 2014-06-20T12:39:09.843319Z 172 | ccac2c8cc4a646b084988cce6dab752d 173 | 2012-02-05T18:40:17.337678Z 174 | 105 175 | rainer.hessmer@gmail.com 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 265 198 | 199 | base_local_planner_params.yaml 200 | file 201 | 202 | 203 | 204 | 205 | 2014-06-20T12:39:09.843319Z 206 | c7bcf81761eadf7d9154ab9a2e00a1fe 207 | 2012-02-12T02:56:32.317308Z 208 | 107 209 | rainer.hessmer@gmail.com 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 2400 232 | 233 | teleop.yaml 234 | file 235 | 236 | 237 | 238 | 239 | 2014-06-20T12:39:09.843319Z 240 | 12e25af8ec151a8aaa088c3bf35e3281 241 | 2011-02-20T22:28:44.452775Z 242 | 54 243 | rainer.hessmer 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 90 266 | 267 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/param/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 108 5 | http://drh-robotics-ros.googlecode.com/svn/trunk/ros/ardros/info 6 | http://drh-robotics-ros.googlecode.com/svn 7 | 8 | 9 | 10 | 2012-02-12T02:56:32.317308Z 11 | 107 12 | rainer.hessmer@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 68273211-c61b-7362-29f3-f04ef5221297 28 | 29 | global_costmap_params.yaml 30 | file 31 | 32 | 33 | 34 | 35 | 2014-06-20T12:39:09.847319Z 36 | c68c7ceb113b3b757645ce2752d6989d 37 | 2012-02-05T18:40:17.337678Z 38 | 105 39 | rainer.hessmer@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 174 62 | 63 | ardros.yaml 64 | file 65 | 66 | 67 | 68 | 69 | 2014-06-20T12:39:09.847319Z 70 | e0272821405b642a0586ea07e9f6e6b1 71 | 2012-02-05T18:40:17.337678Z 72 | 105 73 | rainer.hessmer@gmail.com 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1458 96 | 97 | joystick.yaml 98 | file 99 | 100 | 101 | 102 | 103 | 2014-06-20T12:39:09.839319Z 104 | 94e19b29093627ec1db6b5914ec07583 105 | 2011-02-20T22:28:44.452775Z 106 | 54 107 | rainer.hessmer 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 20 130 | 131 | costmap_common_params.yaml 132 | file 133 | 134 | 135 | 136 | 137 | 2014-06-20T12:39:09.839319Z 138 | 0f6a9214fe2e4c2f8f399d97b8f68a31 139 | 2012-02-12T02:56:32.317308Z 140 | 107 141 | rainer.hessmer@gmail.com 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 672 164 | 165 | local_costmap_params.yaml 166 | file 167 | 168 | 169 | 170 | 171 | 2014-06-20T12:39:09.843319Z 172 | ccac2c8cc4a646b084988cce6dab752d 173 | 2012-02-05T18:40:17.337678Z 174 | 105 175 | rainer.hessmer@gmail.com 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 265 198 | 199 | base_local_planner_params.yaml 200 | file 201 | 202 | 203 | 204 | 205 | 2014-06-20T12:39:09.843319Z 206 | c7bcf81761eadf7d9154ab9a2e00a1fe 207 | 2012-02-12T02:56:32.317308Z 208 | 107 209 | rainer.hessmer@gmail.com 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 2400 232 | 233 | teleop.yaml 234 | file 235 | 236 | 237 | 238 | 239 | 2014-06-20T12:39:09.843319Z 240 | 12e25af8ec151a8aaa088c3bf35e3281 241 | 2011-02-20T22:28:44.452775Z 242 | 54 243 | rainer.hessmer 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 90 266 | 267 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/ultrasonic_sensor/ultrasonic_sensor.ino: -------------------------------------------------------------------------------- 1 | 2 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 3 | //Ultrasonic pins definition 4 | const int echo = 9, Trig = 10; 5 | long duration, cm; 6 | 7 | ///////////////////////////////////////////////////////////////////////////////////////// 8 | //Time update variables 9 | 10 | unsigned long LastUpdateMicrosecs = 0; 11 | unsigned long LastUpdateMillisecs = 0; 12 | unsigned long CurrentMicrosecs = 0; 13 | unsigned long MicrosecsSinceLastUpdate = 0; 14 | float SecondsSinceLastUpdate = 0; 15 | 16 | 17 | void setup() 18 | { 19 | 20 | //Init Serial port with 115200 buad rate 21 | Serial.begin(115200); 22 | SetupUltrasonic(); 23 | 24 | 25 | 26 | } 27 | 28 | 29 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 30 | //Setup UltrasonicsSensor() function 31 | void SetupUltrasonic() 32 | { 33 | pinMode(Trig, OUTPUT); 34 | pinMode(echo, INPUT); 35 | 36 | } 37 | 38 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 39 | //MAIN LOOP 40 | 41 | 42 | 43 | void loop() 44 | { 45 | 46 | Update_Ultra_Sonic(); 47 | delay(200); 48 | 49 | } 50 | 51 | 52 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 53 | //Will update ultrasonic sensors through serial port 54 | 55 | void Update_Ultra_Sonic() 56 | { 57 | digitalWrite(Trig, LOW); 58 | delayMicroseconds(2); 59 | digitalWrite(Trig, HIGH); 60 | delayMicroseconds(10); 61 | digitalWrite(Trig, LOW); 62 | // The echo pin is used to read the signal from the PING))): a HIGH 63 | // pulse whose duration is the time (in microseconds) from the sending 64 | // of the ping to the reception of its echo off of an object. 65 | duration = pulseIn(echo, HIGH); 66 | // convert the time into a distance 67 | cm = microsecondsToCentimeters(duration); 68 | 69 | //Sending through serial port 70 | Serial.print("Distance="); 71 | Serial.print("\t"); 72 | Serial.print(cm); 73 | Serial.print("\n"); 74 | 75 | } 76 | 77 | 78 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 79 | 80 | //Conversion of microsecond to centimeter 81 | long microsecondsToCentimeters(long microseconds) 82 | { 83 | // The speed of sound is 340 m/s or 29 microseconds per centimeter. 84 | // The ping travels out and back, so to find the distance of the 85 | // object we take half of the distance travelled. 86 | return microseconds / 29 / 2; 87 | } 88 | 89 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 90 | 91 | -------------------------------------------------------------------------------- /chapter_4_code/chefbot_gazebo/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chefbot_gazebo 4 | 0.0.0 5 | The chefbot_gazebo package 6 | 7 | 8 | 9 | 10 | lentin 11 | 12 | 13 | 14 | 15 | 16 | TODO 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 | catkin 52 | robot_state_publisher 53 | urdf 54 | xacro 55 | robot_state_publisher 56 | urdf 57 | xacro 58 | robot_state_publisher 59 | urdf 60 | xacro 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /chapter_6_code/code_sensor/new_robot_code_with_sensors/new_robot_code_with_sensors.ino: -------------------------------------------------------------------------------- 1 | 2 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 3 | //Ultrasonic pins definition 4 | const int echo = 9, Trig = 10; 5 | long duration, cm; 6 | 7 | ///////////////////////////////////////////////////////////////////////////////////////// 8 | //Time update variables 9 | 10 | unsigned long LastUpdateMicrosecs = 0; 11 | unsigned long LastUpdateMillisecs = 0; 12 | unsigned long CurrentMicrosecs = 0; 13 | unsigned long MicrosecsSinceLastUpdate = 0; 14 | float SecondsSinceLastUpdate = 0; 15 | 16 | 17 | void setup() 18 | { 19 | 20 | //Init Serial port with 115200 buad rate 21 | Serial.begin(115200); 22 | SetupUltrasonic(); 23 | 24 | 25 | 26 | } 27 | 28 | 29 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 30 | //Setup UltrasonicsSensor() function 31 | void SetupUltrasonic() 32 | { 33 | pinMode(Trig, OUTPUT); 34 | pinMode(echo, INPUT); 35 | 36 | } 37 | 38 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 39 | //MAIN LOOP 40 | 41 | 42 | 43 | void loop() 44 | { 45 | 46 | Update_Ultra_Sonic(); 47 | delay(200); 48 | 49 | } 50 | 51 | 52 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 53 | //Will update ultrasonic sensors through serial port 54 | 55 | void Update_Ultra_Sonic() 56 | { 57 | digitalWrite(Trig, LOW); 58 | delayMicroseconds(2); 59 | digitalWrite(Trig, HIGH); 60 | delayMicroseconds(10); 61 | digitalWrite(Trig, LOW); 62 | // The echo pin is used to read the signal from the PING))): a HIGH 63 | // pulse whose duration is the time (in microseconds) from the sending 64 | // of the ping to the reception of its echo off of an object. 65 | duration = pulseIn(echo, HIGH); 66 | // convert the time into a distance 67 | cm = microsecondsToCentimeters(duration); 68 | 69 | //Sending through serial port 70 | Serial.print("u"); 71 | Serial.print("\t"); 72 | Serial.print(cm); 73 | Serial.print("\n"); 74 | 75 | } 76 | 77 | 78 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 79 | 80 | //Conversion of microsecond to centimeter 81 | long microsecondsToCentimeters(long microseconds) 82 | { 83 | // The speed of sound is 340 m/s or 29 microseconds per centimeter. 84 | // The ping travels out and back, so to find the distance of the 85 | // object we take half of the distance travelled. 86 | return microseconds / 29 / 2; 87 | } 88 | 89 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 90 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_gazebo/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chefbot_gazebo 4 | 0.0.0 5 | The chefbot_gazebo package 6 | 7 | 8 | 9 | 10 | lentin 11 | 12 | 13 | 14 | 15 | 16 | TODO 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 | catkin 52 | robot_state_publisher 53 | urdf 54 | xacro 55 | robot_state_publisher 56 | urdf 57 | xacro 58 | robot_state_publisher 59 | urdf 60 | xacro 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chefbot_bringup 4 | 0.0.0 5 | The chefbot_bringup package 6 | 7 | 8 | 9 | 10 | lentin 11 | 12 | 13 | 14 | 15 | 16 | TODO 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 | catkin 43 | actionlib 44 | depthimage_to_laserscan 45 | geometry_msgs 46 | move_base_msgs 47 | nav_msgs 48 | openni_launch 49 | robot_pose_ekf 50 | robot_state_publisher 51 | roscpp 52 | rospy 53 | std_msgs 54 | tf 55 | actionlib 56 | depthimage_to_laserscan 57 | geometry_msgs 58 | move_base_msgs 59 | nav_msgs 60 | openni_launch 61 | robot_pose_ekf 62 | robot_state_publisher 63 | roscpp 64 | rospy 65 | std_msgs 66 | tf 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | chefbot_bringup 4 | 0.0.0 5 | The chefbot_bringup package 6 | 7 | 8 | 9 | 10 | lentin 11 | 12 | 13 | 14 | 15 | 16 | TODO 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 | catkin 43 | actionlib 44 | depthimage_to_laserscan 45 | geometry_msgs 46 | move_base_msgs 47 | nav_msgs 48 | openni_launch 49 | robot_pose_ekf 50 | robot_state_publisher 51 | roscpp 52 | rospy 53 | std_msgs 54 | tf 55 | actionlib 56 | depthimage_to_laserscan 57 | geometry_msgs 58 | move_base_msgs 59 | nav_msgs 60 | openni_launch 61 | robot_pose_ekf 62 | robot_state_publisher 63 | roscpp 64 | rospy 65 | std_msgs 66 | tf 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/launch/3dsensor_astra.launch: -------------------------------------------------------------------------------- 1 | 16 | 17 | 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 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /chapter_9_code/chefbot_bringup/launch/3dsensor_astra.launch: -------------------------------------------------------------------------------- 1 | 16 | 17 | 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 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /chapter_8_code/chefbot_bringup/scripts/twist_to_motors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | twist_to_motors - converts a twist message to motor commands. Needed for navigation stack 4 | 5 | 6 | Copyright (C) 2012 Jon Stephan. 7 | 8 | This program is free software: you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation, either version 3 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | """ 21 | 22 | import rospy 23 | import roslib 24 | from std_msgs.msg import Float32 25 | from geometry_msgs.msg import Twist 26 | 27 | ############################################################# 28 | ############################################################# 29 | class TwistToMotors(): 30 | ############################################################# 31 | ############################################################# 32 | 33 | ############################################################# 34 | def __init__(self): 35 | ############################################################# 36 | rospy.init_node("twist_to_motors") 37 | nodename = rospy.get_name() 38 | rospy.loginfo("%s started" % nodename) 39 | 40 | self.w = rospy.get_param("~base_width", 0.2) 41 | 42 | self.pub_lmotor = rospy.Publisher('lwheel_vtarget', Float32,queue_size=10) 43 | self.pub_rmotor = rospy.Publisher('rwheel_vtarget', Float32,queue_size=10) 44 | rospy.Subscriber('cmd_vel', Twist, self.twistCallback) 45 | 46 | 47 | self.rate = rospy.get_param("~rate", 50) 48 | self.timeout_ticks = rospy.get_param("~timeout_ticks", 2) 49 | self.left = 0 50 | self.right = 0 51 | 52 | ############################################################# 53 | def spin(self): 54 | ############################################################# 55 | 56 | r = rospy.Rate(self.rate) 57 | idle = rospy.Rate(10) 58 | then = rospy.Time.now() 59 | self.ticks_since_target = self.timeout_ticks 60 | 61 | ###### main loop ###### 62 | while not rospy.is_shutdown(): 63 | 64 | while not rospy.is_shutdown() and self.ticks_since_target < self.timeout_ticks: 65 | self.spinOnce() 66 | r.sleep() 67 | idle.sleep() 68 | 69 | ############################################################# 70 | def spinOnce(self): 71 | ############################################################# 72 | 73 | # dx = (l + r) / 2 74 | # dr = (r - l) / w 75 | 76 | self.right = 1.0 * self.dx + self.dr * self.w / 2 77 | self.left = 1.0 * self.dx - self.dr * self.w / 2 78 | # rospy.loginfo("publishing: (%d, %d)", left, right) 79 | 80 | self.pub_lmotor.publish(self.left) 81 | self.pub_rmotor.publish(self.right) 82 | 83 | self.ticks_since_target += 1 84 | 85 | ############################################################# 86 | def twistCallback(self,msg): 87 | ############################################################# 88 | # rospy.loginfo("-D- twistCallback: %s" % str(msg)) 89 | self.ticks_since_target = 0 90 | self.dx = msg.linear.x 91 | self.dr = msg.angular.z 92 | self.dy = msg.linear.y 93 | 94 | ############################################################# 95 | ############################################################# 96 | if __name__ == '__main__': 97 | """ main """ 98 | twistToMotors = TwistToMotors() 99 | twistToMotors.spin() 100 | --------------------------------------------------------------------------------