Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# Learning ROS for Robotics Programming - Second Edition #

**Learning ROS for Robotics Programming - Second Edition** book tutorials source code.
[**Learning ROS for Robotics Programming - Second Edition**](https://www.packtpub.com/hardware-and-creative/learning-ros-robotics-programming-%E2%80%93-second-edition) book tutorials source code.

<a href="https://www.packtpub.com/hardware-and-creative/learning-ros-robotics-programming-%E2%80%93-second-edition"><img src=https://www.packtpub.com/sites/default/files/7580OS_Learning%20ROS%20for%20Robotics%20Programming%20-%20Second%20Edition.jpg width=200/></a>

## Authors ##

* Aaron Martínez
* Anil Mahtani
* Enrique Fernández
* Luiz Sánchez
* [Enrique Fernández](https://github.com/efernandez)
* [Luis Sánchez Crespo](https://github.com/LuisSC)
* [Anil Mahtani](https://github.com/Anilm3)
* [Aaron Martínez](https://github.com/AaronMR)

## Installation ##

Install **ROS Hydro** on a compatible **Ubuntu** distro following the official instructions provided [here](http://wiki.ros.org/hydro/Installation/Ubuntu).
Note that **ROS Indigo** might also work for most of the source code.
Install **ROS Jade** on a compatible **Ubuntu** distro following the official instructions provided [here](http://wiki.ros.org/hydro/Installation/Ubuntu).

For **ROS Hydro** use the [**hydro-devel**](https://github.com/AaronMR/Learning_ROS_for_Robotics_Programming_2nd_edition/tree/hydro-devel) branch.

For **ROS Indigo** use the [**indigo-devel**](https://github.com/AaronMR/Learning_ROS_for_Robotics_Programming_2nd_edition/tree/indigo-devel) branch.

Install the OpenCV non-free repository:
``` bash
sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get install libopencv-nonfree-dev libopencv-nonfree2.4
```

Create a workspace:
``` bash
Expand All @@ -23,7 +34,7 @@ wstool init

Download this repository:
``` bash
wstool set ROS_Book_Hydro --git git@github.com:AaronMR/ROS_Book_Hydro.git
wstool set ros_book --git git@github.com:AaronMR/Learning_ROS_for_Robotics_Programming_2nd_edition.git
wstool up -j8
```

Expand All @@ -33,17 +44,16 @@ cd ..
rosdep install --from-paths src -iy
```

source /opt/ros/$(rosversion -d)/setup.bash

Build the source code (alternatively, you can use `catkin build` instead of `catkin_make`):
``` bash
source /opt/ros/$(rosversion -d)/setup.bash
catkin_make -j4
source devel/setup.bash
```

## Tutorials ##

* **Chapter 1:** Getting started with ROS Hydro (no source code as it covers the installation)
* **Chapter 1:** Getting started with ROS (no source code as it covers the installation)
* **Chapter 2:** ROS Architecture and Concepts
* **Chapter 3:** Visualization and Debug Tools
* **Chapter 4:** Using Sensors and Actuators with ROS
Expand Down
4 changes: 4 additions & 0 deletions chapter5_tutorials/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<build_depend>camera_info_manager</build_depend>
<build_depend>tf</build_depend>

<build_depend>libopencv-dev</build_depend>

<run_depend>roscpp</run_depend>
<run_depend>message_runtime</run_depend>
<run_depend>sensor_msgs</run_depend>
Expand All @@ -31,4 +33,6 @@
<run_depend>image_transport</run_depend>
<run_depend>camera_info_manager</run_depend>
<run_depend>tf</run_depend>

<run_depend>libopencv-dev</run_depend>
</package>
161 changes: 12 additions & 149 deletions chapter9_tutorials/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,166 +1,29 @@
cmake_minimum_required(VERSION 2.8.3)
project(chapter9_tutorials)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
move_base_msgs
actionlib
tf
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
catkin_package()


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependencies might have been
## pulled in transitively but can be declared for certainty nonetheless:
## * add a build_depend tag for "message_generation"
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# std_msgs # Or other packages containing msgs
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES chapter9_tutorials
# CATKIN_DEPENDS roscpp rospy
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)

## Declare a cpp library
# add_library(chapter9_tutorials
# src/${PROJECT_NAME}/chapter9_tutorials.cpp
# )

## Declare a cpp executable
# add_executable(chapter9_tutorials_node src/chapter9_tutorials_node.cpp)
add_executable(sendGoals src/sendGoals.cpp)

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(chapter9_tutorials_node chapter9_tutorials_generate_messages_cpp)

## Specify libraries to link a library or executable target against
# target_link_libraries(chapter9_tutorials_node
# ${catkin_LIBRARIES}
# )

target_link_libraries(sendGoals ${catkin_LIBRARIES})

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS chapter9_tutorials chapter9_tutorials_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_chapter9_tutorials.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
install(TARGETS sendGoals
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
foreach(dir launch maps)
install(DIRECTORY ${dir}/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
endforeach(dir)
34 changes: 22 additions & 12 deletions chapter9_tutorials/launch/chapter9_configuration_gazebo.launch
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
<?xml version="1.0"?>
<launch>
<arg name="model" default="$(find robot1_description)/urdf/robot1_base_04.xacro"/>

<param name="/use_sim_time" value="true" />
<param name="/use_sim_time" value="true" />
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />

<remap from="robot/laser/scan" to="/scan" />
<!-- start up wg world -->
<include file="$(find gazebo_ros)/launch/willowgarage_world.launch" args="gui:=false">
</include>
<remap from="robot/laser/scan" to="/scan" />

<arg name="model" default="$(find robot1_description)/urdf/robot1_base_04.xacro"/>
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
<!-- start up wg world -->
<!-- We cannot call willowgarage_world.launch setting the gui arg to false
because that launch file doesn't take any arg.
Instead we call empty_world.launch with the same args that are set in
willowgarage_world.launch, expect for gui, which is changed to false. -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="worlds/willowgarage.world"/> <!-- Note: the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable -->
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="false"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" ></node>
<!-- start robot state publisher -->
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen" />
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>

<node name="spawn_robot" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -z 0.1 -model robot_model" respawn="false" output="screen" />
<!-- start robot state publisher -->
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen"/>

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find chapter9_tutorials)/launch/navigation.rviz" />
<node name="spawn_robot" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -z 0.1 -model robot_model" respawn="false" output="screen"/>

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find chapter9_tutorials)/launch/navigation.rviz"/>
</launch>

67 changes: 21 additions & 46 deletions chapter9_tutorials/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,29 @@
<version>0.0.0</version>
<description>The chapter9_tutorials package</description>

<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="retrorov-laptop@todo.todo">retrorov-laptop</maintainer>
<maintainer email="enrique.fernandez.perdomo@gmail.com">Enrique Fernandez</maintainer>
<author email="enrique.fernandez.perdomo@gmail.com">Enrique Fernandez</author>

<license>BSD</license>

<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>


<!-- Url tags are optional, but mutiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/chapter9_tutorials</url> -->


<!-- Author tags are optional, mutiple are allowed, one per tag -->
<!-- Authors do not have to be maintianers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->


<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>


<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- You can specify that this package is a metapackage here: -->
<!-- <metapackage/> -->

<!-- Other tools can request additional information be placed here -->
<build_depend>roscpp</build_depend>
<build_depend>move_base_msgs</build_depend>
<build_depend>actionlib</build_depend>
<build_depend>tf</build_depend>

</export>
</package>
<run_depend>roscpp</run_depend>
<run_depend>move_base_msgs</run_depend>
<run_depend>actionlib</run_depend>
<run_depend>tf</run_depend>
<run_depend>amcl</run_depend>
<run_depend>gazebo_ros</run_depend>
<run_depend>xacro</run_depend>
<run_depend>move_base</run_depend>
<run_depend>map_server</run_depend>
<run_depend>joint_state_publisher</run_depend>
<run_depend>robot_state_publisher</run_depend>
<run_depend>rviz</run_depend>
<run_depend>robot1_description</run_depend>
</package>