Add "gazebo_ros_pkgs" to adapt the MPI Gazebo for naming ros node

This commit is contained in:
zhangshuai 2019-05-13 10:45:18 +08:00
parent c0e54f156d
commit fdeebf78ea
321 changed files with 38183 additions and 0 deletions

35
gazebo_ros_pkgs/CONTRIBUTING.md Executable file
View File

@ -0,0 +1,35 @@
# How to Contribute
We welcome contributions to this repo and encourage you to fork the project, thanks!
## Implementations of simulations
It is highly recommended to place the code that performs simulation inside
[upstream gazebo code](https://bitbucket.org/osrf/gazebo/). The Gazebo project
provides documentation about [how to create and code
plugins](http://gazebosim.org/tutorials?cat=write_plugin) Ideally
gazebo_ros_pkgs should implement the ROS wrapper over an existing gazebo
plugin.
## Issues and Pull Requests
There are several maintainers of different packages in this repository. If you
are submitting an issue or a pull request, please prefix the title of the issue
or pull resquest with the package name. This way the appropriate maintainers
can more easily recognize contributions which require their attention.
## Style
We follow the [C++ ROS style guidelines](http://ros.org/wiki/CppStyleGuide) and
conventions as closely as possible. However, because the plugins inherit from Gazebo
classes and Gazebo follows a very different formatting standard, there are a few
exceptions where Gazebo's function names do not comply to the ROS guidelines.
## Tests
We encourage developers to include tests in their pull requests when possible,
both for bug fixes and new features.
Examples of tests are in the `gazebo_plugins/test*` folders.
Currently the tests must not be run in parallel (see issue
[issue 409](https://github.com/ros-simulation/gazebo_ros_pkgs/issues/409))
so it is recommented to use the `-j1` argument to `catkin run_tests`.

17
gazebo_ros_pkgs/README.md Executable file
View File

@ -0,0 +1,17 @@
# gazebo_ros_pkgs
[![Build Status](http://build.ros.org/buildStatus/icon?job=Kpr__gazebo_ros_pkgs__ubuntu_xenial_amd64)](http://build.ros.org/job/Kpr__gazebo_ros_pkgs__ubuntu_xenial_amd64)
Wrappers, tools and additional API's for using ROS with the Gazebo simulator. Formally simulator_gazebo stack, gazebo_pkgs is a meta package. Now Catkinized and works with the standalone Gazebo debian.
### Installation
[Installing gazebo_ros_pkgs](http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros)
### Documentation and Tutorials
[On gazebosim.org](http://gazebosim.org/tutorials?cat=connect_ros)
### Develop and Contribute
See [Contribute](https://github.com/ros-simulation/gazebo_ros_pkgs/blob/hydro-devel/CONTRIBUTING.md) page.

241
gazebo_ros_pkgs/SENSORS.md Executable file
View File

@ -0,0 +1,241 @@
# Plugins supported in Gazebo ROS packages
## Initial note
As detailed in the CONTRIBUITON.md guide, Gazebo ROS packages are a wrapper that
connects upstream Gazebo simulations with the ROS framework. Ideally all the
plugins in this repository should implement the ROS wrapper over a gazebo plugin
(plugin code in the [upstream gazebo repository](https://bitbucket.org/osrf/gazebo/)).
## Sensors
### Template
- ***description:*** short description of the wrapper.
- ***status:***
- **maintained**: no big issues, should work fine
- **autotest**: the wrapper has automatic tests
- **doxygen**: the wrapper implements doxygen comments
- **needs-cleanup**: the code of the wrapper should be improved
- **not-just-a-wrapper**: the code in this repo is not just a wrapper and
contains simulation code. The simulation code should be migrated to
the Gazebo repository.
- ***gazebo plugin:*** gazebo upstream plugin used by the wrapper
- ***example:*** example files that use the wrapper
### ROS wrappers for Gazebo upstream sensors
* ***gazebo_ros_block_laser***
- ***description:*** implements ray based sensors (lasers). Publishes
sensors_msgs::PointCloud.
- ***status:*** maintained
- ***gazebo plugin:*** RayPlugin
- ***example:*** gazebo_plugins/test/test_worlds/gazebo_ros_block_laser.world
gazebo_plugins/test/test_worlds/gazebo_ros_trimesh_collision.world
* ***gazebo_ros_bumper***
- ***description:*** implements a contact sensor. Publishes
gazebo_msgs::ContactsState.
- ***status:*** maintained, needs-cleanup
- ***gazebo plugin:***
- ***example:*** gazebo_plugins/test/bumper_test/gazebo_ros_bumper.world:
- test: gazebo_plugins/test/test_worlds/bumper_test.world:
* ***gazebo_ros_camera***
gazebo_ros_camera_utils
- ***description:*** implements a camera. Publishes: sensor_msgs::Image, sensor_msgs::CameraInfo
- ***status:*** maintained, dynamic-reconfigure, autotest
- ***gazebo plugin:*** CameraPlugin, GazeboRosCameraUtils
- ***example:*** gazebo_plugins/test/test_worlds/gazebo_ros_block_laser.world:
gazebo_plugins/test/test_worlds/gazebo_ros_depth_camera.world:
gazebo_plugins/test/test_worlds/gazebo_ros_camera.world:
gazebo_plugins/test/test_worlds/gazebo_ros_trimesh_collision.world:
gazebo_plugins/test/multi_robot_scenario/xacro/camera/camera.xacro:
* ***gazebo_ros_f3d***
- ***description:*** controller that fake (empty publisher) a 6 dof force sensor
Publishes geometry_msgs::WrenchStamped
- ***status:*** stub
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** --
* ***gazebo_ros_force***
- ***description:*** collects data from a ROS topic and applies wrench to a body accordingly.
- ***status:*** maintained, doxygen
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** --
* ***gazebo_ros_ft_sensor***
- ***description:*** implements Force/Torque sensor.
Publishes: geometry_msgs/WrenchStamped messages
- ***status:*** maintained, doxygen
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** --
* ***gazebo_ros_gpu_laser***
- ***description:*** implements GPU laser based sensors.
Publishes: sensor_msgs::LaserScan
- ***status:*** maintained
- ***gazebo plugin:*** GpuRayPlugin
- ***example:*** gazebo_plugins/test/test_worlds/gazebo_ros_gpu_laser.world
gazebo_plugins/test/multi_robot_scenario/xacro/laser/hokuyo_gpu.xacro
* ***gazebo_ros_laser***
- ***description:*** ROS wrapper for ray based sensors (lasers).
Publishes sensor_msgs::LaserScan.
- ***status:*** maintained
- ***gazebo plugin:*** RayPlugin
- ***example:*** test/test_worlds/gazebo_ros_laser.world
test/test_worlds/test_lasers.world
test/multi_robot_scenario/xacro/laser/hokuyo.xacro
* ***gazebo_ros_multicamera***
MultiCameraPlugin
gazebo_ros_camera_utils
- ***description:*** ROS wrapper for one or more synchronized cameras.
Publishes: sensor_msgs::Image, sensor_msgs::CameraInfo
- ***status:*** maintained, autotest
- ***gazebo plugin:*** MultiCameraPlugin
- ***example:*** --
* ***gazebo_ros_openni_kinect***
- ***description:*** ROS wrapper for depth camera sensors (Kinect like)
Publishes: sensor_msgs::PointCloud2, sensor_msgs::Image
- ***status:*** maintained
- ***gazebo plugin:*** DepthCameraPlugin
- ***example:*** --
* ***gazebo_ros_prosilica***
- ***description:*** plugin for simulating prosilica cameras in gazebo
Publishes: sensor_msgs::Image, sensor_msgs::CameraInfo
- ***status:*** maintained
- ***gazebo plugin:*** > CameraPlugin > ModelPlugin (generic)
- ***example:*** --
* ***gazebo_ros_range***
- ***description:*** simulate range sensors like infrared or ultrasounds
Publishes: sensor_msgs/Range
- ***status:*** maintained
- ***gazebo plugin:*** RayPlugin
- ***example:*** gazebo_plugins/test/test_worlds/gazebo_ros_range.world
gazebo_ros/launch/range_world.launch
### ROS implementations for sensors (not recommended)
Although there is some code in this repo that implements simulations, this
should be an exception. Please checkout the CONTRIBUTION.md guide for more
details about which code should be submitted to this repository.
* ***gazebo_ros_depth_camera***
- ***description:*** implements depth camera based sensors. Publishes: sensor_msgs::Image,
sensor_msgs::CameraInfo, sensors_msgs::PointCloud2
- ***status:*** maintained, not-just-a-wrapper, autotest, needs-cleanup
- ***gazebo plugin:*** DepthCameraPlugin
- ***example:*** gazebo_plugins/test/test_worlds/gazebo_ros_depth_camera.world
gazebo_plugins/test/test_worlds/gazebo_ros_trimesh_collision.world
* ***gazebo_ros_diff_drive***
- ***description:*** implements a diff drive base. Publishes: sensor_msgs::JointState,
nav_msgs::Odometry
- ***status:*** maintained, not-just-a-wrapper, rosparams, needs-cleanup
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** gazebo_plugins/test/multi_robot_scenario/xacro/p3dx/pioneer3dx_plugins.xacro
gazebo_plugins/test/multi_robot_scenario/launch/pioneer3dx.gazebo.launch
## Other plugins (not related to sensors)
* ***gazebo_ros_elevator***
- ***description:*** implements an elevator
- ***status:*** maintained
- ***gazebo plugin:*** ElevatorPlugin
- ***example:*** gazebo_plugins/test/test_worlds/elevator.world
* ***gazebo_ros_hand_of_god***
- ***description:*** Drives floating object around based on the location of a TF frame
- ***status:*** maintained, doxygen
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** --
* ***gazebo_ros_joint_pose_trajectory***
- ***description:*** get a pose trajectory (trajectory_msgs::JointTrajectory) and execute it
- ***status:*** maintained
- ***gazebo_plugin:*** --
- ***example:*** gazebo_plugins/test/pub_joint_trajectory_test.cpp
* ***gazebo_ros_joint_state_publisher***
- ***description:*** ROS plugin that publishes the state of a given set of joints at a given rate
Publishes: sensors_msgs::JointState
- ***status:*** maintained
- ***gazebo_plugin:*** --
- ***example:*** multi_robot_scenario/xacro/p3dx/pioneer3dx_plugins.xacro
* ***gazebo_ros_p3d***
- ***description:*** publish 3D position interface for ground truth
Publishes: nav_msgs::Odometry
- ***status:*** maintained
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** test/p3d_test/worlds/single_pendulum.world
test/p3d_test/worlds/3_double_pendulums.world
test2/large_models/smaller_large_model.urdf.xacro
test2/large_models/large_model.urdf.xacro
* ***gazebo_ros_planar_move***
- ***description:*** simple model controller that uses a twist message to move a robot on the xy plane
Publishes: nav_msgs::Odometry, tf
- ***status:*** maintained
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:***
* ***gazebo_ros_projector***
- ***description:*** controller that controls texture projection into the world from a given body.
Publish: msgs::Projector
- ***status:*** maintained
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** -- (some information in the header file)
* ***gazebo_ros_skid_steer_drive***
- ***description:*** A skid steering drive plugin
Publish: nav_msgs::Odometry
- ***status:*** maintained
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** --
* ***gazebo_ros_tricycle_drive***
- ***description:*** a tricycle drive plugin for gazebo
Publish: nav_msgs::Odometry, sensor_msgs::JointState
- ***status:*** maintained, rosparams
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** gazebo_plugins/test/tricycle_drive/
xacro, launch, world, rviz, etc.
* ***gazebo_ros_video***
- ***description:*** Video plugin for displaying ROS image topics on Ogre textures
- ***status:*** maintained
- ***gazebo plugin:*** VisualPlugin
- ***example:*** --
## List of deprecated plugins (to be removed)
* ***gazebo_ros_joint_trajectory***
- ***description:*** migrate to gazebo_ros_joint_pose_trajectory
- ***status:*** deprecated. To be removed in Lunar.
- ***gazebo plugin:*** --
- ***example:*** --
* ***camera_synchronizer***
* ***vision_reconfigure***
- ***description:***
- ***status:*** needs-work, dead?
- ***gazebo plugin:*** CameraSynchronizerConfig
- ***example:***
* ***gazebo_ros_imu***
- ***description:*** implements an IMU sensor. Publishes: sensor_msgs::Imu
- ***status:*** maintained, not-just-a-wrapper
- ***gazebo plugin:*** ModelPlugin (generic)
- ***example:*** --

View File

@ -0,0 +1,16 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package gazebo_dev
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.5.15 (2018-02-12)
-------------------
2.5.14 (2017-12-11)
-------------------
2.5.13 (2017-06-24)
-------------------
* Add catkin package(s) to provide the default version of Gazebo - take II (kinetic-devel) (`#571 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/571>`_)
* Added catkin package gazebo_dev which provides the cmake config of the installed Gazebo version
* gazebo_dev: added execution dependency gazebo
* Contributors: Jose Luis Rivero

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 2.8.3)
project(gazebo_dev)
find_package(catkin REQUIRED)
catkin_package(
CFG_EXTRAS gazebo_dev-extras.cmake
)

View File

@ -0,0 +1,13 @@
# Depend on system install of Gazebo
find_package(gazebo REQUIRED)
message(STATUS "Gazebo version: ${GAZEBO_VERSION}")
# The following lines will tell catkin to add the Gazebo directories and libraries to the
# respective catkin_* cmake variables.
set(gazebo_dev_INCLUDE_DIRS ${GAZEBO_INCLUDE_DIRS})
set(gazebo_dev_LIBRARY_DIRS ${GAZEBO_LIBRARY_DIRS})
set(gazebo_dev_LIBRARIES ${GAZEBO_LIBRARIES})
# Append gazebo CXX_FLAGS to CMAKE_CXX_FLAGS (c++11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<package format="2">
<name>gazebo_dev</name>
<version>2.5.15</version>
<description>
Provides a cmake config for the default version of Gazebo for the ROS distribution.
</description>
<maintainer email="hsu@osrfoundation.org">John Hsu</maintainer>
<maintainer email="davetcoleman@gmail.com">Dave Coleman</maintainer>
<license>Apache 2.0</license>
<url type="website">http://gazebosim.org/tutorials?cat=connect_ros</url>
<url type="bugtracker">https://github.com/ros-simulation/gazebo_ros_pkgs/issues</url>
<url type="repository">https://github.com/ros-simulation/gazebo_ros_pkgs</url>
<author>Johannes Meyer</author>
<buildtool_depend>catkin</buildtool_depend>
<build_export_depend>libgazebo7-dev</build_export_depend>
<exec_depend>gazebo</exec_depend>
</package>

View File

@ -0,0 +1,164 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package gazebo_msgs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.5.15 (2018-02-12)
-------------------
2.5.14 (2017-12-11)
-------------------
2.5.13 (2017-06-24)
-------------------
* Add catkin package(s) to provide the default version of Gazebo (`#571 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/571>`_)
* Added catkin package gazebo_dev which provides the cmake config of the installed Gazebo version
* Contributors: Jose Luis Rivero
2.5.12 (2017-04-25)
-------------------
2.5.11 (2017-04-18)
-------------------
* Changed the spawn model methods to spawn also lights. (`#511 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/511>`_)
* Contributors: Alessandro Ambrosano
2.5.10 (2017-03-03)
-------------------
2.5.9 (2017-02-20)
------------------
* Removed all trailing whitespace
* Contributors: Dave Coleman
2.5.8 (2016-12-06)
------------------
2.5.7 (2016-06-10)
------------------
2.5.6 (2016-04-28)
------------------
2.5.5 (2016-04-27)
------------------
* merge indigo, jade to kinetic-devel
* Update maintainer for Kinetic release
* Contributors: Jose Luis Rivero, Steven Peters
2.5.3 (2016-04-11)
------------------
2.5.2 (2016-02-25)
------------------
* merging from indigo-devel
* 2.4.9
* Generate changelog
* GetModelState modification for jade
* Contributors: John Hsu, Jose Luis Rivero, Markus Bader
2.5.1 (2015-08-16)
------------------
2.5.0 (2015-04-30)
------------------
2.4.10 (2016-02-25)
-------------------
2.4.9 (2015-08-16)
------------------
2.4.8 (2015-03-17)
------------------
2.4.7 (2014-12-15)
------------------
* Update Gazebo/ROS tutorial URL
* Contributors: Jose Luis Rivero
2.4.6 (2014-09-01)
------------------
2.4.5 (2014-08-18)
------------------
2.4.4 (2014-07-18)
------------------
* Fix repo names in package.xml's
* Contributors: Jon Binney
2.4.3 (2014-05-12)
------------------
2.4.2 (2014-03-27)
------------------
* merging from hydro-devel
* bump patch version for indigo-devel to 2.4.1
* merging from indigo-devel after 2.3.4 release
* "2.4.0"
* catkin_generate_changelog
* Contributors: John Hsu
2.4.1 (2013-11-13)
------------------
* rerelease because sdformat became libsdformat, but we also based change on 2.3.4 in hydro-devel.
2.4.0 (2013-10-14)
------------------
2.3.5 (2014-03-26)
------------------
2.3.4 (2013-11-13)
------------------
2.3.3 (2013-10-10)
------------------
2.3.2 (2013-09-19)
------------------
2.3.1 (2013-08-27)
------------------
2.3.0 (2013-08-12)
------------------
2.2.1 (2013-07-29)
------------------
2.2.0 (2013-07-29)
------------------
2.1.5 (2013-07-18)
------------------
2.1.4 (2013-07-14)
------------------
2.1.3 (2013-07-13)
------------------
2.1.2 (2013-07-12)
------------------
* Cleaned up CMakeLists.txt for all gazebo_ros_pkgs
* 2.1.1
2.1.1 (2013-07-10 19:11)
------------------------
2.1.0 (2013-06-27)
------------------
2.0.2 (2013-06-20)
------------------
2.0.1 (2013-06-19)
------------------
* Incremented version to 2.0.1
2.0.0 (2013-06-18)
------------------
* Changed version to 2.0.0 based on gazebo_simulator being 1.0.0
* Updated package.xml files for ros.org documentation purposes
* Imported from bitbucket.org

View File

@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 2.8.3)
project(gazebo_msgs)
find_package(catkin REQUIRED COMPONENTS
std_msgs
trajectory_msgs
geometry_msgs
sensor_msgs
std_srvs
message_generation
)
add_message_files(
DIRECTORY msg
FILES
ContactsState.msg
ContactState.msg
LinkState.msg
LinkStates.msg
ModelState.msg
ModelStates.msg
ODEJointProperties.msg
ODEPhysics.msg
WorldState.msg
)
add_service_files(DIRECTORY srv FILES
ApplyBodyWrench.srv
DeleteModel.srv
DeleteLight.srv
GetLinkState.srv
GetPhysicsProperties.srv
SetJointProperties.srv
SetModelConfiguration.srv
SpawnModel.srv
ApplyJointEffort.srv
GetJointProperties.srv
GetModelProperties.srv
GetWorldProperties.srv
SetLinkProperties.srv
SetModelState.srv
BodyRequest.srv
GetLinkProperties.srv
GetModelState.srv
JointRequest.srv
SetLinkState.srv
SetPhysicsProperties.srv
SetJointTrajectory.srv
GetLightProperties.srv
SetLightProperties.srv
)
generate_messages(DEPENDENCIES
std_msgs
geometry_msgs
sensor_msgs
trajectory_msgs
)
catkin_package(
CATKIN_DEPENDS
message_runtime
std_msgs
trajectory_msgs
geometry_msgs
sensor_msgs
std_srvs
)

View File

@ -0,0 +1,8 @@
string info # text info on this contact
string collision1_name # name of contact collision1
string collision2_name # name of contact collision2
geometry_msgs/Wrench[] wrenches # list of forces/torques
geometry_msgs/Wrench total_wrench # sum of forces/torques in every DOF
geometry_msgs/Vector3[] contact_positions # list of contact position
geometry_msgs/Vector3[] contact_normals # list of contact normals
float64[] depths # list of penetration depths

View File

@ -0,0 +1,2 @@
Header header # stamp
gazebo_msgs/ContactState[] states # array of geom pairs in contact

View File

@ -0,0 +1,6 @@
# @todo: FIXME: sets pose and twist of a link. All children link poses/twists of the URDF tree are not updated accordingly, but should be.
string link_name # link name, link_names are in gazebo scoped name notation, [model_name::body_name]
geometry_msgs/Pose pose # desired pose in reference frame
geometry_msgs/Twist twist # desired twist in reference frame
string reference_frame # set pose/twist relative to the frame of this link/body
# leave empty or "world" or "map" defaults to world-frame

View File

@ -0,0 +1,4 @@
# broadcast all link states in world frame
string[] name # link names
geometry_msgs/Pose[] pose # desired pose in world frame
geometry_msgs/Twist[] twist # desired twist in world frame

View File

@ -0,0 +1,7 @@
# Set Gazebo Model pose and twist
string model_name # model to set state (pose and twist)
geometry_msgs/Pose pose # desired pose in reference frame
geometry_msgs/Twist twist # desired twist in reference frame
string reference_frame # set pose/twist relative to the frame of this entity (Body/Model)
# leave empty or "world" or "map" defaults to world-frame

View File

@ -0,0 +1,4 @@
# broadcast all model states in world frame
string[] name # model names
geometry_msgs/Pose[] pose # desired pose in world frame
geometry_msgs/Twist[] twist # desired twist in world frame

View File

@ -0,0 +1,11 @@
# access to low level joint properties, change these at your own risk
float64[] damping # joint damping
float64[] hiStop # joint limit
float64[] loStop # joint limit
float64[] erp # set joint erp
float64[] cfm # set joint cfm
float64[] stop_erp # set joint erp for joint limit "contact" joint
float64[] stop_cfm # set joint cfm for joint limit "contact" joint
float64[] fudge_factor # joint fudge_factor applied at limits, see ODE manual for info.
float64[] fmax # ode joint param fmax
float64[] vel # ode joint param vel

View File

@ -0,0 +1,10 @@
bool auto_disable_bodies # enable auto disabling of bodies, default false
uint32 sor_pgs_precon_iters # preconditioning inner iterations when uisng projected Gauss Seidel
uint32 sor_pgs_iters # inner iterations when uisng projected Gauss Seidel
float64 sor_pgs_w # relaxation parameter when using projected Gauss Seidel, 1 = no relaxation
float64 sor_pgs_rms_error_tol # rms error tolerance before stopping inner iterations
float64 contact_surface_layer # contact "dead-band" width
float64 contact_max_correcting_vel # contact maximum correction velocity
float64 cfm # global constraint force mixing
float64 erp # global error reduction parameter
uint32 max_contacts # maximum contact joints between two geoms

View File

@ -0,0 +1,42 @@
# This is a message that holds data necessary to reconstruct a snapshot of the world
#
# = Approach to Message Passing =
# The state of the world is defined by either
# 1. Inertial Model pose, twist
# * kinematic data - connectivity graph from Model to each Link
# * joint angles
# * joint velocities
# * Applied forces - Body wrench
# * relative transform from Body to each collision Geom
# Or
# 2. Inertial (absolute) Body pose, twist, wrench
# * relative transform from Body to each collision Geom - constant, so not sent over wire
# * back compute from canonical body info to get Model pose and twist.
#
# Chooing (2.) because it matches most physics engines out there
# and is simpler.
#
# = Future =
# Consider impacts on using reduced coordinates / graph (parent/child links) approach
# constraint and physics solvers.
#
# = Application =
# This message is used to do the following:
# * reconstruct the world and objects for sensor generation
# * stop / start simulation - need pose, twist, wrench of each body
# * collision detection - need pose of each collision geometry. velocity/acceleration if
#
# = Assumptions =
# Assuming that each (physics) processor node locally already has
# * collision information - Trimesh for Geoms, etc
# * relative transforms from Body to Geom - this is assumed to be fixed, do not send oved wire
# * inertial information - does not vary in time
# * visual information - does not vary in time
#
Header header
string[] name
geometry_msgs/Pose[] pose
geometry_msgs/Twist[] twist
geometry_msgs/Wrench[] wrench

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<package format="2">
<name>gazebo_msgs</name>
<version>2.5.15</version>
<description>
Message and service data structures for interacting with Gazebo from ROS.
</description>
<maintainer email="jrivero@osrfoundation.org">Jose Luis Rivero</maintainer>
<license>BSD</license>
<url type="website">http://gazebosim.org/tutorials?cat=connect_ros</url>
<url type="bugtracker">https://github.com/ros-simulation/gazebo_ros_pkgs/issues</url>
<url type="repository">https://github.com/ros-simulation/gazebo_ros_pkgs</url>
<author>John Hsu</author>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>trajectory_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>std_srvs</build_depend>
<build_depend>message_generation</build_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>trajectory_msgs</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>message_runtime</exec_depend>
<exec_depend>std_srvs</exec_depend>
</package>

View File

@ -0,0 +1,22 @@
# Apply Wrench to Gazebo Body.
# via the callback mechanism
# all Gazebo operations are made in world frame
string body_name # Gazebo body to apply wrench (linear force and torque)
# wrench is applied in the gazebo world by default
# body names are prefixed by model name, e.g. pr2::base_link
string reference_frame # wrench is defined in the reference frame of this entity
# use inertial frame if left empty
# frame names are bodies prefixed by model name, e.g. pr2::base_link
geometry_msgs/Point reference_point # wrench is defined at this location in the reference frame
geometry_msgs/Wrench wrench # wrench applied to the origin of the body
time start_time # (optional) wrench application start time (seconds)
# if start_time is not specified, or
# start_time < current time, start as soon as possible
duration duration # optional duration of wrench application time (seconds)
# if duration < 0, apply wrench continuously without end
# if duration = 0, do nothing
# if duration < step size, apply wrench
# for one step size
---
bool success # return true if set wrench successful
string status_message # comments if available

View File

@ -0,0 +1,13 @@
# set urdf joint effort
string joint_name # joint to apply wrench (linear force and torque)
float64 effort # effort to apply
time start_time # optional wrench application start time (seconds)
# if start_time < current time, start as soon as possible
duration duration # optional duration of wrench application time (seconds)
# if duration < 0, apply wrench continuously without end
# if duration = 0, do nothing
# if duration < step size, assume step size and
# display warning in status_message
---
bool success # return true if effort application is successful
string status_message # comments if available

View File

@ -0,0 +1,2 @@
string body_name # name of the body requested. body names are prefixed by model name, e.g. pr2::base_link
---

View File

@ -0,0 +1,4 @@
string light_name # name of the light to be deleted
---
bool success # return true if deletion is successful
string status_message # comments if available

View File

@ -0,0 +1,4 @@
string model_name # name of the Gazebo Model to be deleted
---
bool success # return true if deletion is successful
string status_message # comments if available

View File

@ -0,0 +1,18 @@
string joint_name # name of joint
---
# joint type
uint8 type
uint8 REVOLUTE = 0 # single DOF
uint8 CONTINUOUS = 1 # single DOF (revolute w/o joints)
uint8 PRISMATIC = 2 # single DOF
uint8 FIXED = 3 # 0 DOF
uint8 BALL = 4 # 3 DOF
uint8 UNIVERSAL = 5 # 2 DOF
# dynamics properties
float64[] damping
# joint state
float64[] position
float64[] rate
# service return status
bool success # return true if get successful
string status_message # comments if available

View File

@ -0,0 +1,8 @@
string light_name # name of Gazebo Light
---
std_msgs/ColorRGBA diffuse # diffuse color as red, green, blue, alpha
float64 attenuation_constant
float64 attenuation_linear
float64 attenuation_quadratic
bool success # return true if get successful
string status_message # comments if available

View File

@ -0,0 +1,16 @@
string link_name # name of link
# link names are prefixed by model name, e.g. pr2::base_link
---
geometry_msgs/Pose com # center of mass location in link frame
# and orientation of the moment of inertias
# relative to the link frame
bool gravity_mode # set gravity mode on/off
float64 mass # linear mass of link
float64 ixx # moment of inertia
float64 ixy # moment of inertia
float64 ixz # moment of inertia
float64 iyy # moment of inertia
float64 iyz # moment of inertia
float64 izz # moment of inertia
bool success # return true if get info is successful
string status_message # comments if available

View File

@ -0,0 +1,9 @@
string link_name # name of link
# link names are prefixed by model name, e.g. pr2::base_link
string reference_frame # reference frame of returned information, must be a valid link
# if empty, use inertial (gazebo world) frame
# reference_frame names are prefixed by model name, e.g. pr2::base_link
---
gazebo_msgs/LinkState link_state
bool success # return true if get info is successful
string status_message # comments if available

View File

@ -0,0 +1,11 @@
string model_name # name of Gazebo Model
---
string parent_model_name # parent model
string canonical_body_name # name of canonical body, body names are prefixed by model name, e.g. pr2::base_link
string[] body_names # list of bodies, body names are prefixed by model name, e.g. pr2::base_link
string[] geom_names # list of geoms
string[] joint_names # list of joints attached to the model
string[] child_model_names # list of child models
bool is_static # returns true if model is static
bool success # return true if get successful
string status_message # comments if available

View File

@ -0,0 +1,14 @@
string model_name # name of Gazebo Model
string relative_entity_name # return pose and twist relative to this entity
# an entity can be a model, body, or geom
# be sure to use gazebo scoped naming notation (e.g. [model_name::body_name])
# leave empty or "world" will use inertial world frame
---
Header header # Standard metadata for higher-level stamped data types.
# * header.seq holds the number of requests since the plugin started
# * header.stamp timestamp related to the pose
# * header.frame_id not used but currently filled with the relative_entity_name
geometry_msgs/Pose pose # pose of model in relative entity frame
geometry_msgs/Twist twist # twist of model in relative entity frame
bool success # return true if get successful
string status_message # comments if available

View File

@ -0,0 +1,9 @@
---
# sets pose and twist of a link. All children link poses/twists of the URDF tree will be updated accordingly
float64 time_step # dt in seconds
bool pause # true if physics engine is paused
float64 max_update_rate # throttle maximum physics update rate
geometry_msgs/Vector3 gravity # gravity vector (e.g. earth ~[0,0,-9.81])
gazebo_msgs/ODEPhysics ode_config # contains physics configurations pertaining to ODE
bool success # return true if set wrench successful
string status_message # comments if available

View File

@ -0,0 +1,6 @@
---
float64 sim_time # current sim time
string[] model_names # list of models in the world
bool rendering_enabled # if X is used
bool success # return true if get successful
string status_message # comments if available

View File

@ -0,0 +1,3 @@
string joint_name # name of the joint requested
---

View File

@ -0,0 +1,5 @@
string joint_name # name of joint
gazebo_msgs/ODEJointProperties ode_joint_config # access to ODE joint dynamics properties
---
bool success # return true if get successful
string status_message # comments if available

View File

@ -0,0 +1,8 @@
string model_name
trajectory_msgs/JointTrajectory joint_trajectory
geometry_msgs/Pose model_pose
bool set_model_pose
bool disable_physics_updates # defaults to false
---
bool success # return true if set wrench successful
string status_message # comments if available

View File

@ -0,0 +1,8 @@
string light_name # name of Gazebo Light
std_msgs/ColorRGBA diffuse # diffuse color as red, green, blue, alpha
float64 attenuation_constant
float64 attenuation_linear
float64 attenuation_quadratic
---
bool success # return true if get successful
string status_message # comments if available

View File

@ -0,0 +1,16 @@
string link_name # name of link
# link names are prefixed by model name, e.g. pr2::base_link
geometry_msgs/Pose com # center of mass location in link frame
# and orientation of the moment of inertias
# relative to the link frame
bool gravity_mode # set gravity mode on/off
float64 mass # linear mass of link
float64 ixx # moment of inertia
float64 ixy # moment of inertia
float64 ixz # moment of inertia
float64 iyy # moment of inertia
float64 iyz # moment of inertia
float64 izz # moment of inertia
---
bool success # return true if get info is successful
string status_message # comments if available

View File

@ -0,0 +1,4 @@
gazebo_msgs/LinkState link_state
---
bool success # return true if set wrench successful
string status_message # comments if available

View File

@ -0,0 +1,9 @@
# Set Gazebo Model pose and twist
string model_name # model to set state (pose and twist)
string urdf_param_name # parameter name that contains the urdf XML.
string[] joint_names # list of joints to set positions. if joint is not listed here, preserve current position.
float64[] joint_positions # set to this position.
---
bool success # return true if setting state successful
string status_message # comments if available

View File

@ -0,0 +1,4 @@
gazebo_msgs/ModelState model_state
---
bool success # return true if setting state successful
string status_message # comments if available

View File

@ -0,0 +1,8 @@
# sets pose and twist of a link. All children link poses/twists of the URDF tree will be updated accordingly
float64 time_step # dt in seconds
float64 max_update_rate # throttle maximum physics update rate
geometry_msgs/Vector3 gravity # gravity vector (e.g. earth ~[0,0,-9.81])
gazebo_msgs/ODEPhysics ode_config # configurations for ODE
---
bool success # return true if set wrench successful
string status_message # comments if available

View File

@ -0,0 +1,11 @@
string model_name # name of the model to be spawn
string model_xml # this should be an urdf or gazebo xml
string robot_namespace # spawn robot and all ROS interfaces under this namespace
geometry_msgs/Pose initial_pose # only applied to canonical body
string reference_frame # initial_pose is defined relative to the frame of this model/body
# if left empty or "world", then gazebo world frame is used
# if non-existent model/body is specified, an error is returned
# and the model is not spawned
---
bool success # return true if spawn successful
string status_message # comments if available

View File

@ -0,0 +1,563 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package gazebo_plugins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.5.15 (2018-02-12)
-------------------
* Merge pull request `#669 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/669>`_ from ahcorde/kinetic-devel
* Adding velocity to joint state publisher gazebo plugin
* Fix last gazebo8 warnings! (`#658 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/658>`_)
* Fix gazebo8 warnings part 10: ifdefs for GetModel, GetEntity, Light (`#656 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/656>`_)
* gazebo8 warnings: ifdefs for Get.*Vel() (`#653 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/653>`_)
* Fix gazebo8 warnings part 8: ifdef's for GetWorldPose (`#650 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/650>`_)
* Fix gazebo8 warnings part 7: ifdef's for Joint::GetAngle and some cleanup (`#642 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/642>`_)
* Contributors: Alejandro Hernández Cordero, Steven Peters
2.5.14 (2017-12-11)
-------------------
* for gazebo8+, call functions without Get (`#639 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/639>`_)
* Fix gazebo8 warnings part 4: convert remaining local variables in plugins to ign-math (`#633 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/633>`_)
* Fix gazebo8 warnings part 3: more ign-math in plugins (`#631 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/631>`_)
* Fix gazebo8 warnings part 2: replace private member gazebo::math types with ignition (`#628 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/628>`_)
* Replace Events::Disconnect* with pointer reset (`#623 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/623>`_)
* Merge pull request `#542 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/542>`_ from davetcoleman/kinetic-gazebo7-only
Remove compiler directive flags for < GAZEBO 7
* Contributors: Dave Coleman, Steven Peters
2.5.13 (2017-06-24)
-------------------
* Fix inverted height in block laser plugin (`#582 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/582>`_)
* Allow disabling distorted camera border crop (and associated tests) (`#572 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/572>`_)
* Add an IMU sensor plugin that inherits from SensorPlugin (`#363 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/363>`_)
* now the plugin works with multiple robots
* using GetParentName name instead of GetScopedName
* added comments to highlight the differents between GazeboRosImuSensor and GazeboRosIMU
* now the message header is properly handled, using bodyName parameter as frame_id
* added check on gazebo version
* added check for sensor null pointer
* changed deprecated functions for gazebo version >= 6
* fixed version check
* added missing sensor variable for LastUpdateTime() function call
* considering '/' included in the robotNamespace
* replaced "bodyFrame" with "frameName"
* Less exciting console output (`#561 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/561>`_)
* Add catkin package(s) to provide the default version of Gazebo (`#571 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/571>`_)
* gazebo_dev: added execution dependency gazebo
* Contributors: Adam Allevato, Alessandro Settimi, Dave Coleman, Jose Luis Rivero, Shohei Fujii
2.5.12 (2017-04-25)
-------------------
* Revert catkin warning fix (`#567 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/567>`_)
Many regressions in third party software (see https://github.com/yujinrobot/kobuki_desktop/issues/50)
* Contributors: Jose Luis Rivero
2.5.11 (2017-04-18)
-------------------
* Change build system to set DEPEND on Gazebo/SDFormat (fix catkin warning)
Added missing DEPEND clauses to catkin_package to fix gazebo catkin warning.
Note that after the change problems could appear related to -lpthreads
errors. This is an known issue related to catkin:
https://github.com/ros/catkin/issues/856
* Fix: add gazebo_ros_range to catkin package libraries (`#558 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/558>`_)
* Contributors: Christoph Rist, Dave Coleman
2.5.10 (2017-03-03)
-------------------
* Revert catkin warnings to fix regressions (problems with catkin -lpthreads errors)
For reference and reasons, please check:
https://discourse.ros.org/t/need-to-sync-new-release-of-rqt-topic-indigo-jade-kinetic/1410/4
* Revert "Fix gazebo catkin warning, cleanup CMakeLists (`#537 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/537>`_)"
This reverts commit 5a0305fcb97864b66bc2e587fc0564435b4f2034.
* Revert "Fix gazebo and sdformat catkin warnings"
This reverts commit 11f95d25dcd32faccd2401d45c722f7794c7542c.
* Fix destructor of GazeboRosVideo (`#547 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/547>`_)
* Less exciting console output (`#549 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/549>`_)
* Fix SDF namespacing for Video Plugin (`#546 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/546>`_)
* Contributors: Dave Coleman, Jose Luis Rivero
2.5.9 (2017-02-20)
------------------
* Fix gazebo catkin warning, cleanup CMakeLists (`#537 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/537>`_)
* Fix timestamp issues for rendering sensors (kinetic-devel)
* Namespace console output (`#543 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/543>`_)
* Adding depth camera world to use in test to make depth camera have right timestamp `#408 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/408>`_- appears to be working (though only looking at horizon) but getting these sdf errors:
* `#408 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/408>`_ Make the multi camera timestamps current rather than outdated, also reuse the same update code
* Fix merge with kinetic branch
* `#408 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/408>`_ Making a test for multicamra that shows the timestamps are currently outdated, will fix them similar to how the regular camera was fixed.
* Fix for issue `#408 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/408>`_. The last measurement time is the time that gazebo generated the sensor data, so ought to be used. updateRate doesn't seem that useful.
The other cameras need similar fixes to have the proper timestamps.
* Bugfix: duplicated tf prefix resolution
* fill in child_frame_id of odom topic
* Fix gazebo and sdformat catkin warnings
* Contributors: Dave Coleman, Jose Luis Rivero, Kei Okada, Lucas Walter, Yuki Furuta
2.5.8 (2016-12-06)
------------------
* Fix camera distortion coefficients order. Now {k1, k2, p1, p2, k3}
* Added an interface to gazebo's harness plugin
* Contributors: Enrique Fernandez, Steven Peters, Nate Koenig
2.5.7 (2016-06-10)
------------------
2.5.6 (2016-04-28)
------------------
* fix gazebo7 deprecation warnings on kinetic
* Contributors: Steven Peters
2.5.5 (2016-04-27)
------------------
* merge indigo, jade to kinetic-devel
* Accept /world for the frameName parameter in gazebo_ros_p3d
* Upgrade to gazebo 7 and remove deprecated driver_base dependency
* Upgrade to gazebo 7 and remove deprecated driver_base dependency
* disable gazebo_ros_control until dependencies are met
* Remove stray backslash
* Update maintainer for Kinetic release
* use HasElement in if condition
* Contributors: Hugo Boyer, Jackie Kay, Jose Luis Rivero, Steven Peters, William Woodall, Yuki Furuta
2.5.3 (2016-04-11)
------------------
2.5.2 (2016-02-25)
------------------
* Fix row_step of openni_kinect plugin
* remove duplicated code during merge
* merging from indigo-devel
* Merge pull request `#368 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/368>`_ from l0g1x/jade-devel
Covariance for published twist in skid steer plugin
* gazebo_ros_utils.h: include gazebo_config.h
Make sure to include gazebo_config.h,
which defines the GAZEBO_MAJOR_VERSION macro
* Fix compiler error with SetHFOV
In gazebo7, the rendering::Camera::SetHFOV function
is overloaded with a potential for ambiguity,
as reported in the following issue:
https://bitbucket.org/osrf/gazebo/issues/1830
This fixes the build by explicitly defining the
Angle type.
* Add missing boost header
Some boost headers were remove from gazebo7 header files
and gazebo_ros_joint_state_publisher.cpp was using it
implicitly.
* Fix gazebo7 build errors
The SensorPtr types have changed from boost:: pointers
to std:: pointers,
which requires boost::dynamic_pointer_cast to change to
std::dynamic_pointer_cast.
A helper macro is added that adds a `using` statement
corresponding to the correct type of dynamic_pointer_cast.
This macro should be narrowly scoped to protect
other code.
* gazebo_ros_utils.h: include gazebo_config.h
Make sure to include gazebo_config.h,
which defines the GAZEBO_MAJOR_VERSION macro
* Use Joint::SetParam for joint velocity motors
Before gazebo5, Joint::SetVelocity and SetMaxForce
were used to set joint velocity motors.
The API has changed in gazebo5, to use Joint::SetParam
instead.
The functionality is still available through the SetParam API.
cherry-picked from indigo-devel
Add ifdefs to fix build with gazebo2
It was broken by `#315 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/315>`_.
Fixes `#321 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/321>`_.
* Fix gazebo6 deprecation warnings
Several RaySensor functions are deprecated in gazebo6
and are removed in gazebo7.
The return type is changed to use ignition math
and the function name is changed.
This adds ifdef's to handle the changes.
* Fix compiler error with SetHFOV
In gazebo7, the rendering::Camera::SetHFOV function
is overloaded with a potential for ambiguity,
as reported in the following issue:
https://bitbucket.org/osrf/gazebo/issues/1830
This fixes the build by explicitly defining the
Angle type.
* Add missing boost header
Some boost headers were remove from gazebo7 header files
and gazebo_ros_joint_state_publisher.cpp was using it
implicitly.
* Fix gazebo7 build errors
The SensorPtr types have changed from boost:: pointers
to std:: pointers,
which requires boost::dynamic_pointer_cast to change to
std::dynamic_pointer_cast.
A helper macro is added that adds a `using` statement
corresponding to the correct type of dynamic_pointer_cast.
This macro should be narrowly scoped to protect
other code.
* Fix gazebo6 deprecation warnings
Several RaySensor functions are deprecated in gazebo6
and are removed in gazebo7.
The return type is changed to use ignition math
and the function name is changed.
This adds ifdef's to handle the changes.
* Publish organized point cloud from openni_kinect plugin
* Added covariance matrix for published twist message in the skid steer plugin, as packages such as robot_localization require an associated non-zero covariance matrix
* Added a missing initialization inside Differential Drive
* 2.4.9
* Generate changelog
* Merge pull request `#335 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/335>`_ from pal-robotics-forks/add_range_sensor_plugin
Adds range plugin for infrared and ultrasound sensors from PAL Robotics
* Import changes from jade-branch
* Add range world and launch file
* Adds range plugin for infrared and ultrasound sensors from PAL Robotics
* Add ifdefs to fix build with gazebo2
It was broken by `#315 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/315>`_.
Fixes `#321 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/321>`_.
* Use Joint::SetParam for joint velocity motors
Before gazebo5, Joint::SetVelocity and SetMaxForce
were used to set joint velocity motors.
The API has changed in gazebo5, to use Joint::SetParam
instead.
The functionality is still available through the SetParam API.
* Set GAZEBO_CXX_FLAGS to fix c++11 compilation errors
* Contributors: Bence Magyar, John Hsu, Jose Luis Rivero, Kentaro Wada, Krystian, Mirko Ferrati, Steven Peters, hsu
2.5.1 (2015-08-16)
------------------
* Port of Pal Robotics range sensor plugin to Jade
* Added a comment about the need of libgazebo5-dev in runtime
* Added gazebo version check
* Added missing files
* Added elevator plugin
* Use c++11
* run_depend on libgazebo5-dev (`#323 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/323>`_)
Declare the dependency.
It can be fixed later if we don't want it.
* Contributors: Jose Luis Rivero, Nate Koenig, Steven Peters
* Port of Pal Robotics range sensor plugin to Jade
* Added a comment about the need of libgazebo5-dev in runtime
* Added gazebo version check
* Added missing files
* Added elevator plugin
* Use c++11
* run_depend on libgazebo5-dev
* Contributors: Jose Luis Rivero, Nate Koenig, Steven Peters
2.5.0 (2015-04-30)
------------------
* run_depend on libgazebo5-dev instead of gazebo5
* Changed the rosdep key for gazebo to gazebo5, for Jade Gazebo5 will be used.
* Contributors: Steven Peters, William Woodall
2.4.9 (2015-08-16)
------------------
* Adds range plugin for infrared and ultrasound sensors from PAL Robotics
* Import changes from jade-branch
* Add range world and launch file
* Add ifdefs to fix build with gazebo2
* Use Joint::SetParam for joint velocity motors
* Set GAZEBO_CXX_FLAGS to fix c++11 compilation errors
* Contributors: Bence Magyar, Jose Luis Rivero, Steven Peters
2.4.8 (2015-03-17)
------------------
* fixed mistake at calculation of joint velocity
* [gazebo_ros_diff_drive] force call SetMaxForce since this Joint::Reset in gazebo/physics/Joint.cc reset MaxForce to zero and ModelPlugin::Reset is called after Joint::Reset
* add PointCloudCutoffMax
* Contributors: Kei Okada, Michael Ferguson, Sabrina Heerklotz
2.4.7 (2014-12-15)
------------------
* fix missing ogre flags: removed from gazebo default (5.x.x candidate) cmake config
* Fixing handling of non-world frame velocities in setModelState.
* fix missing ogre flags (removed from gazebo cmake config)
* change header to use opencv2/opencv.hpp issue `#274 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/274>`_
* Update Gazebo/ROS tutorial URL
* Merge pull request `#237 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/237>`_ from ros-simulation/update_header_license
Update header license for Indigo
* Contributors: John Hsu, Jose Luis Rivero, Robert Codd-Downey, Tom Moore, hsu
2.4.6 (2014-09-01)
------------------
* Update gazebo_ros_openni_kinect.cpp
* merging from hydro-devel into indigo-devel
* Merge pull request `#204 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/204>`_ from fsuarez6/hydro-devel
gazebo_plugins: Adding ForceTorqueSensor Plugin
* Updated to Apache 2.0 license
* Merge pull request `#180 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/180>`_ from vrabaud/indigo-devel
remove PCL dependency
* merging
* check deprecation of gazebo::Joint::SetAngle by SetPosition
* compatibility with gazebo 4.x
* Update changelogs for the upcoming release
* Fix build with gazebo4 and indigo
* Added Gaussian Noise generator
* publish organized pointcloud from openni plugin
* Changed measurement direction to "parent to child"
* gazebo_plugin: Added updateRate parameter to the gazebo_ros_imu plugin
* gazebo_plugins: Adding ForceTorqueSensor Plugin
* remove PCL dependency
* ros_camera_utils: Adding CameraInfoManager to satisfy full ROS camera API (relies on https://github.com/ros-perception/image_common/pull/20 )
ros_camera_utils: Adding CameraInfoManager to satisfy full ROS camera API (relies on https://github.com/ros-perception/image_common/pull/20 )
* Contributors: John Hsu, Jonathan Bohren, Jose Luis Rivero, Nate Koenig, Ryohei Ueda, Vincent Rabaud, fsuarez6, gborque, John Binney
2.4.5 (2014-08-18)
------------------
* Replace SetAngle with SetPosition for gazebo 4 and up
* Port fix_build branch for indigo-devel
See pull request `#221 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/221>`_
* Contributors: Jose Luis Rivero, Steven Peters
2.4.4 (2014-07-18)
------------------
* Merge branch 'hydro-devel' into indigo-devel
* gazebo_ros_diff_drive gazebo_ros_tricycle_drive encoderSource option names updated
* gazebo_ros_diff_drive is now able to use the wheels rotation of the optometry or the gazebo ground truth based on the 'odometrySource' parameter
* simple linear controller for the tricycle_drive added
* second robot for testing in tricycle_drive_scenario.launch added
* Merge remote-tracking branch 'upstream/hydro-devel' into hydro-devel
* BDS licenses header fixed and tricycle drive plugin added
* format patch of hsu applied
* Updated package.xml
* Fix repo names in package.xml's
* ros diff drive supports now an acceleration limit
* Pioneer model: Diff_drive torque reduced
* GPU Laser test example added
* fixed gpu_laser to work with workspaces
* hand_of_god: Adding hand-of-god plugin
ros_force: Fixing error messages to refer to the right plugin
* Remove unneeded dependency on pcl_ros
* minor fixes on relative paths in xacro for pioneer robot
* gazebo test model pionneer 3dx updated with xacro path variables
* pioneer model update for the multi_robot_scenario
* Merge remote-tracking branch 'upstream/hydro-devel' into hydro-devel
* fixed camera to work with workspaces
* fixed links related to changed name
* diff drive name changed to multi robot scenario
* working camera added
* Merge remote-tracking branch 'upstream/hydro-devel' into hydro-devel
* fix in pioneer xacro model for diff_drive
* Laser colour in rviz changed
* A test model for the ros_diff_drive ros_laser and joint_state_publisher added
* the ros_laser checkes now for the model name and adds it als prefix
* joint velocity fixed using radius instead of diameter
* ROS_INFO on laser plugin added to see if it starts
* fetched with upstream
* gazebo_ros_diff_drive was enhanced to publish the wheels tf or the wheels joint state depending on two additinal xml options <publishWheelTF> <publishWheelJointState>
* Gazebo ROS joint state publisher added
* Contributors: Dave Coleman, John Hsu, Jon Binney, Jonathan Bohren, Markus Bader, Steven Peters
2.4.3 (2014-05-12)
------------------
* gazebo_plugins: add run-time dependency on gazebo_ros
* Merge pull request `#176 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/176>`_ from ros-simulation/issue_175
Fix `#175 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/175>`_: dynamic reconfigure dependency error
* Remove unneeded dependency on pcl_ros
* Fix `#175 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/175>`_: dynamic reconfigure dependency error
* Contributors: Steven Peters
2.4.2 (2014-03-27)
------------------
* merging from hydro-devel
* bump patch version for indigo-devel to 2.4.1
* merging from indigo-devel after 2.3.4 release
* "2.4.0"
* catkin_generate_changelog
* Contributors: John Hsu
2.4.1 (2013-11-13)
------------------
2.3.5 (2014-03-26)
------------------
* update test world for block laser
* this corrects the right orientation of the laser scan and improves on comparison between 2 double numbers
* Initialize ``depth_image_connect_count_`` in openni_kinect plugin
* multicamera bad namespace. Fixes `#161 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/161>`_
There was a race condition between GazeboRosCameraUtils::LoadThread
creating the ros::NodeHandle and GazeboRosCameraUtils::Load
suffixing the camera name in the namespace
* Use function for accessing scene node in gazebo_ros_video
* readded the trailing whitespace for cleaner diff
* the parent sensor in gazebo seems not to be active
* Contributors: Dejan Pangercic, Ian Chen, John Hsu, Jordi Pages, Toni Oliver, Ugo Cupcic
2.3.4 (2013-11-13)
------------------
* rerelease because sdformat became libsdformat, but we also based change on 2.3.4 in hydro-devel.
* Simplify ``gazebo_plugins/CMakeLists.txt``
Replace ``cxx_flags`` and ``ld_flags`` variables with simpler cmake macros
and eliminate unnecessary references to ``SDFormat_LIBRARIES``, since
they are already part of ``GAZEBO_LIBRARIES``.
* Put some cmake lists on multiple lines to improve readability.
* Add dependencies on dynamic reconfigure files
Occasionally the build can fail due to some targets having an
undeclared dependency on automatically generated dynamic
reconfigure files (GazeboRosCameraConfig.h for example). This
commit declares several of those dependencies.
2.4.0 (2013-10-14)
------------------
2.3.3 (2013-10-10)
------------------
* gazebo_plugins: use shared pointers for variables shared among cameras
It is not allowed to construct a shared_ptr from a pointer to a member
variable.
* gazebo_plugins: moved initialization of shared_ptr members of
GazeboRosCameraUtils to `GazeboRosCameraUtils::Load()`
This fixes segfaults in gazebo_ros_depth_camera and
gazebo_ros_openni_kinect as the pointers have not been initialized
there.
* Use `RenderingIFace.hh`
2.3.2 (2013-09-19)
------------------
* Make gazebo includes use full path
In the next release of gazebo, it will be required to use the
full path for include files. For example,
`include <physics/physics.hh>` will not be valid
`include <gazebo/physics/physics.hh>` must be done instead.
* Merge branch 'hydro-devel' of `gazebo_ros_pkgs <github.com:ros-simulation/gazebo_ros_pkgs>`_ into synchronize_with_drcsim_plugins
* change includes to use brackets in headers for export
* per pull request comments
* Changed resolution for searchParam.
* Don't forget to delete the node!
* Removed info message on robot namespace.
* Retreive the tf prefix from the robot node.
* synchronize with drcsim plugins
2.3.1 (2013-08-27)
------------------
* Remove direct dependency on pcl, rely on the transitive dependency from pcl_ros
* Cleaned up template, fixes for header files
2.3.0 (2013-08-12)
------------------
* enable image generation when pointcloud is requested, as the generated image is used by the pointcloud
* gazebo_plugins: replace deprecated boost function
This is related to this `gazebo issue #581 <https://bitbucket.org/osrf/gazebo/issue/581/boost-shared_-_cast-are-deprecated-removed>`_
* gazebo_plugins: fix linkedit issues
Note: other linkedit errors were fixed upstream
in gazebo
* gazebo_ros_openni_kinect plugin: adds publishing of the camera info
again (fixes `#95 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/95>`_)
* Merge pull request `#90 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/90>`_ from piyushk/add_model_controller
added a simple model controller plugin that uses a twist message
* renamed plugin from model controller to planar move
* prevents dynamic_reconfigure from overwritting update rate param on start-up
* removed anonymizer from include guard
* fixed odometry publication for model controller plugin
* added a simple model controller plugin that uses a twist message to control models
2.2.1 (2013-07-29)
------------------
* Added prosilica plugin to install TARGETS
2.2.0 (2013-07-29)
------------------
* Switched to pcl_conversions instead of using compiler flags for Hydro/Groovy PCL support
* fixed node intialization conflict between gzserver and gzclient. better adherance to gazebo style guidelines
* Fixed template
* removed ros initialization from plugins
* Standardized the way ROS nodes are initialized in gazebo plugins
* Remove find_package(SDF) from CMakeLists.txt
It is sufficient to find gazebo, which will export the information about the SDFormat package.
* ROS Video Plugin for Gazebo - allows displaying an image stream in an OGRE texture inside gazebo. Also provides a fix for `#85 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/85>`_.
* patch a fix for prosilica plugin (startup race condition where `rosnode_` might still be NULL).
* Added explanation of new dependency in gazebo_ros_pkgs
* switch Prosilica camera from type depth to regular camera (as depth data were not used).
* migrating prosilica plugin from pr2_gazebo_plugins
* Removed tbb because it was a temporary dependency for a Gazebo bug
* SDF.hh --> sdf.hh
* Added PCL to package.xml
2.1.5 (2013-07-18)
------------------
* Include <sdf/sdf.hh> instead of <sdf/SDF.hh>
The sdformat package recently changed the name of an sdf header
file from SDF.hh to SDFImpl.hh; this change will use the lower-case
header file which should work with old and new versions of sdformat
or gazebo.
2.1.4 (2013-07-14)
------------------
2.1.3 (2013-07-13)
------------------
* temporarily add tbb as a work around for `#74 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/74>`_
2.1.2 (2013-07-12)
------------------
* Fixed compatibility with new PCL 1.7.0
* Tweak to make SDFConfig.cmake
* Re-enabled dynamic reconfigure for camera utils - had been removed for Atlas
* Cleaned up CMakeLists.txt for all gazebo_ros_pkgs
* Removed SVN references
* 2.1.1
2.1.1 (2013-07-10 19:11)
------------------------
* Small deprecated warning
* Fixed errors and deprecation warnings from Gazebo 1.9 and the sdformat split
* Source code formatting.
* Merge pull request `#59 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/59>`_ from ros-simulation/CMake_Tweak
Added dependency to prevent missing msg header, cleaned up CMakeLists
* export diff drive and skid steer for other catkin packages
* install diff_drive and skid_steer plugins
* Added dependency to prevent missing msg header, cleaned up CMakeLists
* Added ability to switch off publishing TF.
2.1.0 (2013-06-27)
------------------
* gazebo_plugins: always use gazebo/ path prefix in include directives
* gazebo_plugins: call Advertise() directly after initialization has
completed in gazebo_ros_openni_kinect and gazebo_ros_depth_camera
plugins, as the sensor will never be activated otherwise
* Merge pull request `#41 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/41>`_ from ZdenekM/hydro-devel
Added skid steering plugin (modified diff drive plugin).
* Merge pull request `#35 <https://github.com/ros-simulation/gazebo_ros_pkgs/issues/35>`_ from meyerj/fix_include_directory_installation_target
Header files of packages gazebo_ros and gazebo_plugins are installed to the wrong location
* Rotation fixed.
* Skid steering drive plugin.
* gazebo_plugins: added missing initialization of `GazeboRosDepthCamera::advertised_`
* gazebo_plugins: fixed depth and openni kinect camera plugin segfaults
* gazebo_plugins: terminate the service thread properly on destruction of a PubMutliQueue object without shuting down ros
* gazebo_plugins/gazebo_ros: fixed install directories for include files and gazebo scripts
* fix for terminating the `service_thread_` in PubQueue.h
* added differential drive plugin to gazebo plugins
2.0.2 (2013-06-20)
------------------
* Added Gazebo dependency
2.0.1 (2013-06-19)
------------------
* Incremented version to 2.0.1
* Fixed circular dependency, removed deprecated pkgs since its a stand alone pkg
* Check camera util is initialized before publishing - fix from Atlas
2.0.0 (2013-06-18)
------------------
* Changed version to 2.0.0 based on gazebo_simulator being 1.0.0
* Updated package.xml files for ros.org documentation purposes
* Combined updateSDFModelPose and updateSDFName, added ability to spawn SDFs from model database, updates SDF version to lastest in parts of code, updated the tests
* Created tests for various spawning methods
* Added debug info to shutdown
* Fixed gazebo includes to be in <gazebo/...> format
* Cleaned up file, addded debug info
* Merge branch 'groovy-devel' into plugin_updates
* Merged changes from Atlas ROS plugins, cleaned up headers
* Merged changes from Atlas ROS plugins, cleaned up headers
* fix curved laser issue
* Combining Atlas code with old gazebo_plugins
* Combining Atlas code with old gazebo_plugins
* Small fixes per ffurrer's code review
* Added the robot namespace to the tf prefix.
The tf_prefix param is published under the robot namespace and not the
robotnamespace/camera node which makes it non-local we have to use the
robot namespace to get it otherwise it is empty.
* findreplace ConnectWorldUpdateStart ConnectWorldUpdateBegin
* Fixed deprecated function calls in gazebo_plugins
* Deprecated warnings fixes
* Removed the two plugin tests that are deprecated
* Removed abandoned plugin tests
* All packages building in Groovy/Catkin
* Imported from bitbucket.org

View File

@ -0,0 +1,415 @@
cmake_minimum_required(VERSION 2.8.3)
project(gazebo_plugins)
option(ENABLE_DISPLAY_TESTS "Enable the building of tests that requires a display" OFF)
find_package(catkin REQUIRED COMPONENTS
gazebo_dev
message_generation
gazebo_msgs
roscpp
rospy
nodelet
angles
std_srvs
geometry_msgs
sensor_msgs
nav_msgs
urdf
tf
tf2_ros
dynamic_reconfigure
rosgraph_msgs
trajectory_msgs
image_transport
rosconsole
cv_bridge
polled_camera
diagnostic_updater
camera_info_manager
std_msgs
)
include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(XML libxml-2.0)
pkg_check_modules(OGRE OGRE)
pkg_check_modules(OGRE-Terrain OGRE-Terrain)
pkg_check_modules(OGRE-Paging OGRE-Paging)
else()
message(FATAL_ERROR "pkg-config is required; please install it")
endif()
find_package(Boost REQUIRED COMPONENTS thread)
execute_process(COMMAND
pkg-config --variable=plugindir OGRE
OUTPUT_VARIABLE OGRE_PLUGIN_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
catkin_python_setup()
generate_dynamic_reconfigure_options(
cfg/CameraSynchronizer.cfg
cfg/GazeboRosCamera.cfg
cfg/GazeboRosOpenniKinect.cfg
cfg/Hokuyo.cfg
)
include_directories(include
${Boost_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
${OGRE_INCLUDE_DIRS}
${OGRE-Terrain_INCLUDE_DIRS}
${OGRE-Paging_INCLUDE_DIRS}
)
link_directories(
${catkin_LIBRARY_DIRS}
${OGRE_LIBRARY_DIRS}
${OGRE-Terrain_LIBRARY_DIRS}
${OGRE-Paging_LIBRARY_DIRS}
)
if (NOT GAZEBO_VERSION VERSION_LESS 6.0)
catkin_package( INCLUDE_DIRS include LIBRARIES gazebo_ros_elevator)
endif()
if (NOT GAZEBO_VERSION VERSION_LESS 7.3)
catkin_package(INCLUDE_DIRS include LIBRARIES gazebo_ros_harness)
endif()
catkin_package(
INCLUDE_DIRS include
LIBRARIES
vision_reconfigure
gazebo_ros_utils
gazebo_ros_camera_utils
gazebo_ros_camera
gazebo_ros_triggered_camera
gazebo_ros_multicamera
gazebo_ros_triggered_multicamera
gazebo_ros_depth_camera
gazebo_ros_openni_kinect
gazebo_ros_gpu_laser
gazebo_ros_laser
gazebo_ros_block_laser
gazebo_ros_p3d
gazebo_ros_imu
gazebo_ros_imu_sensor
gazebo_ros_f3d
gazebo_ros_ft_sensor
gazebo_ros_bumper
gazebo_ros_template
gazebo_ros_projector
gazebo_ros_prosilica
gazebo_ros_force
gazebo_ros_joint_trajectory
gazebo_ros_joint_state_publisher
gazebo_ros_joint_pose_trajectory
gazebo_ros_diff_drive
gazebo_ros_tricycle_drive
gazebo_ros_skid_steer_drive
gazebo_ros_video
gazebo_ros_planar_move
gazebo_ros_range
gazebo_ros_vacuum_gripper
CATKIN_DEPENDS
message_runtime
gazebo_msgs
roscpp
rospy
nodelet
angles
std_srvs
geometry_msgs
sensor_msgs
nav_msgs
urdf
tf
tf2_ros
dynamic_reconfigure
rosgraph_msgs
trajectory_msgs
image_transport
rosconsole
camera_info_manager
std_msgs
)
add_dependencies(${PROJECT_NAME}_gencfg ${catkin_EXPORTED_TARGETS})
## Executables
add_executable(hokuyo_node src/hokuyo_node.cpp)
add_dependencies(hokuyo_node ${PROJECT_NAME}_gencfg)
target_link_libraries(hokuyo_node
${catkin_LIBRARIES}
)
add_library(gazebo_ros_utils src/gazebo_ros_utils.cpp)
target_link_libraries(gazebo_ros_utils ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(vision_reconfigure src/vision_reconfigure.cpp)
add_dependencies(vision_reconfigure ${PROJECT_NAME}_gencfg)
target_link_libraries(vision_reconfigure ${catkin_LIBRARIES})
add_executable(camera_synchronizer src/camera_synchronizer.cpp)
add_dependencies(camera_synchronizer ${PROJECT_NAME}_gencfg)
target_link_libraries(camera_synchronizer vision_reconfigure ${catkin_LIBRARIES})
add_executable(pub_joint_trajectory_test test/pub_joint_trajectory_test.cpp)
target_link_libraries(pub_joint_trajectory_test ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_dependencies(pub_joint_trajectory_test ${catkin_EXPORTED_TARGETS}) # don't build until gazebo_msgs is done
add_definitions(-fPIC) # what is this for?
## Plugins
add_library(gazebo_ros_camera_utils src/gazebo_ros_camera_utils.cpp)
add_dependencies(gazebo_ros_camera_utils ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_camera_utils ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(MultiCameraPlugin src/MultiCameraPlugin.cpp)
target_link_libraries(MultiCameraPlugin ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_camera src/gazebo_ros_camera.cpp)
add_dependencies(gazebo_ros_camera ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_camera gazebo_ros_camera_utils CameraPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_triggered_camera src/gazebo_ros_triggered_camera.cpp)
add_dependencies(gazebo_ros_triggered_camera ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_triggered_camera gazebo_ros_camera_utils ${GAZEBO_LIBRARIES} CameraPlugin ${catkin_LIBRARIES})
if (NOT GAZEBO_VERSION VERSION_LESS 6.0)
add_library(gazebo_ros_elevator src/gazebo_ros_elevator.cpp)
add_dependencies(gazebo_ros_elevator ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_elevator ElevatorPlugin ${catkin_LIBRARIES})
endif()
add_library(gazebo_ros_multicamera src/gazebo_ros_multicamera.cpp)
add_dependencies(gazebo_ros_multicamera ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_multicamera gazebo_ros_camera_utils MultiCameraPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_triggered_multicamera src/gazebo_ros_triggered_multicamera.cpp)
add_dependencies(gazebo_ros_triggered_multicamera ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_triggered_multicamera gazebo_ros_camera_utils gazebo_ros_triggered_camera ${GAZEBO_LIBRARIES} MultiCameraPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_depth_camera src/gazebo_ros_depth_camera.cpp)
add_dependencies(gazebo_ros_depth_camera ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_depth_camera gazebo_ros_camera_utils DepthCameraPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_openni_kinect src/gazebo_ros_openni_kinect.cpp)
add_dependencies(gazebo_ros_openni_kinect ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_openni_kinect gazebo_ros_camera_utils DepthCameraPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_gpu_laser src/gazebo_ros_gpu_laser.cpp)
target_link_libraries(gazebo_ros_gpu_laser ${catkin_LIBRARIES} GpuRayPlugin)
if (NOT GAZEBO_VERSION VERSION_LESS 7.3)
add_library(gazebo_ros_harness src/gazebo_ros_harness.cpp)
add_dependencies(gazebo_ros_harness ${catkin_EXPORTED_TARGETS})
target_link_libraries(gazebo_ros_harness
${Boost_LIBRARIES} HarnessPlugin ${catkin_LIBRARIES})
endif()
add_library(gazebo_ros_laser src/gazebo_ros_laser.cpp)
target_link_libraries(gazebo_ros_laser RayPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_block_laser src/gazebo_ros_block_laser.cpp)
target_link_libraries(gazebo_ros_block_laser RayPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_p3d src/gazebo_ros_p3d.cpp)
target_link_libraries(gazebo_ros_p3d ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_imu src/gazebo_ros_imu.cpp)
target_link_libraries(gazebo_ros_imu ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_imu_sensor src/gazebo_ros_imu_sensor.cpp)
target_link_libraries(gazebo_ros_imu_sensor ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_f3d src/gazebo_ros_f3d.cpp)
target_link_libraries(gazebo_ros_f3d ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_bumper src/gazebo_ros_bumper.cpp)
add_dependencies(gazebo_ros_bumper ${catkin_EXPORTED_TARGETS})
target_link_libraries(gazebo_ros_bumper ${Boost_LIBRARIES} ContactPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_projector src/gazebo_ros_projector.cpp)
target_link_libraries(gazebo_ros_projector ${Boost_LIBRARIES} ${catkin_LIBRARIES})
add_library(gazebo_ros_prosilica src/gazebo_ros_prosilica.cpp)
add_dependencies(gazebo_ros_prosilica ${PROJECT_NAME}_gencfg)
target_link_libraries(gazebo_ros_prosilica gazebo_ros_camera_utils CameraPlugin ${catkin_LIBRARIES})
add_library(gazebo_ros_force src/gazebo_ros_force.cpp)
target_link_libraries(gazebo_ros_force ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_joint_trajectory src/gazebo_ros_joint_trajectory.cpp)
add_dependencies(gazebo_ros_joint_trajectory ${catkin_EXPORTED_TARGETS})
target_link_libraries(gazebo_ros_joint_trajectory ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_joint_state_publisher src/gazebo_ros_joint_state_publisher.cpp)
set_target_properties(gazebo_ros_joint_state_publisher PROPERTIES LINK_FLAGS "${ld_flags}")
set_target_properties(gazebo_ros_joint_state_publisher PROPERTIES COMPILE_FLAGS "${cxx_flags}")
add_dependencies(gazebo_ros_joint_state_publisher ${catkin_EXPORTED_TARGETS})
target_link_libraries(gazebo_ros_joint_state_publisher ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_joint_pose_trajectory src/gazebo_ros_joint_pose_trajectory.cpp)
add_dependencies(gazebo_ros_joint_pose_trajectory ${catkin_EXPORTED_TARGETS})
target_link_libraries(gazebo_ros_joint_pose_trajectory ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_diff_drive src/gazebo_ros_diff_drive.cpp)
target_link_libraries(gazebo_ros_diff_drive gazebo_ros_utils ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_tricycle_drive src/gazebo_ros_tricycle_drive.cpp)
target_link_libraries(gazebo_ros_tricycle_drive gazebo_ros_utils ${Boost_LIBRARIES} ${catkin_LIBRARIES})
add_library(gazebo_ros_skid_steer_drive src/gazebo_ros_skid_steer_drive.cpp)
target_link_libraries(gazebo_ros_skid_steer_drive ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_video src/gazebo_ros_video.cpp)
target_link_libraries(gazebo_ros_video ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${OGRE_LIBRARIES})
add_library(gazebo_ros_planar_move src/gazebo_ros_planar_move.cpp)
target_link_libraries(gazebo_ros_planar_move ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_hand_of_god src/gazebo_ros_hand_of_god.cpp)
set_target_properties(gazebo_ros_hand_of_god PROPERTIES LINK_FLAGS "${ld_flags}")
set_target_properties(gazebo_ros_hand_of_god PROPERTIES COMPILE_FLAGS "${cxx_flags}")
target_link_libraries(gazebo_ros_hand_of_god ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_ft_sensor src/gazebo_ros_ft_sensor.cpp)
target_link_libraries(gazebo_ros_ft_sensor ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_library(gazebo_ros_range src/gazebo_ros_range.cpp)
target_link_libraries(gazebo_ros_range ${catkin_LIBRARIES} ${Boost_LIBRARIES} RayPlugin)
add_library(gazebo_ros_vacuum_gripper src/gazebo_ros_vacuum_gripper.cpp)
target_link_libraries(gazebo_ros_vacuum_gripper ${catkin_LIBRARIES} ${Boost_LIBRARIES})
##
## Add your new plugin here
##
## Template
add_library(gazebo_ros_template src/gazebo_ros_template.cpp)
target_link_libraries(gazebo_ros_template ${catkin_LIBRARIES} ${Boost_LIBRARIES})
install(TARGETS
hokuyo_node
vision_reconfigure
camera_synchronizer
gazebo_ros_utils
gazebo_ros_camera_utils
gazebo_ros_camera
gazebo_ros_multicamera
MultiCameraPlugin
gazebo_ros_depth_camera
gazebo_ros_openni_kinect
gazebo_ros_openni_kinect
gazebo_ros_laser
gazebo_ros_block_laser
gazebo_ros_p3d
gazebo_ros_imu
gazebo_ros_imu_sensor
gazebo_ros_f3d
gazebo_ros_ft_sensor
gazebo_ros_bumper
gazebo_ros_hand_of_god
gazebo_ros_template
gazebo_ros_projector
gazebo_ros_prosilica
gazebo_ros_force
gazebo_ros_joint_trajectory
gazebo_ros_joint_state_publisher
gazebo_ros_joint_pose_trajectory
gazebo_ros_diff_drive
gazebo_ros_tricycle_drive
gazebo_ros_skid_steer_drive
gazebo_ros_video
gazebo_ros_planar_move
gazebo_ros_vacuum_gripper
pub_joint_trajectory_test
gazebo_ros_gpu_laser
gazebo_ros_range
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
if (NOT GAZEBO_VERSION VERSION_LESS 6.0)
install(TARGETS gazebo_ros_elevator
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
endif()
if (NOT GAZEBO_VERSION VERSION_LESS 7.3)
install(TARGETS gazebo_ros_harness
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
endif()
install(DIRECTORY include/
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
)
install(PROGRAMS scripts/set_wrench.py scripts/set_pose.py scripts/gazebo_model
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY Media
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY test
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
# Tests
# These need to be run with -j1 flag because gazebo can't be run
# in parallel.
if (CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
add_rostest_gtest(set_model_state-test
test/set_model_state_test/set_model_state_test.test
test/set_model_state_test/set_model_state_test.cpp)
target_link_libraries(set_model_state-test ${catkin_LIBRARIES})
add_rostest(test/range/range_plugin.test)
if (ENABLE_DISPLAY_TESTS)
add_rostest_gtest(depth_camera-test
test/camera/depth_camera.test
test/camera/depth_camera.cpp)
target_link_libraries(depth_camera-test ${catkin_LIBRARIES})
add_rostest_gtest(multicamera-test
test/camera/multicamera.test
test/camera/multicamera.cpp)
target_link_libraries(multicamera-test ${catkin_LIBRARIES})
add_rostest_gtest(camera-test
test/camera/camera.test
test/camera/camera.cpp)
target_link_libraries(camera-test ${catkin_LIBRARIES})
add_rostest_gtest(camera16bit-test
test/camera/camera16bit.test
test/camera/camera16bit.cpp)
target_link_libraries(camera16bit-test ${catkin_LIBRARIES})
add_rostest_gtest(distortion_barrel_test
test/camera/distortion_barrel.test
test/camera/distortion_barrel.cpp)
target_link_libraries(distortion_barrel_test ${catkin_LIBRARIES})
add_rostest_gtest(distortion_pincushion_test
test/camera/distortion_pincushion.test
test/camera/distortion_pincushion.cpp)
target_link_libraries(distortion_pincushion_test ${catkin_LIBRARIES})
add_rostest_gtest(triggered-camera-test
test/camera/triggered_camera.test
test/camera/triggered_camera.cpp)
target_link_libraries(triggered-camera-test ${catkin_LIBRARIES})
endif()
endif()

View File

@ -0,0 +1,58 @@
<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://earth.google.com/kml/2.1'>
<Folder>
<name>Chair</name>
<description><![CDATA[Created with <a href="http://sketchup.google.com/">Google SketchUp 7.0.8657</a>]]></description>
<DocumentSource>SketchUp</DocumentSource>
<visibility>1</visibility>
<LookAt>
<heading>320.223</heading>
<tilt>64.7271</tilt>
<latitude>40.01698901172049</latitude>
<longitude>-105.2829857471169</longitude>
<range>2.891488298910991</range>
<altitude>1.320883614486943</altitude>
</LookAt>
<Folder>
<name>Tour</name>
<Placemark>
<name><![CDATA[Camera]]></name>
<visibility>1</visibility>
<LookAt>
<heading>320.223</heading>
<tilt>64.7271</tilt>
<latitude>40.01698901172049</latitude>
<longitude>-105.2829857471169</longitude>
<range>2.891488298910991</range>
<altitude>1.320883614486943</altitude>
</LookAt>
</Placemark>
</Folder>
<Placemark>
<name>Model</name>
<description><![CDATA[]]></description>
<Style id='default'>
</Style>
<Model>
<altitudeMode>relativeToGround</altitudeMode>
<Location>
<longitude>-105.283000000000</longitude>
<latitude>40.017000000000</latitude>
<altitude>0.000000000000</altitude>
</Location>
<Orientation>
<heading>0</heading>
<tilt>0</tilt>
<roll>0</roll>
</Orientation>
<Scale>
<x>1.0</x>
<y>1.0</y>
<z>1.0</z>
</Scale>
<Link>
<href>models/Chair.dae</href>
</Link>
</Model>
</Placemark></Folder>
</kml>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
<../images/texture0.jpg> <../images/texture0.jpg>
<../images/texture1.jpg> <../images/texture1.jpg>

View File

@ -0,0 +1,92 @@
#! /usr/bin/env python
#*
#* Copyright (c) 2009, Willow Garage, Inc.
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted provided that the following conditions
#* are met:
#*
#* * Redistributions of source code must retain the above copyright
#* notice, this list of conditions and the following disclaimer.
#* * Redistributions in binary form must reproduce the above
#* copyright notice, this list of conditions and the following
#* disclaimer in the documentation and/or other materials provided
#* with the distribution.
#* * Neither the name of the Willow Garage nor the names of its
#* contributors may be used to endorse or promote products derived
#* from this software without specific prior written permission.
#*
#* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
#* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
#* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
#* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
#* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
#* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
#* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#* POSSIBILITY OF SUCH DAMAGE.
#***********************************************************
# Author: Blaise Gassend
# WGE100 camera configuration
PACKAGE='gazebo_plugins'
#import roslib; roslib.load_manifest(PACKAGE)
#from dynamic_reconfigure.parameter_generator import *
#from gazebo_plugins.levels import * # Get the levels
from dynamic_reconfigure.parameter_generator_catkin import *
#copy from levels.py. Leaving levels.py in gazebo_plugins/src results in compile error.
lvl_narrow = 1
lvl_wide = 2
lvl_forearm_r = 4
lvl_forearm_l = 8
lvl_projector = 16
lvl_stereo = lvl_wide | lvl_narrow
lvl_all = lvl_stereo | lvl_forearm_r | lvl_forearm_l | lvl_projector
gen = ParameterGenerator()
p_off = gen.const("ProjectorOff", int_t, 1, "The projector is always off.")
p_auto = gen.const("ProjectorAuto", int_t, 2, "The projector is on if one of the cameras is using it.")
p_on = gen.const("ProjectorOn", int_t, 3, "The projector is always on.")
projector_mode_enum = gen.enum([ p_off, p_auto, p_on ], "The projectors operating mode.")
t_int = gen.const("InternalTrigger", int_t, 1, "The camera does not use the trigger input.")
t_ign = gen.const("IgnoreProjector", int_t, 2, "The cameras frequency can be set independently of the projector frequency. There is no deterministic phase relation between projector firing and camera triggering.")
t_proj = gen.const("WithProjector", int_t, 3, "The camera always exposes while the projector is on.")
t_noproj = gen.const("WithoutProjector", int_t, 4, "The camera always exposes while the projector is off.")
t_alt = gen.const("AlternateProjector", int_t, 5, "The camera alternates between frames with and without the projector.")
wide_trig_mode_enum = gen.enum([ t_ign, t_proj, t_noproj ], "The triggering mode for the wide camera.")
narrow_trig_mode_enum = gen.enum([ t_ign, t_proj, t_noproj, t_alt ], "The triggering mode for the narrow camera.")
forearm_trig_mode_enum = gen.enum([ t_int, t_ign, t_proj, t_noproj ], "The triggering mode for a forearm camera.")
# Name Type Reconf level Description Default Min Max
gen.add("projector_rate", double_t, lvl_all, "Projector pulse frequency in Hz.", 60.0, 40.0, 120.0)
gen.add("projector_pulse_length", double_t, lvl_all, "Length of the projector pulses in s. At high currents the hardware may limit the pulse length.", 0.002, 0.001,0.002)
gen.add("projector_pulse_shift", double_t, lvl_all, "How far off-center the intermediate projector pulses are. Zero is on-center, one is touching the following pulse.", 0.0, 0.0, 1.0)
gen.add("projector_mode", int_t, lvl_all, "Indicates whether the projector should be off, on when in use or on all the time.", 2, 1, 3, edit_method = projector_mode_enum)
gen.add("prosilica_projector_inhibit", bool_t, lvl_projector, "Indicates if the projector should turn off when the prosilica camera is exposing.", False)
gen.add("stereo_rate", double_t, lvl_stereo, "Indicates the frame rate for both stereo cameras in Hz. (Gets rounded to suitable divisors of projector_rate.)", 30.0, 1.0, 60.0)
gen.add("wide_stereo_trig_mode", int_t, lvl_stereo, "Indicates the triggering mode of the wide stereo camera.", 4, 2, 4, edit_method = wide_trig_mode_enum)
gen.add("narrow_stereo_trig_mode", int_t, lvl_stereo, "Indicates the triggering mode of the narrow stereo camera.", 4, 2, 5, edit_method = narrow_trig_mode_enum)
gen.add("forearm_r_rate", double_t, lvl_forearm_r, "Indicates the frame rate for the right forearm camera in Hz. (Gets rounded to suitable divisors of projector_rate.)", 30.0, 1.0, 60.0)
gen.add("forearm_r_trig_mode", int_t, lvl_forearm_r, "Indicates the triggering mode of the right forearm camera.", 1, 1, 4, edit_method = forearm_trig_mode_enum)
gen.add("forearm_l_rate", double_t, lvl_forearm_l, "Indicates the frame rate for the left forearm camera in Hz. (Gets rounded to suitable divisors of projector_rate.)", 30.0, 1.0, 60.0)
gen.add("forearm_l_trig_mode", int_t, lvl_forearm_l, "Indicates the triggering mode of the left forearm camera.", 1, 1, 4, edit_method = forearm_trig_mode_enum)
gen.add("projector_tweak", double_t, lvl_all, "Adds a time shift in seconds to the projector timing. Useful for debugging but not in normal use.", 0, -0.1, 0.1)
gen.add("camera_reset", bool_t, lvl_all, "Does a hard reset of all the cameras using a long pulse on the trigger line. This parameter resets itself to false after 3 to 4 seconds.", False)
exit(gen.generate(PACKAGE, "camera_synchronizer", "CameraSynchronizer"))

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
PKG = 'gazebo_plugins'
#import roslib; roslib.load_manifest(PKG)
from dynamic_reconfigure.msg import SensorLevels
#from dynamic_reconfigure.parameter_generator import *
from dynamic_reconfigure.parameter_generator_catkin import *
gen = ParameterGenerator()
gen.add("imager_rate", double_t, SensorLevels.RECONFIGURE_CLOSE, \
"Sets the frame rate of the imager. In externally triggered mode this must be more than trig_rate", 2, 1, 50)
exit(gen.generate(PKG, "gazebo_ros_camera", "GazeboRosCamera"))

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
PKG = 'gazebo_plugins'
#import roslib; roslib.load_manifest(PKG)
from dynamic_reconfigure.msg import SensorLevels
#from dynamic_reconfigure.parameter_generator import *
from dynamic_reconfigure.parameter_generator_catkin import *
gen = ParameterGenerator()
gen.add("imager_rate", double_t, SensorLevels.RECONFIGURE_CLOSE, \
"Sets the frame rate of the imager. In externally triggered mode this must be more than trig_rate", 2, 1, 50)
exit(gen.generate(PKG, "gazebo_ros_openni_kinect", "GazeboRosOpenniKinect"))

View File

@ -0,0 +1,58 @@
#! /usr/bin/env python
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted provided that the following conditions
#* are met:
#*
#* * Redistributions of source code must retain the above copyright
#* notice, this list of conditions and the following disclaimer.
#* * Redistributions in binary form must reproduce the above
#* copyright notice, this list of conditions and the following
#* disclaimer in the documentation and/or other materials provided
#* with the distribution.
#* * Neither the name of the Willow Garage nor the names of its
#* contributors may be used to endorse or promote products derived
#* from this software without specific prior written permission.
#*
#* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
#* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
#* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
#* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
#* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
#* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
#* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#* POSSIBILITY OF SUCH DAMAGE.
#***********************************************************
# Author: Blaise Gassend
# Forearm camera configuration
PACKAGE='gazebo_plugins'
#import roslib; roslib.load_manifest(PACKAGE)
from math import pi
from dynamic_reconfigure.msg import SensorLevels
#from dynamic_reconfigure.parameter_generator import *
from dynamic_reconfigure.parameter_generator_catkin import *
gen = ParameterGenerator()
# Name Type Reconfiguration level Description Default Min Max
gen.add("min_ang", double_t, SensorLevels.RECONFIGURE_STOP, "The angle of the first range measurement. The unit depends on ~ang_radians.", -pi/2, -pi, pi)
gen.add("max_ang", double_t, SensorLevels.RECONFIGURE_STOP, "The angle of the first range measurement. The unit depends on ~ang_radians.", pi/2, -pi, pi)
gen.add("intensity", bool_t, SensorLevels.RECONFIGURE_STOP, "Whether or not the hokuyo returns intensity values.", False)
gen.add("cluster", int_t, SensorLevels.RECONFIGURE_STOP, "The number of adjacent range measurements to cluster into a single reading", 1, 0, 99)
gen.add("skip", int_t, SensorLevels.RECONFIGURE_STOP, "The number of scans to skip between each measured scan", 0, 0, 9)
gen.add("port", str_t, SensorLevels.RECONFIGURE_CLOSE, "The serial port where the hokuyo device can be found", "/dev/ttyACM0")
gen.add("calibrate_time", bool_t, SensorLevels.RECONFIGURE_CLOSE, "Whether the node should calibrate the hokuyo's time offset", True)
gen.add("frame_id", str_t, SensorLevels.RECONFIGURE_RUNNING, "The frame in which laser scans will be returned", "laser")
gen.add("time_offset", double_t, SensorLevels.RECONFIGURE_RUNNING, "An offet to add to the timestamp before publication of a scan", 0, -0.25, 0.25)
gen.add("allow_unsafe_settings",bool_t, SensorLevels.RECONFIGURE_CLOSE, "Turn this on if you wish to use the UTM-30LX with an unsafe angular range. Turning this option on may cause occasional crashes or bad data. This option is a tempory workaround that will hopefully be removed in an upcoming driver version.", False)
exit(gen.generate(PACKAGE, "hokuyo_node", "Hokuyo"))

View File

@ -0,0 +1,56 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _GAZEBO_MULTI_CAMERA_PLUGIN_HH_
#define _GAZEBO_MULTI_CAMERA_PLUGIN_HH_
#include <string>
#include <vector>
#include <gazebo/common/Plugin.hh>
#include <gazebo/sensors/MultiCameraSensor.hh>
#include <gazebo/rendering/Camera.hh>
#include <gazebo/gazebo.hh>
namespace gazebo
{
class MultiCameraPlugin : public SensorPlugin
{
public: MultiCameraPlugin();
/// \brief Destructor
public: virtual ~MultiCameraPlugin();
public: virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf);
public: virtual void OnNewFrameLeft(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
public: virtual void OnNewFrameRight(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
protected: sensors::MultiCameraSensorPtr parentSensor;
protected: std::vector<unsigned int> width, height, depth;
protected: std::vector<std::string> format;
protected: std::vector<rendering::CameraPtr> camera;
private: std::vector<event::ConnectionPtr> newFrameConnection;
};
}
#endif

View File

@ -0,0 +1,195 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef ROS_PUBQUEUE_H
#define ROS_PUBQUEUE_H
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <deque>
#include <list>
#include <vector>
#include <ros/ros.h>
/// \brief Container for a (ROS publisher, outgoing message) pair.
/// We'll have queues of these. Templated on a ROS message type.
template<class T>
class PubMessagePair
{
public:
/// \brief The outgoing message.
T msg_;
/// \brief The publisher to use to publish the message.
ros::Publisher pub_;
PubMessagePair(T& msg, ros::Publisher& pub) :
msg_(msg), pub_(pub) {}
};
/// \brief A queue of outgoing messages. Instead of calling publish() directly,
/// you can push() messages here to defer ROS serialization and locking.
/// Templated on a ROS message type.
template<class T>
class PubQueue
{
public:
typedef boost::shared_ptr<std::deque<boost::shared_ptr<
PubMessagePair<T> > > > QueuePtr;
typedef boost::shared_ptr<PubQueue<T> > Ptr;
private:
/// \brief Our queue of outgoing messages.
QueuePtr queue_;
/// \brief Mutex to control access to the queue.
boost::shared_ptr<boost::mutex> queue_lock_;
/// \brief Function that will be called when a new message is pushed on.
boost::function<void()> notify_func_;
public:
PubQueue(QueuePtr queue,
boost::shared_ptr<boost::mutex> queue_lock,
boost::function<void()> notify_func) :
queue_(queue), queue_lock_(queue_lock), notify_func_(notify_func) {}
~PubQueue() {}
/// \brief Push a new message onto the queue.
/// \param[in] msg The outgoing message
/// \param[in] pub The ROS publisher to use to publish the message
void push(T& msg, ros::Publisher& pub)
{
boost::shared_ptr<PubMessagePair<T> > el(new PubMessagePair<T>(msg, pub));
boost::mutex::scoped_lock lock(*queue_lock_);
queue_->push_back(el);
notify_func_();
}
/// \brief Pop all waiting messages off the queue.
/// \param[out] els Place to store the popped messages
void pop(std::vector<boost::shared_ptr<PubMessagePair<T> > >& els)
{
boost::mutex::scoped_lock lock(*queue_lock_);
while(!queue_->empty())
{
els.push_back(queue_->front());
queue_->pop_front();
}
}
};
/// \brief A collection of PubQueue objects, potentially of different types.
/// This class is the programmer's interface to this queuing system.
class PubMultiQueue
{
private:
/// \brief List of functions to be called to service our queues.
std::list<boost::function<void()> > service_funcs_;
/// \brief Mutex to lock access to service_funcs_
boost::mutex service_funcs_lock_;
/// \brief If started, the thread that will call the service functions
boost::thread service_thread_;
/// \brief Boolean flag to shutdown the service thread if PubMultiQueue is destructed
bool service_thread_running_;
/// \brief Condition variable used to block and resume service_thread_
boost::condition_variable service_cond_var_;
/// \brief Mutex to accompany service_cond_var_
boost::mutex service_cond_var_lock_;
/// \brief Service a given queue by popping outgoing message off it and
/// publishing them.
template <class T>
void serviceFunc(boost::shared_ptr<PubQueue<T> > pq)
{
std::vector<boost::shared_ptr<PubMessagePair<T> > > els;
pq->pop(els);
for(typename std::vector<boost::shared_ptr<PubMessagePair<T> > >::iterator it = els.begin();
it != els.end();
++it)
{
(*it)->pub_.publish((*it)->msg_);
}
}
public:
PubMultiQueue() {}
~PubMultiQueue()
{
if(service_thread_.joinable())
{
service_thread_running_ = false;
notifyServiceThread();
service_thread_.join();
}
}
/// \brief Add a new queue. Call this once for each published topic (or at
/// least each type of publish message).
/// \return Pointer to the newly created queue, good for calling push() on.
template <class T>
boost::shared_ptr<PubQueue<T> > addPub()
{
typename PubQueue<T>::QueuePtr queue(new std::deque<boost::shared_ptr<PubMessagePair<T> > >);
boost::shared_ptr<boost::mutex> queue_lock(new boost::mutex);
boost::shared_ptr<PubQueue<T> > pq(new PubQueue<T>(queue, queue_lock, boost::bind(&PubMultiQueue::notifyServiceThread, this)));
boost::function<void()> f = boost::bind(&PubMultiQueue::serviceFunc<T>, this, pq);
{
boost::mutex::scoped_lock lock(service_funcs_lock_);
service_funcs_.push_back(f);
}
return pq;
}
/// \brief Service each queue one time.
void spinOnce()
{
boost::mutex::scoped_lock lock(service_funcs_lock_);
for(std::list<boost::function<void()> >::iterator it = service_funcs_.begin();
it != service_funcs_.end();
++it)
{
(*it)();
}
}
/// \brief Service all queues indefinitely, waiting on a condition variable
/// in between cycles.
void spin()
{
while(ros::ok() && service_thread_running_)
{
boost::unique_lock<boost::mutex> lock(service_cond_var_lock_);
service_cond_var_.wait(lock);
spinOnce();
}
}
/// \brief Start a thread to call spin().
void startServiceThread()
{
service_thread_running_ = true;
service_thread_ = boost::thread(boost::bind(&PubMultiQueue::spin, this));
}
/// \brief Wake up the queue serive thread (e.g., after having pushed a
/// message onto one of the queues).
void notifyServiceThread()
{
service_cond_var_.notify_one();
}
};
#endif

View File

@ -0,0 +1,128 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: ros laser controller.
* Author: Nathan Koenig
* Date: 01 Feb 2007
*/
#ifndef GAZEBO_ROS_BLOCK_LASER_HH
#define GAZEBO_ROS_BLOCK_LASER_HH
// Custom Callback Queue
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <sdf/Param.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/plugins/RayPlugin.hh>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <sensor_msgs/PointCloud.h>
namespace gazebo
{
class GazeboRosBlockLaser : public RayPlugin
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosBlockLaser();
/// \brief Destructor
public: ~GazeboRosBlockLaser();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Update the controller
protected: virtual void OnNewLaserScans();
/// \brief Put laser data to the ROS topic
private: void PutLaserData(common::Time &_updateTime);
private: common::Time last_update_time_;
/// \brief Keep track of number of connctions
private: int laser_connect_count_;
private: void LaserConnect();
private: void LaserDisconnect();
// Pointer to the model
private: physics::WorldPtr world_;
/// \brief The parent sensor
private: sensors::SensorPtr parent_sensor_;
private: sensors::RaySensorPtr parent_ray_sensor_;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
/// \brief ros message
private: sensor_msgs::PointCloud cloud_msg_;
/// \brief topic name
private: std::string topic_name_;
/// \brief frame transform name, should match link name
private: std::string frame_name_;
/// \brief Gaussian noise
private: double gaussian_noise_;
/// \brief Gaussian noise generator
private: double GaussianKernel(double mu,double sigma);
/// \brief A mutex to lock access to fields that are used in message callbacks
private: boost::mutex lock;
/// \brief hack to mimic hokuyo intensity cutoff of 100
//private: ParamT<double> *hokuyoMinIntensityP;
private: double hokuyo_min_intensity_;
/// update rate of this sensor
private: double update_rate_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
// Custom Callback Queue
private: ros::CallbackQueue laser_queue_;
private: void LaserQueueThread();
private: boost::thread callback_laser_queue_thread_;
// subscribe to world stats
private: transport::NodePtr node_;
private: common::Time sim_time_;
public: void OnStats( const boost::shared_ptr<msgs::WorldStatistics const> &_msg);
};
}
#endif

View File

@ -0,0 +1,93 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_BUMPER_HH
#define GAZEBO_ROS_BUMPER_HH
#include <string>
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <sys/time.h>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <std_msgs/String.h>
#include <gazebo_msgs/ContactState.h>
#include <gazebo_msgs/ContactsState.h>
#include <gazebo/sensors/sensors.hh>
#include <gazebo/msgs/msgs.hh>
#include <gazebo/physics/physics.hh>
#include <sdf/sdf.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/sensors/ContactSensor.hh>
#include <gazebo/common/Plugin.hh>
namespace gazebo
{
/// \brief A Bumper controller
class GazeboRosBumper : public SensorPlugin
{
/// Constructor
public: GazeboRosBumper();
/// Destructor
public: ~GazeboRosBumper();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// Update the controller
private: void OnContact();
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Publisher contact_pub_;
private: sensors::ContactSensorPtr parentSensor;
/// \brief set topic name of broadcast
private: std::string bumper_topic_name_;
private: std::string frame_name_;
/// \brief broadcast some string for now.
private: gazebo_msgs::ContactsState contact_state_msg_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
private: ros::CallbackQueue contact_queue_;
private: void ContactQueueThread();
private: boost::thread callback_queue_thread_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
};
}
#endif

View File

@ -0,0 +1,54 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: A dynamic controller plugin that publishes ROS image_raw
* camera_info topic for generic camera sensor.
*/
#ifndef GAZEBO_ROS_CAMERA_HH
#define GAZEBO_ROS_CAMERA_HH
#include <string>
// library for processing camera data for gazebo / ros conversions
#include <gazebo/plugins/CameraPlugin.hh>
#include <gazebo_plugins/gazebo_ros_camera_utils.h>
namespace gazebo
{
class GazeboRosCamera : public CameraPlugin, GazeboRosCameraUtils
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosCamera();
/// \brief Destructor
public: ~GazeboRosCamera();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Update the controller
protected: virtual void OnNewFrame(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
};
}
#endif

View File

@ -0,0 +1,230 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_CAMERA_UTILS_HH
#define GAZEBO_ROS_CAMERA_UTILS_HH
#include <string>
// boost stuff
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
// ros stuff
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
// ros messages stuff
#include <sensor_msgs/PointCloud.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/CameraInfo.h>
#include <std_msgs/Empty.h>
#include <std_msgs/Float64.h>
#include <image_transport/image_transport.h>
#include <camera_info_manager/camera_info_manager.h>
// dynamic reconfigure stuff
#include <gazebo_plugins/GazeboRosCameraConfig.h>
#include <dynamic_reconfigure/server.h>
// Gazebo
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/plugins/CameraPlugin.hh>
#include <gazebo_plugins/gazebo_ros_utils.h>
namespace gazebo
{
class GazeboRosMultiCamera;
class GazeboRosTriggeredMultiCamera;
class GazeboRosCameraUtils
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosCameraUtils();
/// \brief Destructor
public: ~GazeboRosCameraUtils();
/// \brief Load the plugin.
/// \param[in] _parent Take in SDF root element.
/// \param[in] _sdf SDF values.
/// \param[in] _camera_name_suffix required before calling LoadThread
public: void Load(sensors::SensorPtr _parent,
sdf::ElementPtr _sdf,
const std::string &_camera_name_suffix = "");
/// \brief Load the plugin.
/// \param[in] _parent Take in SDF root element.
/// \param[in] _sdf SDF values.
/// \param[in] _camera_name_suffix Suffix of the camera name.
/// \param[in] _hack_baseline Multiple camera baseline.
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf,
const std::string &_camera_name_suffix,
double _hack_baseline);
public: event::ConnectionPtr OnLoad(const boost::function<void()>&);
private: void Init();
/// \brief Put camera data to the ROS topic
protected: void PutCameraData(const unsigned char *_src);
protected: void PutCameraData(const unsigned char *_src,
common::Time &last_update_time);
/// \brief Keep track of number of image connections
protected: boost::shared_ptr<int> image_connect_count_;
/// \brief A mutex to lock access to image_connect_count_
protected: boost::shared_ptr<boost::mutex> image_connect_count_lock_;
protected: void ImageConnect();
protected: void ImageDisconnect();
/// \brief Keep track when we activate this camera through ros
/// subscription, was it already active? resume state when
/// unsubscribed.
protected: boost::shared_ptr<bool> was_active_;
/// \brief: Camera modification functions
private: void SetHFOV(const std_msgs::Float64::ConstPtr& hfov);
private: void SetUpdateRate(const std_msgs::Float64::ConstPtr& update_rate);
/// \brief A pointer to the ROS node.
/// A node will be instantiated if it does not exist.
protected: ros::NodeHandle* rosnode_;
protected: image_transport::Publisher image_pub_;
private: image_transport::ImageTransport* itnode_;
/// \brief ROS image message
protected: sensor_msgs::Image image_msg_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
/// \brief ROS camera name
private: std::string camera_name_;
/// \brief tf prefix
private: std::string tf_prefix_;
/// \brief ROS image topic name
protected: std::string image_topic_name_;
/// \brief Publish CameraInfo to the ROS topic
protected: void PublishCameraInfo(ros::Publisher camera_info_publisher);
protected: void PublishCameraInfo(common::Time &last_update_time);
protected: void PublishCameraInfo();
/// \brief Keep track of number of connctions for CameraInfo
private: void InfoConnect();
private: void InfoDisconnect();
/// \brief camera info
protected: ros::Publisher camera_info_pub_;
protected: std::string camera_info_topic_name_;
protected: common::Time last_info_update_time_;
/// \brief ROS frame transform name to use in the image message header.
/// This should typically match the link name the sensor is attached.
protected: std::string frame_name_;
/// update rate of this sensor
protected: double update_rate_;
protected: double update_period_;
protected: common::Time last_update_time_;
protected: double cx_prime_;
protected: double cx_;
protected: double cy_;
protected: double focal_length_;
protected: double hack_baseline_;
protected: double distortion_k1_;
protected: double distortion_k2_;
protected: double distortion_k3_;
protected: double distortion_t1_;
protected: double distortion_t2_;
protected: bool border_crop_;
protected: boost::shared_ptr<camera_info_manager::CameraInfoManager> camera_info_manager_;
/// \brief A mutex to lock access to fields
/// that are used in ROS message callbacks
protected: boost::mutex lock_;
/// \brief size of image buffer
protected: std::string type_;
protected: int skip_;
private: ros::Subscriber cameraHFOVSubscriber_;
private: ros::Subscriber cameraUpdateRateSubscriber_;
// Time last published, refrain from publish unless new image has
// been rendered
// Allow dynamic reconfiguration of camera params
dynamic_reconfigure::Server<gazebo_plugins::GazeboRosCameraConfig>
*dyn_srv_;
void configCallback(gazebo_plugins::GazeboRosCameraConfig &config,
uint32_t level);
protected: ros::CallbackQueue camera_queue_;
protected: void CameraQueueThread();
protected: boost::thread callback_queue_thread_;
// copied from CameraPlugin
protected: unsigned int width_, height_, depth_;
protected: std::string format_;
protected: sensors::SensorPtr parentSensor_;
protected: rendering::CameraPtr camera_;
// Pointer to the world
protected: physics::WorldPtr world_;
private: event::ConnectionPtr newFrameConnection_;
protected: common::Time sensor_update_time_;
// maintain for one more release for backwards compatibility
protected: physics::WorldPtr world;
// deferred load in case ros is blocking
private: sdf::ElementPtr sdf;
private: void LoadThread();
private: boost::thread deferred_load_thread_;
private: event::EventT<void()> load_event_;
// make a trigger function that the child classes can override
// and a function that returns bool to indicate whether the trigger
// should be used
protected: virtual void TriggerCamera();
protected: virtual bool CanTriggerCamera();
private: void TriggerCameraInternal(const std_msgs::Empty::ConstPtr &dummy);
private: ros::Subscriber trigger_subscriber_;
/// \brief ROS trigger topic name
protected: std::string trigger_topic_name_;
/// \brief True if camera util is initialized
protected: bool initialized_;
friend class GazeboRosMultiCamera;
friend class GazeboRosTriggeredMultiCamera;
};
}
#endif

View File

@ -0,0 +1,151 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: A dynamic controller plugin that publishes ROS image_raw camera_info topic for generic camera sensor.
* Author: John Hsu
* Date: 24 Sept 2008
*/
#ifndef GAZEBO_ROS_DEPTH_CAMERA_HH
#define GAZEBO_ROS_DEPTH_CAMERA_HH
// ros stuff
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
// ros messages stuff
#include <sensor_msgs/PointCloud2.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/fill_image.h>
#include <std_msgs/Float64.h>
#include <image_transport/image_transport.h>
// gazebo stuff
#include <sdf/Param.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/plugins/DepthCameraPlugin.hh>
// dynamic reconfigure stuff
#include <gazebo_plugins/GazeboRosCameraConfig.h>
#include <dynamic_reconfigure/server.h>
// boost stuff
#include <boost/thread/mutex.hpp>
// camera stuff
#include <gazebo_plugins/gazebo_ros_camera_utils.h>
namespace gazebo
{
class GazeboRosDepthCamera : public DepthCameraPlugin, GazeboRosCameraUtils
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosDepthCamera();
/// \brief Destructor
public: ~GazeboRosDepthCamera();
/// \brief Load the plugin
/// \param take in SDF root element
public: virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Advertise point cloud and depth image
public: virtual void Advertise();
/// \brief Update the controller
protected: virtual void OnNewDepthFrame(const float *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
/// \brief Update the controller
protected: virtual void OnNewRGBPointCloud(const float *_pcd,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
/// \brief Update the controller
protected: virtual void OnNewImageFrame(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
/// \brief Put camera data to the ROS topic
private: void FillPointdCloud(const float *_src);
/// \brief push depth image data into ros topic
private: void FillDepthImage(const float *_src);
/// \brief Keep track of number of connctions for point clouds
private: int point_cloud_connect_count_;
private: void PointCloudConnect();
private: void PointCloudDisconnect();
/// \brief Keep track of number of connctions for point clouds
private: int depth_image_connect_count_;
private: void DepthImageConnect();
private: void DepthImageDisconnect();
private: common::Time last_depth_image_camera_info_update_time_;
private: bool FillPointCloudHelper(sensor_msgs::PointCloud2 &point_cloud_msg,
uint32_t rows_arg, uint32_t cols_arg,
uint32_t step_arg, void* data_arg);
private: bool FillDepthImageHelper( sensor_msgs::Image& image_msg,
uint32_t rows_arg, uint32_t cols_arg,
uint32_t step_arg, void* data_arg);
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
private: ros::Publisher point_cloud_pub_;
private: ros::Publisher depth_image_pub_;
/// \brief PointCloud2 point cloud message
private: sensor_msgs::PointCloud2 point_cloud_msg_;
private: sensor_msgs::Image depth_image_msg_;
private: double point_cloud_cutoff_;
/// \brief ROS image topic name
private: std::string point_cloud_topic_name_;
private: void InfoConnect();
private: void InfoDisconnect();
using GazeboRosCameraUtils::PublishCameraInfo;
protected: virtual void PublishCameraInfo();
/// \brief image where each pixel contains the depth information
private: std::string depth_image_topic_name_;
private: std::string depth_image_camera_info_topic_name_;
private: int depth_info_connect_count_;
private: void DepthInfoConnect();
private: void DepthInfoDisconnect();
// overload with our own
private: common::Time depth_sensor_update_time_;
protected: ros::Publisher depth_image_camera_info_pub_;
private: event::ConnectionPtr load_connection_;
};
}
#endif

View File

@ -0,0 +1,159 @@
/*
* Copyright (c) 2010, Daniel Hewlett, Antons Rebguns
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Antons Rebguns <email> ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Antons Rebguns <email> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**/
/*
* \file gazebo_ros_diff_drive.h
*
* \brief A differential drive plugin for gazebo. Based on the diffdrive plugin
* developed for the erratic robot (see copyright notice above). The original
* plugin can be found in the ROS package gazebo_erratic_plugins.
*
* \author Piyush Khandelwal (piyushk@gmail.com)
*
* $ Id: 06/21/2013 11:23:40 AM piyushk $
*/
#ifndef DIFFDRIVE_PLUGIN_HH
#define DIFFDRIVE_PLUGIN_HH
#include <map>
// Gazebo
#include <gazebo/common/common.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo_plugins/gazebo_ros_utils.h>
// ROS
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h>
#include <geometry_msgs/Twist.h>
#include <geometry_msgs/Pose2D.h>
#include <nav_msgs/Odometry.h>
#include <sensor_msgs/JointState.h>
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
// Boost
#include <boost/thread.hpp>
#include <boost/bind.hpp>
namespace gazebo {
class Joint;
class Entity;
class GazeboRosDiffDrive : public ModelPlugin {
enum OdomSource
{
ENCODER = 0,
WORLD = 1,
};
public:
GazeboRosDiffDrive();
~GazeboRosDiffDrive();
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
void Reset();
protected:
virtual void UpdateChild();
virtual void FiniChild();
private:
void publishOdometry(double step_time);
void getWheelVelocities();
void publishWheelTF(); /// publishes the wheel tf's
void publishWheelJointState();
void UpdateOdometryEncoder();
GazeboRosPtr gazebo_ros_;
physics::ModelPtr parent;
event::ConnectionPtr update_connection_;
double wheel_separation_;
double wheel_diameter_;
double wheel_torque;
double wheel_speed_[2];
double wheel_accel;
double wheel_speed_instr_[2];
std::vector<physics::JointPtr> joints_;
// ROS STUFF
ros::Publisher odometry_publisher_;
ros::Subscriber cmd_vel_subscriber_;
boost::shared_ptr<tf::TransformBroadcaster> transform_broadcaster_;
sensor_msgs::JointState joint_state_;
ros::Publisher joint_state_publisher_;
nav_msgs::Odometry odom_;
std::string tf_prefix_;
boost::mutex lock;
std::string robot_namespace_;
std::string command_topic_;
std::string odometry_topic_;
std::string odometry_frame_;
std::string robot_base_frame_;
bool publish_tf_;
bool legacy_mode_;
// Custom Callback Queue
ros::CallbackQueue queue_;
boost::thread callback_queue_thread_;
void QueueThread();
// DiffDrive stuff
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr& cmd_msg);
double x_;
double rot_;
bool alive_;
// Update Rate
double update_rate_;
double update_period_;
common::Time last_update_time_;
OdomSource odom_source_;
geometry_msgs::Pose2D pose_encoder_;
common::Time last_odom_update_;
// Flags
bool publishWheelTF_;
bool publishWheelJointState_;
};
}
#endif

View File

@ -0,0 +1,71 @@
/*
* Copyright 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef _GAZEBO_ROS_PLUGINS_ELEVATOR_PLUGIN_H_
#define _GAZEBO_ROS_PLUGINS_ELEVATOR_PLUGIN_H_
#include <sdf/sdf.hh>
// Gazebo
#include <gazebo/plugins/ElevatorPlugin.hh>
// ROS
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
namespace gazebo
{
/// \brief ROS implementation of the Elevator plugin
class GazeboRosElevator : public ElevatorPlugin
{
/// \brief Constructor
public: GazeboRosElevator();
/// \brief Destructor
public: virtual ~GazeboRosElevator();
/// \brief Load the plugin.
/// \param[in] _model Pointer to the Model
/// \param[in] _sdf Pointer to the SDF element of the plugin.
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
/// \brief Receives messages on the elevator's topic.
/// \param[in] _msg The string message that contains a command.
public: void OnElevator(const std_msgs::String::ConstPtr &_msg);
/// \brief Queu to handle callbacks.
private: void QueueThread();
/// \brief for setting ROS name space
private: std::string robotNamespace_;
/// \brief ros node handle
private: ros::NodeHandle *rosnode_;
/// \brief Subscribes to a topic that controls the elevator.
private: ros::Subscriber elevatorSub_;
/// \brief Custom Callback Queue
private: ros::CallbackQueue queue_;
// \brief Custom Callback Queue thread
private: boost::thread callbackQueueThread_;
};
}
#endif

View File

@ -0,0 +1,111 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: 3D Applied Force Feedback Interface
* Author: John Hsu
* Date: 24 Sept 2008
*/
#ifndef GAZEBO_ROS_F3D_HH
#define GAZEBO_ROS_F3D_HH
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <ros/ros.h>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <geometry_msgs/WrenchStamped.h>
namespace gazebo
{
/// \brief GazeboRosF3D controller
/// This is a controller that simulates a 6 dof force sensor
class GazeboRosF3D : public ModelPlugin
{
/// \brief Constructor
/// \param parent The parent entity must be a Model
public: GazeboRosF3D();
/// \brief Destructor
public: virtual ~GazeboRosF3D();
/// \brief Load the controller
public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
/// \brief Update the controller
protected: virtual void UpdateChild();
private: physics::WorldPtr world_;
/// \brief A pointer to the Gazebo Body
private: physics::LinkPtr link_;
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
/// \brief ROS WrenchStamped message
private: geometry_msgs::WrenchStamped wrench_msg_;
/// \brief store bodyname
private: std::string link_name_;
/// \brief ROS WrenchStamped topic name
private: std::string topic_name_;
/// \brief ROS frame transform name to use in the image message header.
/// This should be simply map since the returned info is in Gazebo Global Frame.
private: std::string frame_name_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
/// \brief A mutex to lock access to fields that are used in message callbacks
private: boost::mutex lock_;
/// \brief: keep track of number of connections
private: int f3d_connect_count_;
private: void F3DConnect();
private: void F3DDisconnect();
// Custom Callback Queue
private: ros::CallbackQueue queue_;
private: void QueueThread();
private: boost::thread callback_queue_thread_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
};
/** \} */
/// @}
}
#endif

View File

@ -0,0 +1,126 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: A dynamic controller plugin that performs generic force interface.
* Author: John Hsu
* Date: 24 Sept 2008
*/
#ifndef GAZEBO_ROS_FORCE_HH
#define GAZEBO_ROS_FORCE_HH
#include <string>
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/subscribe_options.h>
#include <geometry_msgs/Wrench.h>
#include <ros/ros.h>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
namespace gazebo
{
/// @addtogroup gazebo_dynamic_plugins Gazebo ROS Dynamic Plugins
/// @{
/** \defgroup GazeboRosForce Plugin XML Reference and Example
\brief Ros Force Plugin.
This is a Plugin that collects data from a ROS topic and applies wrench to a body accordingly.
Example Usage:
\verbatim
<gazebo>
<plugin filename="libgazebo_ros_force.so" name="gazebo_ros_force">
<bodyName>box_body</bodyName>
<topicName>box_force</topicName>
</plugin>
</gazebo>
\endverbatim
\{
*/
/**
.
*/
class GazeboRosForce : public ModelPlugin
{
/// \brief Constructor
public: GazeboRosForce();
/// \brief Destructor
public: virtual ~GazeboRosForce();
// Documentation inherited
protected: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
// Documentation inherited
protected: virtual void UpdateChild();
/// \brief call back when a Wrench message is published
/// \param[in] _msg The Incoming ROS message representing the new force to exert.
private: void UpdateObjectForce(const geometry_msgs::Wrench::ConstPtr& _msg);
/// \brief The custom callback queue thread function.
private: void QueueThread();
/// \brief A pointer to the gazebo world.
private: physics::WorldPtr world_;
/// \brief A pointer to the Link, where force is applied
private: physics::LinkPtr link_;
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
private: ros::NodeHandle* rosnode_;
private: ros::Subscriber sub_;
/// \brief A mutex to lock access to fields that are used in ROS message callbacks
private: boost::mutex lock_;
/// \brief ROS Wrench topic name inputs
private: std::string topic_name_;
/// \brief The Link this plugin is attached to, and will exert forces on.
private: std::string link_name_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
// Custom Callback Queue
private: ros::CallbackQueue queue_;
/// \brief Thead object for the running callback Thread.
private: boost::thread callback_queue_thread_;
/// \brief Container for the wrench force that this plugin exerts on the body.
private: geometry_msgs::Wrench wrench_msg_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
};
/** \} */
/// @}
}
#endif

View File

@ -0,0 +1,160 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: Force Torque Sensor Plugin
* Author: Francisco Suarez-Ruiz
* Date: 5 June 2014
*/
#ifndef GAZEBO_ROS_FT_HH
#define GAZEBO_ROS_FT_HH
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <ros/ros.h>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <geometry_msgs/WrenchStamped.h>
namespace gazebo
{
/// @addtogroup gazebo_dynamic_plugins Gazebo ROS Dynamic Plugins
/// @{
/** \defgroup GazeboRosFTSensor Plugin XML Reference and Example
\brief Ros Gazebo Ros Force/Torque Sensor Plugin.
This is a model plugin which broadcasts geometry_msgs/WrenchStamped messages
with measured force and torque on a specified joint.
The wrench is reported in the joint CHILD link frame and the measure direction
is child-to-parent link.
Example Usage:
\verbatim
<!-- Enable the Joint Feedback -->
<gazebo reference="JOINT_NAME">
<provideFeedback>true</provideFeedback>
</gazebo>
<!-- The ft_sensor plugin -->
<gazebo>
<plugin name="ft_sensor" filename="libgazebo_ros_ft_sensor.so">
<updateRate>100.0</updateRate>
<topicName>ft_sensor_topic</topicName>
<jointName>JOINT_NAME</jointName>
</plugin>
</gazebo>
\endverbatim
\{
*/
/// \brief GazeboRosFT controller
/// This is a controller that simulates a 6 dof force sensor
class GazeboRosFT : public ModelPlugin
{
/// \brief Constructor
/// \param parent The parent entity must be a Model
public: GazeboRosFT();
/// \brief Destructor
public: virtual ~GazeboRosFT();
/// \brief Load the controller
public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
/// \brief Update the controller
protected: virtual void UpdateChild();
/// \brief Gaussian noise
private: double gaussian_noise_;
private: unsigned int seed;
/// \brief Gaussian noise generator
private: double GaussianKernel(double mu, double sigma);
/// \brief A pointer to the Gazebo joint
private: physics::JointPtr joint_;
/// \brief A pointer to the Gazebo parent link
private: physics::LinkPtr parent_link_;
/// \brief A pointer to the Gazebo child link
private: physics::LinkPtr child_link_;
/// \brief A pointer to the Gazebo model
private: physics::ModelPtr model_;
/// \brief A pointer to the Gazebo world
private: physics::WorldPtr world_;
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
/// \brief ROS WrenchStamped message
private: geometry_msgs::WrenchStamped wrench_msg_;
/// \brief store bodyname
private: std::string joint_name_;
/// \brief ROS WrenchStamped topic name
private: std::string topic_name_;
/// \brief ROS frame transform name to use in the image message header.
/// FIXME: extract link name directly?
private: std::string frame_name_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
/// \brief A mutex to lock access to fields that are used in message callbacks
private: boost::mutex lock_;
/// \brief save last_time
private: common::Time last_time_;
// rate control
private: double update_rate_;
/// \brief: keep track of number of connections
private: int ft_connect_count_;
private: void FTConnect();
private: void FTDisconnect();
// Custom Callback Queue
private: ros::CallbackQueue queue_;
private: void QueueThread();
private: boost::thread callback_queue_thread_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
};
/** \} */
/// @}
}
#endif

View File

@ -0,0 +1,99 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_LASER_HH
#define GAZEBO_ROS_LASER_HH
#include <string>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <ros/ros.h>
#include <ros/advertise_options.h>
#include <sensor_msgs/LaserScan.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/plugins/GpuRayPlugin.hh>
#include <sdf/sdf.hh>
#include <gazebo_plugins/PubQueue.h>
namespace gazebo
{
class GazeboRosLaser : public GpuRayPlugin
{
/// \brief Constructor
public: GazeboRosLaser();
/// \brief Destructor
public: ~GazeboRosLaser();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Keep track of number of connctions
private: int laser_connect_count_;
private: void LaserConnect();
private: void LaserDisconnect();
// Pointer to the model
private: std::string world_name_;
private: physics::WorldPtr world_;
/// \brief The parent sensor
private: sensors::GpuRaySensorPtr parent_ray_sensor_;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
private: PubQueue<sensor_msgs::LaserScan>::Ptr pub_queue_;
/// \brief topic name
private: std::string topic_name_;
/// \brief frame transform name, should match link name
private: std::string frame_name_;
/// \brief tf prefix
private: std::string tf_prefix_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
// deferred load in case ros is blocking
private: sdf::ElementPtr sdf;
private: void LoadThread();
private: boost::thread deferred_load_thread_;
private: unsigned int seed;
private: gazebo::transport::NodePtr gazebo_node_;
private: gazebo::transport::SubscriberPtr laser_scan_sub_;
private: void OnScan(ConstLaserScanStampedPtr &_msg);
/// \brief prevents blocking
private: PubMultiQueue pmq;
};
}
#endif

View File

@ -0,0 +1,71 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: 3D position interface.
* Author: Sachin Chitta and John Hsu
* Date: 10 June 2008
*/
#ifndef GAZEBO_ROS_TEMPLATE_HH
#define GAZEBO_ROS_TEMPLATE_HH
#include <ros/ros.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <tf2_ros/transform_listener.h>
#include <tf2_ros/transform_broadcaster.h>
namespace gazebo
{
class GazeboRosHandOfGod : public ModelPlugin
{
/// \brief Constructor
public: GazeboRosHandOfGod();
/// \brief Destructor
public: virtual ~GazeboRosHandOfGod();
/// \brief Load the controller
public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
/// \brief Update the controller
protected: virtual void GazeboUpdate();
/// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
boost::shared_ptr<tf2_ros::Buffer> tf_buffer_;
boost::shared_ptr<tf2_ros::TransformListener> tf_listener_;
boost::shared_ptr<tf2_ros::TransformBroadcaster> tf_broadcaster_;
physics::ModelPtr model_;
physics::LinkPtr floating_link_;
std::string link_name_;
std::string robot_namespace_;
std::string frame_id_;
double kl_, ka_;
double cl_, ca_;
};
}
#endif

View File

@ -0,0 +1,80 @@
/*
* Copyright (C) 2016 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_HARNESS_H
#define GAZEBO_ROS_HARNESS_H
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/subscribe_options.h>
#include <ros/ros.h>
#include <std_msgs/Float32.h>
#include <std_msgs/Bool.h>
#include <gazebo/plugins/HarnessPlugin.hh>
namespace gazebo
{
/// \brief See the Gazebo documentation about the HarnessPlugin. This ROS
/// wrapper exposes two topics:
///
/// 1. /<plugin_model_name>/harness/velocity
/// - Message Type: std_msgs::Float32
/// - Purpose: Set target winch velocity
///
/// 2. /<plugin_model_name>/harness/detach
/// - Message Type: std_msgs::Bool
/// - Purpose: Detach the <detach> joint.
class GazeboRosHarness : public HarnessPlugin
{
/// \brief Constructor
public: GazeboRosHarness();
/// \brief Destructor
public: virtual ~GazeboRosHarness();
/// \brief Load the plugin
public: virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
/// \brief Receive winch velocity control messages.
/// \param[in] msg Float message that is the target winch velocity.
private: virtual void OnVelocity(const std_msgs::Float32::ConstPtr &msg);
/// \brief Receive detach messages
/// \param[in] msg Boolean detach message. Detach joints if data is
/// true.
private: virtual void OnDetach(const std_msgs::Bool::ConstPtr &msg);
/// \brief Custom callback queue thread
private: void QueueThread();
/// \brief pointer to ros node
private: ros::NodeHandle *rosnode_;
/// \brief Subscriber to velocity control messages.
private: ros::Subscriber velocitySub_;
/// \brief Subscriber to detach control messages.
private: ros::Subscriber detachSub_;
/// \brief for setting ROS name space
private: std::string robotNamespace_;
private: ros::CallbackQueue queue_;
private: boost::thread callbackQueueThread_;
};
}
#endif

View File

@ -0,0 +1,130 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_IMU_HH
#define GAZEBO_ROS_IMU_HH
#include <string>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/bind.hpp>
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <sensor_msgs/Imu.h>
#include <std_srvs/Empty.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/transport.hh>
#include <gazebo/common/common.hh>
#include <gazebo_plugins/PubQueue.h>
namespace gazebo
{
class GazeboRosIMU : public ModelPlugin
{
/// \brief Constructor
public: GazeboRosIMU();
/// \brief Destructor
public: virtual ~GazeboRosIMU();
/// \brief Load the controller
/// \param node XML config node
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
/// \brief Update the controller
protected: virtual void UpdateChild();
/// \brief The parent World
private: physics::WorldPtr world_;
/// \brief The link referred to by this plugin
private: physics::LinkPtr link;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
private: PubQueue<sensor_msgs::Imu>::Ptr pub_Queue;
/// \brief ros message
private: sensor_msgs::Imu imu_msg_;
/// \brief store link name
private: std::string link_name_;
/// \brief store frame name
private: std::string frame_name_;
/// \brief topic name
private: std::string topic_name_;
/// \brief allow specifying constant xyz and rpy offsets
private: ignition::math::Pose3d offset_;
/// \brief A mutex to lock access to fields
/// that are used in message callbacks
private: boost::mutex lock_;
/// \brief save last_time
private: common::Time last_time_;
private: ignition::math::Vector3d last_vpos_;
private: ignition::math::Vector3d last_veul_;
private: ignition::math::Vector3d apos_;
private: ignition::math::Vector3d aeul_;
// rate control
private: double update_rate_;
/// \brief: keep initial pose to offset orientation in imu message
private: ignition::math::Pose3d initial_pose_;
/// \brief Gaussian noise
private: double gaussian_noise_;
/// \brief Gaussian noise generator
private: double GaussianKernel(double mu, double sigma);
/// \brief for setting ROS name space
private: std::string robot_namespace_;
/// \brief call back when using service
private: bool ServiceCallback(std_srvs::Empty::Request &req,
std_srvs::Empty::Response &res);
private: ros::ServiceServer srv_;
private: std::string service_name_;
private: ros::CallbackQueue imu_queue_;
private: void IMUQueueThread();
private: boost::thread callback_queue_thread_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
// deferred load in case ros is blocking
private: sdf::ElementPtr sdf;
private: void LoadThread();
private: boost::thread deferred_load_thread_;
private: unsigned int seed;
// ros publish multi queue, prevents publish() blocking
private: PubMultiQueue pmq;
};
}
#endif

View File

@ -0,0 +1,107 @@
/* Copyright [2015] [Alessandro Settimi]
*
* email: ale.settimi@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.*/
#ifndef GAZEBO_ROS_IMU_SENSOR_H
#define GAZEBO_ROS_IMU_SENSOR_H
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/UpdateInfo.hh>
#include <ignition/math/Vector3.hh>
#include <ignition/math/Pose3.hh>
#include <ros/ros.h>
#include <sensor_msgs/Imu.h>
#include <string>
namespace gazebo
{
namespace sensors
{
class ImuSensor;
}
/**
@anchor GazeboRosImuSensor
\ref GazeboRosImuSensor is a plugin to simulate an Inertial Motion Unit sensor, the main differences from \ref GazeboRosIMU are:
- inheritance from SensorPlugin instead of ModelPlugin,
- measurements are given by gazebo ImuSensor instead of being computed by the ros plugin,
- gravity is included in inertial measurements.
*/
/** @brief Gazebo Ros imu sensor plugin. */
class GazeboRosImuSensor : public SensorPlugin
{
public:
/// \brief Constructor.
GazeboRosImuSensor();
/// \brief Destructor.
virtual ~GazeboRosImuSensor();
/// \brief Load the sensor.
/// \param sensor_ pointer to the sensor.
/// \param sdf_ pointer to the sdf config file.
virtual void Load(sensors::SensorPtr sensor_, sdf::ElementPtr sdf_);
protected:
/// \brief Update the sensor.
virtual void UpdateChild(const gazebo::common::UpdateInfo &/*_info*/);
private:
/// \brief Load the parameters from the sdf file.
bool LoadParameters();
/// \brief Gaussian noise generator.
/// \param mu offset value.
/// \param sigma scaling value.
double GuassianKernel(double mu, double sigma);
/// \brief Ros NodeHandle pointer.
ros::NodeHandle* node;
/// \brief Ros Publisher for imu data.
ros::Publisher imu_data_publisher;
/// \brief Ros IMU message.
sensor_msgs::Imu imu_msg;
/// \brief last time on which the data was published.
common::Time last_time;
/// \brief Pointer to the update event connection.
gazebo::event::ConnectionPtr connection;
/// \brief Pointer to the sensor.
sensors::ImuSensor* sensor;
/// \brief Pointer to the sdf config file.
sdf::ElementPtr sdf;
/// \brief Orientation data from the sensor.
ignition::math::Quaterniond orientation;
/// \brief Linear acceleration data from the sensor.
ignition::math::Vector3d accelerometer_data;
/// \brief Angular velocity data from the sensor.
ignition::math::Vector3d gyroscope_data;
/// \brief Seed for the Gaussian noise generator.
unsigned int seed;
//loaded parameters
/// \brief The data is published on the topic named: /robot_namespace/topic_name.
std::string robot_namespace;
/// \brief The data is published on the topic named: /robot_namespace/topic_name.
std::string topic_name;
/// \brief Name of the link of the IMU.
std::string body_name;
/// \brief Sensor update rate.
double update_rate;
/// \brief Gaussian noise.
double gaussian_noise;
/// \brief Offset parameter, position part is unused.
ignition::math::Pose3d offset;
};
}
#endif //GAZEBO_ROS_IMU_SENSOR_H

View File

@ -0,0 +1,133 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// *************************************************************
// DEPRECATED
// This class has been renamed to gazebo_ros_joint_pose_trajectory
// *************************************************************
#ifndef GAZEBO_ROS_JOINT_TRAJECTORY_PLUGIN_HH
#define GAZEBO_ROS_JOINT_TRAJECTORY_PLUGIN_HH
#include <string>
#include <vector>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <ros/subscribe_options.h>
#include <trajectory_msgs/JointTrajectory.h>
#include <geometry_msgs/Pose.h>
#undef ENABLE_SERVICE
#ifdef ENABLE_SERVICE
#include <gazebo_msgs/SetJointTrajectory.h>
#endif
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
namespace gazebo
{
class GazeboRosJointPoseTrajectory : public ModelPlugin // replaced with GazeboROSJointPoseTrajectory
{
/// \brief Constructor
public: GazeboRosJointPoseTrajectory();
/// \brief Destructor
public: virtual ~GazeboRosJointPoseTrajectory();
/// \brief Load the controller
public: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
/// \brief Update the controller
private: void SetTrajectory(
const trajectory_msgs::JointTrajectory::ConstPtr& trajectory);
#ifdef ENABLE_SERVICE
private: bool SetTrajectory(
const gazebo_msgs::SetJointTrajectory::Request& req,
const gazebo_msgs::SetJointTrajectory::Response& res);
#endif
private: void UpdateStates();
private: physics::WorldPtr world_;
private: physics::ModelPtr model_;
/// \brief pose should be set relative to this link (default to "world")
private: physics::LinkPtr reference_link_;
private: std::string reference_link_name_;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Subscriber sub_;
private: ros::ServiceServer srv_;
private: bool has_trajectory_;
/// \brief ros message
private: trajectory_msgs::JointTrajectory trajectory_msg_;
private: bool set_model_pose_;
private: geometry_msgs::Pose model_pose_;
/// \brief topic name
private: std::string topic_name_;
private: std::string service_name_;
/// \brief A mutex to lock access to fields that are
/// used in message callbacks
private: boost::mutex update_mutex;
/// \brief save last_time
private: common::Time last_time_;
// trajectory time control
private: common::Time trajectory_start;
private: unsigned int trajectory_index;
// rate control
private: double update_rate_;
private: bool disable_physics_updates_;
private: bool physics_engine_enabled_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
private: ros::CallbackQueue queue_;
private: void QueueThread();
private: boost::thread callback_queue_thread_;
private: std::vector<gazebo::physics::JointPtr> joints_;
private: std::vector<trajectory_msgs::JointTrajectoryPoint> points_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
private: trajectory_msgs::JointTrajectory joint_trajectory_;
// deferred load in case ros is blocking
private: sdf::ElementPtr sdf;
private: void LoadThread();
private: boost::thread deferred_load_thread_;
};
}
#endif

View File

@ -0,0 +1,91 @@
/*
* Copyright (c) 2013, Markus Bader <markus.bader@tuwien.ac.at>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Antons Rebguns <email> ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Antons Rebguns <email> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**/
#ifndef JOINT_STATE_PUBLISHER_PLUGIN_HH
#define JOINT_STATE_PUBLISHER_PLUGIN_HH
#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <stdio.h>
// ROS
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <sensor_msgs/JointState.h>
// Usage in URDF:
// <gazebo>
// <plugin name="joint_state_publisher" filename="libgazebo_ros_joint_state_publisher.so">
// <robotNamespace>/pioneer2dx</robotNamespace>
// <jointName>chassis_swivel_joint, swivel_wheel_joint, left_hub_joint, right_hub_joint</jointName>
// <updateRate>100.0</updateRate>
// <alwaysOn>true</alwaysOn>
// </plugin>
// </gazebo>
namespace gazebo {
class GazeboRosJointStatePublisher : public ModelPlugin {
public:
GazeboRosJointStatePublisher();
~GazeboRosJointStatePublisher();
void Load ( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
void OnUpdate ( const common::UpdateInfo & _info );
void publishJointStates();
// Pointer to the model
private:
event::ConnectionPtr updateConnection;
physics::WorldPtr world_;
physics::ModelPtr parent_;
std::vector<physics::JointPtr> joints_;
// ROS STUFF
boost::shared_ptr<ros::NodeHandle> rosnode_;
sensor_msgs::JointState joint_state_;
ros::Publisher joint_state_publisher_;
std::string tf_prefix_;
std::string robot_namespace_;
std::vector<std::string> joint_names_;
// Update Rate
double update_rate_;
double update_period_;
common::Time last_update_time_;
};
// Register this plugin with the simulator
GZ_REGISTER_MODEL_PLUGIN ( GazeboRosJointStatePublisher )
}
#endif //JOINT_STATE_PUBLISHER_PLUGIN_HH

View File

@ -0,0 +1,133 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// *************************************************************
// DEPRECATED
// This class has been renamed to gazebo_ros_joint_pose_trajectory
// *************************************************************
#ifndef GAZEBO_ROS_JOINT_TRAJECTORY_PLUGIN_HH
#define GAZEBO_ROS_JOINT_TRAJECTORY_PLUGIN_HH
#include <string>
#include <vector>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <ros/subscribe_options.h>
#include <trajectory_msgs/JointTrajectory.h>
#include <geometry_msgs/Pose.h>
#undef ENABLE_SERVICE
#ifdef ENABLE_SERVICE
#include <gazebo_msgs/SetJointTrajectory.h>
#endif
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
namespace gazebo
{
class GazeboRosJointTrajectory : public ModelPlugin // replaced with GazeboROSJointPoseTrajectory
{
/// \brief Constructor
public: GazeboRosJointTrajectory();
/// \brief Destructor
public: virtual ~GazeboRosJointTrajectory();
/// \brief Load the controller
public: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
/// \brief Update the controller
private: void SetTrajectory(
const trajectory_msgs::JointTrajectory::ConstPtr& trajectory);
#ifdef ENABLE_SERVICE
private: bool SetTrajectory(
const gazebo_msgs::SetJointTrajectory::Request& req,
const gazebo_msgs::SetJointTrajectory::Response& res);
#endif
private: void UpdateStates();
private: physics::WorldPtr world_;
private: physics::ModelPtr model_;
/// \brief pose should be set relative to this link (default to "world")
private: physics::LinkPtr reference_link_;
private: std::string reference_link_name_;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Subscriber sub_;
private: ros::ServiceServer srv_;
private: bool has_trajectory_;
/// \brief ros message
private: trajectory_msgs::JointTrajectory trajectory_msg_;
private: bool set_model_pose_;
private: geometry_msgs::Pose model_pose_;
/// \brief topic name
private: std::string topic_name_;
private: std::string service_name_;
/// \brief A mutex to lock access to fields that are
/// used in message callbacks
private: boost::mutex update_mutex;
/// \brief save last_time
private: common::Time last_time_;
// trajectory time control
private: common::Time trajectory_start;
private: unsigned int trajectory_index;
// rate control
private: double update_rate_;
private: bool disable_physics_updates_;
private: bool physics_engine_enabled_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
private: ros::CallbackQueue queue_;
private: void QueueThread();
private: boost::thread callback_queue_thread_;
private: std::vector<gazebo::physics::JointPtr> joints_;
private: std::vector<trajectory_msgs::JointTrajectoryPoint> points_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
private: trajectory_msgs::JointTrajectory joint_trajectory_;
// deferred load in case ros is blocking
private: sdf::ElementPtr sdf;
private: void LoadThread();
private: boost::thread deferred_load_thread_;
};
}
#endif

View File

@ -0,0 +1,100 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_LASER_HH
#define GAZEBO_ROS_LASER_HH
#include <string>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <ros/ros.h>
#include <ros/advertise_options.h>
#include <sensor_msgs/LaserScan.h>
#include <sdf/Param.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/plugins/RayPlugin.hh>
#include <gazebo_plugins/gazebo_ros_utils.h>
#include <gazebo_plugins/PubQueue.h>
namespace gazebo
{
class GazeboRosLaser : public RayPlugin
{
/// \brief Constructor
public: GazeboRosLaser();
/// \brief Destructor
public: ~GazeboRosLaser();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Keep track of number of connctions
private: int laser_connect_count_;
private: void LaserConnect();
private: void LaserDisconnect();
// Pointer to the model
GazeboRosPtr gazebo_ros_;
private: std::string world_name_;
private: physics::WorldPtr world_;
/// \brief The parent sensor
private: sensors::RaySensorPtr parent_ray_sensor_;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
private: PubQueue<sensor_msgs::LaserScan>::Ptr pub_queue_;
/// \brief topic name
private: std::string topic_name_;
/// \brief frame transform name, should match link name
private: std::string frame_name_;
/// \brief tf prefix
private: std::string tf_prefix_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
// deferred load in case ros is blocking
private: sdf::ElementPtr sdf;
private: void LoadThread();
private: boost::thread deferred_load_thread_;
private: unsigned int seed;
private: gazebo::transport::NodePtr gazebo_node_;
private: gazebo::transport::SubscriberPtr laser_scan_sub_;
private: void OnScan(ConstLaserScanStampedPtr &_msg);
/// \brief prevents blocking
private: PubMultiQueue pmq;
};
}
#endif

View File

@ -0,0 +1,65 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_MULTICAMERA_HH
#define GAZEBO_ROS_MULTICAMERA_HH
#include <string>
#include <vector>
// library for processing camera data for gazebo / ros conversions
#include <gazebo_plugins/gazebo_ros_camera_utils.h>
#include <gazebo_plugins/MultiCameraPlugin.h>
namespace gazebo
{
class GazeboRosMultiCamera : public MultiCameraPlugin
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosMultiCamera();
/// \brief Destructor
public: ~GazeboRosMultiCamera();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
std::vector<GazeboRosCameraUtils*> utils;
protected: void OnNewFrame(const unsigned char *_image,
GazeboRosCameraUtils* util);
/// \brief Update the controller
/// FIXME: switch to function vectors
protected: virtual void OnNewFrameLeft(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
protected: virtual void OnNewFrameRight(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
/// Bookkeeping flags that will be passed into the underlying
/// GazeboRosCameraUtils objects to let them share state about the parent
/// sensor.
private: boost::shared_ptr<int> image_connect_count_;
private: boost::shared_ptr<boost::mutex> image_connect_count_lock_;
private: boost::shared_ptr<bool> was_active_;
};
}
#endif

View File

@ -0,0 +1,147 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: A dynamic controller plugin that publishes ROS image_raw camera_info topic for generic camera sensor.
* Author: John Hsu
* Date: 24 Sept 2008
*/
#ifndef GAZEBO_ROS_OPENNI_KINECT_HH
#define GAZEBO_ROS_OPENNI_KINECT_HH
// ros stuff
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
// ros messages stuff
#include <sensor_msgs/PointCloud2.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/fill_image.h>
#include <std_msgs/Float64.h>
#include <image_transport/image_transport.h>
// gazebo stuff
#include <sdf/Param.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/plugins/DepthCameraPlugin.hh>
// dynamic reconfigure stuff
#include <gazebo_plugins/GazeboRosOpenniKinectConfig.h>
#include <dynamic_reconfigure/server.h>
// boost stuff
#include <boost/thread/mutex.hpp>
// camera stuff
#include <gazebo_plugins/gazebo_ros_camera_utils.h>
namespace gazebo
{
class GazeboRosOpenniKinect : public DepthCameraPlugin, GazeboRosCameraUtils
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosOpenniKinect();
/// \brief Destructor
public: ~GazeboRosOpenniKinect();
/// \brief Load the plugin
/// \param take in SDF root element
public: virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Advertise point cloud and depth image
public: virtual void Advertise();
/// \brief Update the controller
protected: virtual void OnNewDepthFrame(const float *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
/// \brief Update the controller
protected: virtual void OnNewImageFrame(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
/// \brief push point cloud data into ros topic
private: void FillPointdCloud(const float *_src);
/// \brief push depth image data into ros topic
private: void FillDepthImage(const float *_src);
/// \brief Keep track of number of connctions for point clouds
private: int point_cloud_connect_count_;
private: void PointCloudConnect();
private: void PointCloudDisconnect();
/// \brief Keep track of number of connctions for point clouds
private: int depth_image_connect_count_;
private: void DepthImageConnect();
private: void DepthImageDisconnect();
private: bool FillPointCloudHelper(sensor_msgs::PointCloud2 &point_cloud_msg,
uint32_t rows_arg, uint32_t cols_arg,
uint32_t step_arg, void* data_arg);
private: bool FillDepthImageHelper( sensor_msgs::Image& image_msg,
uint32_t height, uint32_t width,
uint32_t step, void* data_arg);
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
private: ros::Publisher point_cloud_pub_;
private: ros::Publisher depth_image_pub_;
/// \brief PointCloud2 point cloud message
private: sensor_msgs::PointCloud2 point_cloud_msg_;
private: sensor_msgs::Image depth_image_msg_;
/// \brief Minimum range of the point cloud
private: double point_cloud_cutoff_;
/// \brief Maximum range of the point cloud
private: double point_cloud_cutoff_max_;
/// \brief ROS image topic name
private: std::string point_cloud_topic_name_;
/// \brief image where each pixel contains the depth data
private: std::string depth_image_topic_name_;
private: common::Time depth_sensor_update_time_;
// overload with our own
private: std::string depth_image_camera_info_topic_name_;
private: int depth_info_connect_count_;
private: void DepthInfoConnect();
private: void DepthInfoDisconnect();
private: common::Time last_depth_image_camera_info_update_time_;
protected: ros::Publisher depth_image_camera_info_pub_;
using GazeboRosCameraUtils::PublishCameraInfo;
protected: virtual void PublishCameraInfo();
private: event::ConnectionPtr load_connection_;
};
}
#endif

View File

@ -0,0 +1,133 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: 3D position interface for ground truth.
* Author: Sachin Chitta and John Hsu
* Date: 1 June 2008
*/
#ifndef GAZEBO_ROS_P3D_HH
#define GAZEBO_ROS_P3D_HH
#include <string>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <ros/ros.h>
#include <nav_msgs/Odometry.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <gazebo_plugins/PubQueue.h>
namespace gazebo
{
class GazeboRosP3D : public ModelPlugin
{
/// \brief Constructor
public: GazeboRosP3D();
/// \brief Destructor
public: virtual ~GazeboRosP3D();
/// \brief Load the controller
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
/// \brief Update the controller
protected: virtual void UpdateChild();
private: physics::WorldPtr world_;
private: physics::ModelPtr model_;
/// \brief The parent Model
private: physics::LinkPtr link_;
/// \brief The body of the frame to display pose, twist
private: physics::LinkPtr reference_link_;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
private: PubQueue<nav_msgs::Odometry>::Ptr pub_Queue;
/// \brief ros message
private: nav_msgs::Odometry pose_msg_;
/// \brief store bodyname
private: std::string link_name_;
/// \brief topic name
private: std::string topic_name_;
/// \brief frame transform name, should match link name
/// FIXME: extract link name directly?
private: std::string frame_name_;
private: std::string tf_frame_name_;
/// \brief allow specifying constant xyz and rpy offsets
private: ignition::math::Pose3d offset_;
/// \brief mutex to lock access to fields used in message callbacks
private: boost::mutex lock;
/// \brief save last_time
private: common::Time last_time_;
private: ignition::math::Vector3d last_vpos_;
private: ignition::math::Vector3d last_veul_;
private: ignition::math::Vector3d apos_;
private: ignition::math::Vector3d aeul_;
private: ignition::math::Vector3d last_frame_vpos_;
private: ignition::math::Vector3d last_frame_veul_;
private: ignition::math::Vector3d frame_apos_;
private: ignition::math::Vector3d frame_aeul_;
// rate control
private: double update_rate_;
/// \brief Gaussian noise
private: double gaussian_noise_;
/// \brief Gaussian noise generator
private: double GaussianKernel(double mu, double sigma);
/// \brief for setting ROS name space
private: std::string robot_namespace_;
private: ros::CallbackQueue p3d_queue_;
private: void P3DQueueThread();
private: boost::thread callback_queue_thread_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
private: unsigned int seed;
// ros publish multi queue, prevents publish() blocking
private: PubMultiQueue pmq;
};
}
#endif

View File

@ -0,0 +1,99 @@
/*
* Copyright 2013 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: Simple model controller that uses a twist message to move a robot on
* the xy plane.
* Author: Piyush Khandelwal
* Date: 29 July 2013
*/
#ifndef GAZEBO_ROS_PLANAR_MOVE_HH
#define GAZEBO_ROS_PLANAR_MOVE_HH
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <map>
#include <gazebo/common/common.hh>
#include <gazebo/physics/physics.hh>
#include <sdf/sdf.hh>
#include <geometry_msgs/Twist.h>
#include <nav_msgs/OccupancyGrid.h>
#include <nav_msgs/Odometry.h>
#include <ros/advertise_options.h>
#include <ros/callback_queue.h>
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h>
namespace gazebo {
class GazeboRosPlanarMove : public ModelPlugin {
public:
GazeboRosPlanarMove();
~GazeboRosPlanarMove();
void Load(physics::ModelPtr parent, sdf::ElementPtr sdf);
protected:
virtual void UpdateChild();
virtual void FiniChild();
private:
void publishOdometry(double step_time);
physics::ModelPtr parent_;
event::ConnectionPtr update_connection_;
boost::shared_ptr<ros::NodeHandle> rosnode_;
ros::Publisher odometry_pub_;
ros::Subscriber vel_sub_;
boost::shared_ptr<tf::TransformBroadcaster> transform_broadcaster_;
nav_msgs::Odometry odom_;
std::string tf_prefix_;
boost::mutex lock;
std::string robot_namespace_;
std::string command_topic_;
std::string odometry_topic_;
std::string odometry_frame_;
std::string robot_base_frame_;
double odometry_rate_;
// Custom Callback Queue
ros::CallbackQueue queue_;
boost::thread callback_queue_thread_;
void QueueThread();
// command velocity callback
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr& cmd_msg);
double x_;
double y_;
double rot_;
bool alive_;
common::Time last_odom_publish_time_;
ignition::math::Pose3d last_odom_pose_;
};
}
#endif /* end of include guard: GAZEBO_ROS_PLANAR_MOVE_HH */

View File

@ -0,0 +1,127 @@
/*
* Desc: A dynamic controller plugin that controls texture projection.
* Author: Jared Duke
* Date: 17 June 2010
* SVN: $Id$
*/
#ifndef GAZEBO_ROS_PROJECTOR_HH
#define GAZEBO_ROS_PROJECTOR_HH
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/subscribe_options.h>
#include <ros/ros.h>
#include <boost/thread/mutex.hpp>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/transport/Node.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <gazebo/rendering/RenderTypes.hh>
#include <std_msgs/String.h>
#include <std_msgs/Int32.h>
#include <OgrePrerequisites.h>
#include <OgreTexture.h>
#include <OgreFrameListener.h>
namespace Ogre
{
class PlaneBoundedVolumeListSceneQuery;
class Frustum;
class Pass;
class SceneNode;
}
namespace gazebo
{
/// @addtogroup gazebo_dynamic_plugins Gazebo ROS Dynamic Plugins
/// @{
/** \defgroup GazeboRosProjector Plugin XML Reference and Example
\brief Ros Texture Projector Controller.
This is a controller that controls texture projection into the world from a given body.
Example Usage:
\verbatim
<projector name="projector_model">
<body:empty name="projector_body_name">
...
<controller:gazebo_ros_projector_controller name="projector_controller" plugin="libgazebo_ros_projector.so">
<alwaysOn>true</alwaysOn>
<updateRate>15.0</updateRate>
<textureName>stereo_projection_pattern_alpha.png</textureName>
<filterTextureName>stereo_projection_pattern_filter.png</filterTextureName>
<textureTopicName>projector_controller/image</textureTopicName>
<projectorTopicName>projector_controller/projector</projectorTopicName>
<fov>0.785398163</fov>
<nearClipDist>0.1</nearClipDist>
<farClipDist>10</farClipDist>
</controller:gazebo_ros_projector_controller>
</body:empty>
</model:phyiscal>
\endverbatim
\{
*/
class GazeboRosProjector : public ModelPlugin
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model
public: GazeboRosProjector();
/// \brief Destructor
public: virtual ~GazeboRosProjector();
/// \brief Load the controller
/// \param node XML config node
protected: virtual void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
/// \brief pointer to the world
private: physics::WorldPtr world_;
/// \brief Callback when a texture is published
private: void LoadImage(const std_msgs::String::ConstPtr& imageMsg);
/// \brief Callbakc when a projector toggle is published
private: void ToggleProjector(const std_msgs::Int32::ConstPtr& projectorMsg);
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
private: ros::NodeHandle* rosnode_;
private: ros::Subscriber imageSubscriber_;
private: ros::Subscriber projectorSubscriber_;
/// \brief ROS texture topic name
private: std::string texture_topic_name_;
/// \brief ROS projector topic name
private: std::string projector_topic_name_;
/// \brief For setting ROS name space
private: std::string robot_namespace_;
// Custom Callback Queue
private: ros::CallbackQueue queue_;
private: void QueueThread();
private: boost::thread callback_queue_thread_;
private: event::ConnectionPtr add_model_event_;
private: transport::NodePtr node_;
private: transport::PublisherPtr projector_pub_;
};
/** \} */
/// @}
}
#endif

View File

@ -0,0 +1,104 @@
/*
* Copyright 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_PROSILICA_CAMERA_HH
#define GAZEBO_ROS_PROSILICA_CAMERA_HH
#include <boost/thread/mutex.hpp>
// library for processing camera data for gazebo / ros conversions
#include <gazebo_plugins/gazebo_ros_camera_utils.h>
#include <gazebo/plugins/CameraPlugin.hh>
// ros
#include <ros/callback_queue.h>
// image components
#include <cv_bridge/cv_bridge.h>
// used by polled_camera
#include <sensor_msgs/RegionOfInterest.h>
// prosilica components
// Stuff in image_common
#include <image_transport/image_transport.h>
#include <polled_camera/publication_server.h> // do: sudo apt-get install ros-hydro-polled-camera
#include <polled_camera/GetPolledImage.h>
namespace gazebo
{
class GazeboRosProsilica : public CameraPlugin, GazeboRosCameraUtils
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosProsilica();
/// \brief Destructor
public: virtual ~GazeboRosProsilica();
/// \brief Load the controller
/// \param node XML config node
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief does nothing for now
private: static void mouse_cb(int event, int x, int y, int flags, void* param) { };
/// \brief image_transport
private: polled_camera::PublicationServer poll_srv_; // Handles requests in polled mode
private: std::string mode_;
private: std::string mode_param_name;
/*
/// \brief Service call to publish images, cam info
private: bool camInfoService(prosilica_camera::CameraInfo::Request &req,
prosilica_camera::CameraInfo::Response &res);
private: bool triggeredGrab(prosilica_camera::PolledImage::Request &req,
prosilica_camera::PolledImage::Response &res);
*/
private: void pollCallback(polled_camera::GetPolledImage::Request& req,
polled_camera::GetPolledImage::Response& rsp,
sensor_msgs::Image& image, sensor_msgs::CameraInfo& info);
/// \brief ros message
/// \brief construct raw stereo message
private: sensor_msgs::Image *roiImageMsg;
private: sensor_msgs::CameraInfo *roiCameraInfoMsg;
/// \brief ROS image topic name
private: std::string pollServiceName;
private: void Advertise();
private: event::ConnectionPtr load_connection_;
// subscribe to world stats
//private: transport::NodePtr node;
//private: transport::SubscriberPtr statsSub;
//private: common::Time simTime;
//public: void OnStats( const boost::shared_ptr<msgs::WorldStatistics const> &_msg);
/// \brief Update the controller
protected: virtual void OnNewImageFrame(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
};
}
#endif

View File

@ -0,0 +1,145 @@
/*
* Software License Agreement (Modified BSD License)
*
* Copyright (c) 2013, PAL Robotics, S.L.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of PAL Robotics, S.L. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/** \author Jose Capriles. */
#ifndef GAZEBO_ROS_RANGE_H
#define GAZEBO_ROS_RANGE_H
#include <string>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <sensor_msgs/Range.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/msgs/MessageTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
#include <gazebo/sensors/SensorTypes.hh>
#include <gazebo/plugins/RayPlugin.hh>
#include <sdf/Param.hh>
namespace gazebo
{
class GazeboRosRange : public RayPlugin
{
/// \brief Constructor
public: GazeboRosRange();
/// \brief Destructor
public: ~GazeboRosRange();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Update the controller
protected: virtual void OnNewLaserScans();
/// \brief Put range data to the ROS topic
private: void PutRangeData(common::Time &_updateTime);
/// \brief Keep track of number of connctions
private: int range_connect_count_;
private: void RangeConnect();
private: void RangeDisconnect();
// Pointer to the model
private: physics::WorldPtr world_;
/// \brief The parent sensor
private: sensors::SensorPtr parent_sensor_;
private: sensors::RaySensorPtr parent_ray_sensor_;
/// \brief pointer to ros node
private: ros::NodeHandle* rosnode_;
private: ros::Publisher pub_;
/// \brief ros message
private: sensor_msgs::Range range_msg_;
/// \brief topic name
private: std::string topic_name_;
/// \brief frame transform name, should match link name
private: std::string frame_name_;
/// \brief radiation type : ultrasound or infrared
private: std::string radiation_;
/// \brief sensor field of view
private: double fov_;
/// \brief Gaussian noise
private: double gaussian_noise_;
/// \brief Gaussian noise generator
private: double GaussianKernel(double mu, double sigma);
/// \brief mutex to lock access to fields that are used in message callbacks
private: boost::mutex lock_;
/// \brief hack to mimic hokuyo intensity cutoff of 100
private: double hokuyo_min_intensity_;
/// update rate of this sensor
private: double update_rate_;
private: double update_period_;
private: common::Time last_update_time_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
private: ros::CallbackQueue range_queue_;
private: void RangeQueueThread();
private: boost::thread callback_queue_thread_;
// deferred load in case ros is blocking
private: sdf::ElementPtr sdf;
private: void LoadThread();
private: boost::thread deferred_load_thread_;
private: unsigned int seed;
};
}
#endif // GAZEBO_ROS_RANGE_H

View File

@ -0,0 +1,142 @@
/*
* Copyright (c) 2010, Daniel Hewlett, Antons Rebguns
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Antons Rebguns <email> ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Antons Rebguns <email> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**/
/*
* \file gazebo_ros_skid_steer_drive.h
*
* \brief A skid steering drive plugin. Inspired by gazebo_ros_diff_drive and SkidSteerDrivePlugin
*
* \author Zdenek Materna (imaterna@fit.vutbr.cz)
*
* $ Id: 06/25/2013 11:23:40 AM materna $
*/
#ifndef GAZEBO_ROS_SKID_STEER_DRIVE_H_
#define GAZEBO_ROS_SKID_STEER_DRIVE_H_
#include <map>
#include <gazebo/common/common.hh>
#include <gazebo/physics/physics.hh>
// ROS
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h>
#include <geometry_msgs/Twist.h>
#include <nav_msgs/Odometry.h>
#include <nav_msgs/OccupancyGrid.h>
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
// Boost
#include <boost/thread.hpp>
#include <boost/bind.hpp>
namespace gazebo {
class Joint;
class Entity;
class GazeboRosSkidSteerDrive : public ModelPlugin {
public:
GazeboRosSkidSteerDrive();
~GazeboRosSkidSteerDrive();
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
protected:
virtual void UpdateChild();
virtual void FiniChild();
private:
void publishOdometry(double step_time);
void getWheelVelocities();
physics::WorldPtr world;
physics::ModelPtr parent;
event::ConnectionPtr update_connection_;
std::string left_front_joint_name_;
std::string right_front_joint_name_;
std::string left_rear_joint_name_;
std::string right_rear_joint_name_;
double wheel_separation_;
double wheel_diameter_;
double torque;
double wheel_speed_[4];
physics::JointPtr joints[4];
// ROS STUFF
ros::NodeHandle* rosnode_;
ros::Publisher odometry_publisher_;
ros::Subscriber cmd_vel_subscriber_;
tf::TransformBroadcaster *transform_broadcaster_;
nav_msgs::Odometry odom_;
std::string tf_prefix_;
bool broadcast_tf_;
boost::mutex lock;
std::string robot_namespace_;
std::string command_topic_;
std::string odometry_topic_;
std::string odometry_frame_;
std::string robot_base_frame_;
// Custom Callback Queue
ros::CallbackQueue queue_;
boost::thread callback_queue_thread_;
void QueueThread();
// DiffDrive stuff
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr& cmd_msg);
double x_;
double rot_;
bool alive_;
// Update Rate
double update_rate_;
double update_period_;
common::Time last_update_time_;
double covariance_x_;
double covariance_y_;
double covariance_yaw_;
};
}
#endif /* GAZEBO_ROS_SKID_STEER_DRIVE_H_ */

View File

@ -0,0 +1,56 @@
/*
* Copyright (C) 2012-2014 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: 3D position interface.
* Author: Sachin Chitta and John Hsu
* Date: 10 June 2008
*/
#ifndef GAZEBO_ROS_TEMPLATE_HH
#define GAZEBO_ROS_TEMPLATE_HH
#include <ros/ros.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
namespace gazebo
{
class GazeboRosTemplate : public ModelPlugin
{
/// \brief Constructor
public: GazeboRosTemplate();
/// \brief Destructor
public: virtual ~GazeboRosTemplate();
/// \brief Load the controller
public: void Load( physics::ModelPtr _parent, sdf::ElementPtr _sdf );
/// \brief Update the controller
protected: virtual void UpdateChild();
};
}
#endif

View File

@ -0,0 +1,170 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2013, Markus Bader <markus.bader@tuwien.ac.at>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
/**
* \file gazebo_ros_tricycle_drive.cpp
* \brief A tricycle drive plugin for gazebo.
* \author Markus Bader <markus.bader@tuwien.ac.at>
* \date 22th of June 2014
*/
#ifndef TRICYCLE_DRIVE_PLUGIN_HH
#define TRICYCLE_DRIVE_PLUGIN_HH
#include <map>
// Gazebo
#include <gazebo_plugins/gazebo_ros_utils.h>
// ROS
#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h>
#include <geometry_msgs/Twist.h>
#include <geometry_msgs/Pose2D.h>
#include <nav_msgs/Odometry.h>
#include <nav_msgs/OccupancyGrid.h>
#include <sensor_msgs/JointState.h>
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
// Boost
#include <boost/thread.hpp>
#include <boost/bind.hpp>
namespace gazebo {
class Joint;
class Entity;
class GazeboRosTricycleDrive : public ModelPlugin {
class TricycleDriveCmd {
public:
TricycleDriveCmd():speed(0), angle(0) {};
double speed;
double angle;
};
enum OdomSource
{
ENCODER = 0,
WORLD = 1,
};
public:
GazeboRosTricycleDrive();
~GazeboRosTricycleDrive();
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf);
protected:
virtual void UpdateChild();
virtual void FiniChild();
private:
GazeboRosPtr gazebo_ros_;
physics::ModelPtr parent;
void publishOdometry(double step_time);
void publishWheelTF(); /// publishes the wheel tf's
void publishWheelJointState();
void motorController(double target_speed, double target_angle, double dt);
event::ConnectionPtr update_connection_;
physics::JointPtr joint_steering_;
physics::JointPtr joint_wheel_actuated_;
physics::JointPtr joint_wheel_encoder_left_;
physics::JointPtr joint_wheel_encoder_right_;
double diameter_encoder_wheel_;
double diameter_actuated_wheel_;
double wheel_acceleration_;
double wheel_deceleration_;
double wheel_speed_tolerance_;
double steering_angle_tolerance_;
double steering_speed_;
double separation_encoder_wheel_;
OdomSource odom_source_;
double wheel_torque_;
std::string robot_namespace_;
std::string command_topic_;
std::string odometry_topic_;
std::string odometry_frame_;
std::string robot_base_frame_;
// ROS STUFF
ros::Publisher odometry_publisher_;
ros::Subscriber cmd_vel_subscriber_;
boost::shared_ptr<tf::TransformBroadcaster> transform_broadcaster_;
sensor_msgs::JointState joint_state_;
ros::Publisher joint_state_publisher_;
nav_msgs::Odometry odom_;
boost::mutex lock;
// Custom Callback Queue
ros::CallbackQueue queue_;
boost::thread callback_queue_thread_;
void QueueThread();
// DiffDrive stuff
void cmdVelCallback(const geometry_msgs::Twist::ConstPtr& cmd_msg);
/// updates the relative robot pose based on the wheel encoders
void UpdateOdometryEncoder();
TricycleDriveCmd cmd_;
bool alive_;
geometry_msgs::Pose2D pose_encoder_;
common::Time last_odom_update_;
// Update Rate
double update_rate_;
double update_period_;
common::Time last_actuator_update_;
// Flags
bool publishWheelTF_;
bool publishWheelJointState_;
};
}
#endif

View File

@ -0,0 +1,77 @@
/*
* Copyright 2017 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_TRIGGERED_CAMERA_HH
#define GAZEBO_ROS_TRIGGERED_CAMERA_HH
#include <mutex>
#include <string>
// library for processing camera data for gazebo / ros conversions
#include <gazebo/plugins/CameraPlugin.hh>
#include <gazebo_plugins/gazebo_ros_camera_utils.h>
namespace gazebo
{
class GazeboRosTriggeredMultiCamera;
class GazeboRosTriggeredCamera : public CameraPlugin, GazeboRosCameraUtils
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosTriggeredCamera();
/// \brief Destructor
public: ~GazeboRosTriggeredCamera();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
/// \brief Load the plugin.
/// \param[in] _parent Take in SDF root element.
/// \param[in] _sdf SDF values.
/// \param[in] _camera_name_suffix Suffix of the camera name.
/// \param[in] _hack_baseline Multiple camera baseline.
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf,
const std::string &_camera_name_suffix,
double _hack_baseline);
/// \brief Update the controller
protected: virtual void OnNewFrame(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
protected: virtual void TriggerCamera();
protected: virtual bool CanTriggerCamera();
protected: event::ConnectionPtr preRenderConnection_;
public: void SetCameraEnabled(const bool _enabled);
protected: void PreRender();
protected: int triggered = 0;
protected: std::mutex mutex;
friend class GazeboRosTriggeredMultiCamera;
};
}
#endif

View File

@ -0,0 +1,67 @@
/*
* Copyright 2017 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_ROS_TRIGGERED_MULTICAMERA_HH
#define GAZEBO_ROS_TRIGGERED_MULTICAMERA_HH
#include <string>
#include <vector>
// library for processing camera data for gazebo / ros conversions
#include <gazebo_plugins/gazebo_ros_triggered_camera.h>
#include <gazebo_plugins/MultiCameraPlugin.h>
namespace gazebo
{
class GazeboRosTriggeredMultiCamera : public MultiCameraPlugin
{
/// \brief Constructor
/// \param parent The parent entity, must be a Model or a Sensor
public: GazeboRosTriggeredMultiCamera();
/// \brief Destructor
public: ~GazeboRosTriggeredMultiCamera();
/// \brief Load the plugin
/// \param take in SDF root element
public: void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
std::vector<GazeboRosTriggeredCamera *> triggered_cameras;
/// \brief Update the controller
/// FIXME: switch to function vectors
protected: virtual void OnNewFrameLeft(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
protected: virtual void OnNewFrameRight(const unsigned char *_image,
unsigned int _width, unsigned int _height,
unsigned int _depth, const std::string &_format);
/// Bookkeeping flags that will be passed into the underlying
/// GazeboRosCameraUtils objects to let them share state about the parent
/// sensor.
private: boost::shared_ptr<int> image_connect_count_;
private: boost::shared_ptr<boost::mutex> image_connect_count_lock_;
private: boost::shared_ptr<bool> was_active_;
protected: event::ConnectionPtr preRenderConnection_;
protected: void SetCameraEnabled(const bool _enabled);
protected: void PreRender();
};
}
#endif

View File

@ -0,0 +1,293 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2013, Markus Bader <markus.bader@tuwien.ac.at>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
#ifndef GAZEBO_ROS_UTILS_H
#define GAZEBO_ROS_UTILS_H
#include <map>
#include <boost/algorithm/string.hpp>
#include <gazebo/common/common.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/sensors/Sensor.hh>
#include <gazebo/gazebo_config.h>
#include <ros/ros.h>
#ifndef GAZEBO_SENSORS_USING_DYNAMIC_POINTER_CAST
#define GAZEBO_SENSORS_USING_DYNAMIC_POINTER_CAST using std::dynamic_pointer_cast
#endif
namespace gazebo
{
/**
* Accessing model name like suggested by nkoenig at http://answers.gazebosim.org/question/4878/multiple-robots-with-ros-plugins-sensor-plugin-vs/
* @param parent
* @return accessing model name
**/
inline std::string GetModelName ( const sensors::SensorPtr &parent )
{
std::string modelName;
std::vector<std::string> values;
std::string scopedName = parent->ScopedName();
boost::replace_all ( scopedName, "::", "," );
boost::split ( values, scopedName, boost::is_any_of ( "," ) );
if ( values.size() < 2 ) {
modelName = "";
} else {
modelName = values[1];
}
return modelName;
}
/**
* @brief Reads the name space tag of a sensor plugin
* @param parent
* @param sdf
* @param pInfo
* @return node namespace
**/
inline std::string GetRobotNamespace ( const sensors::SensorPtr &parent, const sdf::ElementPtr &sdf, const char *pInfo = NULL )
{
std::string name_space;
std::stringstream ss;
if ( sdf->HasElement ( "robotNamespace" ) ) {
name_space = sdf->Get<std::string> ( "robotNamespace" );
if ( name_space.empty() ) {
ss << "The 'robotNamespace' param was empty";
name_space = GetModelName ( parent );
} else {
ss << "Using the 'robotNamespace' param: '" << name_space << "'";
}
} else {
ss << "The 'robotNamespace' param did not exit";
}
if ( pInfo != NULL ) {
ROS_INFO_NAMED("utils", "%s Plugin: %s" , pInfo, ss.str().c_str() );
}
return name_space;
}
/**
* Gazebo ros helper class
* The class simplifies the parameter and rosnode handling
* @author Markus Bader <markus.bader@tuwien.ac.at>
**/
class GazeboRos
{
private:
sdf::ElementPtr sdf_; /// sdf to read
std::string plugin_; /// name of the plugin class
std::string namespace_; /// name of the launched node
boost::shared_ptr<ros::NodeHandle> rosnode_; /// rosnode
std::string tf_prefix_; /// prefix for the ros tf plublisher if not set it uses the namespace_
std::string info_text; /// info text for log messages to identify the node
/**
* Reads the common plugin parameters used by the constructor
**/
void readCommonParameter ();
public:
/**
* Constructor
* @param _parent models parent
* @param _sdf sdf to read
* @param _name of the plugin class
**/
GazeboRos ( physics::ModelPtr &_parent, sdf::ElementPtr _sdf, const std::string &_plugin )
: sdf_ ( _sdf ), plugin_ ( _plugin ) {
namespace_ = _parent->GetName ();
if ( !sdf_->HasElement ( "robotNamespace" ) ) {
ROS_INFO_NAMED("utils", "%s missing <robotNamespace>, defaults is %s", plugin_.c_str(), namespace_.c_str() );
} else {
namespace_ = sdf_->GetElement ( "robotNamespace" )->Get<std::string>();
if ( namespace_.empty() ) {
namespace_ = _parent->GetName();
}
}
if ( !namespace_.empty() )
this->namespace_ += "/";
rosnode_ = boost::shared_ptr<ros::NodeHandle> ( new ros::NodeHandle ( namespace_ ) );
info_text = plugin_ + "(ns = " + namespace_ + ")";
readCommonParameter ();
}
/**
* Constructor
* @param _parent sensor parent
* @param _sdf sdf to read
* @param _name of the plugin class
**/
GazeboRos ( sensors::SensorPtr _parent, sdf::ElementPtr _sdf, const std::string &_plugin )
: sdf_ ( _sdf ), plugin_ ( _plugin ) {
std::stringstream ss;
if ( sdf_->HasElement ( "robotNamespace" ) ) {
namespace_ = sdf_->Get<std::string> ( "robotNamespace" );
if ( namespace_.empty() ) {
ss << "the 'robotNamespace' param was empty";
namespace_ = GetModelName ( _parent );
} else {
ss << "Using the 'robotNamespace' param: '" << namespace_ << "'";
}
} else {
ss << "the 'robotNamespace' param did not exit";
}
info_text = plugin_ + "(ns = " + namespace_ + ")";
ROS_INFO_NAMED("utils", "%s: %s" , info_text.c_str(), ss.str().c_str() );
readCommonParameter ();
}
/**
* Returns info text used for log messages
* @return class name and node name as string
**/
const char* info() const;
/**
* returns the initialized created within the constuctor
* @return rosnode
**/
boost::shared_ptr<ros::NodeHandle>& node();;
/**
* returns the initialized within the constuctor
* @return rosnode
**/
const boost::shared_ptr<ros::NodeHandle>& node() const;
/**
* resolves a tf frame name by adding the tf_prefix initialized within the constuctor
* @param _name
* @retun resolved tf name
**/
std::string resolveTF ( const std::string &_name );
/**
* reads the follwoing _tag_name paramer or sets a _default value
* @param _value
* @param _tag_name
* @param _default
* @retun sdf tag value
**/
void getParameterBoolean ( bool &_value, const char *_tag_name, const bool &_default );
/**
* reads the follwoing _tag_name paramer
* @param _value
* @param _tag_name
* @retun sdf tag value
**/
void getParameterBoolean ( bool &_value, const char *_tag_name );
/**
* retuns a JointPtr based on an sdf tag_name entry
* @param _value
* @param _tag_name
* @param _joint_default_name
* @retun JointPtr
**/
physics::JointPtr getJoint ( physics::ModelPtr &_parent, const char *_tag_name, const std::string &_joint_default_name );
/**
* checks if the ros not is initialized
* @retun JointPtr
**/
void isInitialized();
/**
* reads the follwoing _tag_name paramer or sets a _default value
* @param _value
* @param _tag_name
* @param _default
* @retun sdf tag value
**/
template <class T>
void getParameter ( T &_value, const char *_tag_name, const T &_default ) {
_value = _default;
if ( !sdf_->HasElement ( _tag_name ) ) {
ROS_WARN_NAMED("utils", "%s: missing <%s> default is %s", info(), _tag_name, boost::lexical_cast<std::string> ( _default ).c_str() );
} else {
this->getParameter<T> ( _value, _tag_name );
}
}
/**
* reads the follwoing _tag_name paramer
* @param _value
* @param _tag_name
* @param _default
* @retun sdf tag value
**/
template <class T>
void getParameter ( T &_value, const char *_tag_name ) {
if ( sdf_->HasElement ( _tag_name ) ) {
_value = sdf_->GetElement ( _tag_name )->Get<T>();
}
ROS_DEBUG_NAMED("utils", "%s: <%s> = %s", info(), _tag_name, boost::lexical_cast<std::string> ( _value ).c_str() );
}
/**
* reads the following _tag_name paramer and compares the value with an _options map keys and retuns the corresponding value.
* @param _value
* @param _tag_name
* @param _default
* @retun sdf tag value
**/
template <class T>
void getParameter ( T &_value, const char *_tag_name, const std::map<std::string, T> &_options, const T &_default ) {
_value = _default;
if ( !sdf_->HasElement ( _tag_name ) ) {
ROS_WARN_NAMED("utils", "%s: missing <%s> default is %s", info(), _tag_name, boost::lexical_cast<std::string> ( _default ).c_str() );
} else {
this->getParameter<T> ( _value, _tag_name, _options );
}
}
/**
* reads the following _tag_name paramer and compares the value with an _options map keys and retuns the corresponding value.
* @param _value
* @param _tag_name
* @param _default
* @retun sdf tag value
**/
template <class T>
void getParameter ( T &_value, const char *_tag_name, const std::map<std::string, T> &_options ) {
typename std::map<std::string, T >::const_iterator it;
if ( sdf_->HasElement ( _tag_name ) ) {
std::string value = sdf_->GetElement ( _tag_name )->Get<std::string>();
it = _options.find ( value );
if ( it == _options.end() ) {
ROS_WARN_NAMED("utils", "%s: <%s> no matching key to %s", info(), _tag_name, value.c_str() );
} else {
_value = it->second;
}
}
ROS_DEBUG_NAMED("utils", "%s: <%s> = %s := %s", info(), _tag_name, ( it == _options.end() ?"default":it->first.c_str() ), boost::lexical_cast<std::string> ( _value ).c_str() );
}
};
typedef boost::shared_ptr<GazeboRos> GazeboRosPtr;
}
#endif

View File

@ -0,0 +1,161 @@
/*
* Copyright (C) 2015-2016 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
Desc: GazeboVacuumGripper plugin for manipulating objects in Gazebo
* Author: Kentaro Wada
* Date: 7 Dec 2015
*/
#ifndef GAZEBO_ROS_VACUUM_GRIPPER_HH
#define GAZEBO_ROS_VACUUM_GRIPPER_HH
#include <string>
// Custom Callback Queue
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <ros/advertise_service_options.h>
#include <std_srvs/Empty.h>
#include <ros/ros.h>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/TransportTypes.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Events.hh>
namespace gazebo
{
/// @addtogroup gazebo_dynamic_plugins Gazebo ROS Dynamic Plugins
/// @{
/** \defgroup GazeboRosVacuumGripper Plugin XML Reference and Example
\brief Ros Vacuum Gripper Plugin.
This is a Plugin that collects data from a ROS topic and applies wrench to a body accordingly.
Example Usage:
- left_end_effector will be the power point
- revolute type joint is necessary (fixed joint disappears on gazebo and plugin can't find the joint and link)
\verbatim
<link name="left_end_effector">
<gravity>0</gravity>
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="0.01 0.01 0.01"/>
</geometry>
<material name="transparent">
<color rgba="0 0 0 0"/>
</material>
</visual>
<inertial>
<origin rpy="0 0 0" xyz="0.000000 0.000000 0.000000"/>
<mass value="0.0001"/>
<inertia ixx="1e-08" ixy="0" ixz="0" iyy="1e-08" iyz="0" izz="1e-08"/>
</inertial>
</link>
<joint name="left_end_joint" type="revolute">
<parent link="left_wrist" />
<child link="left_end_effector" />
<origin rpy="0 0 0" xyz="0.08 0 .44" />
<limit effort="30" velocity="1.0" lower="0" upper="0" />
</joint>
<gazebo>
<plugin name="gazebo_ros_vacuum_gripper" filename="libgazebo_ros_vacuum_gripper.so">
<robotNamespace>/robot/left_vacuum_gripper</robotNamespace>
<bodyName>left_end_effector</bodyName>
<topicName>grasping</topicName>
</plugin>
</gazebo>
\endverbatim
\{
*/
class GazeboRosVacuumGripper : public ModelPlugin
{
/// \brief Constructor
public: GazeboRosVacuumGripper();
/// \brief Destructor
public: virtual ~GazeboRosVacuumGripper();
// Documentation inherited
protected: void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
// Documentation inherited
protected: virtual void UpdateChild();
/// \brief The custom callback queue thread function.
private: void QueueThread();
private: bool OnServiceCallback(std_srvs::Empty::Request &req,
std_srvs::Empty::Response &res);
private: bool OffServiceCallback(std_srvs::Empty::Request &req,
std_srvs::Empty::Response &res);
private: bool status_;
private: physics::ModelPtr parent_;
/// \brief A pointer to the gazebo world.
private: physics::WorldPtr world_;
/// \brief A pointer to the Link, where force is applied
private: physics::LinkPtr link_;
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
private: ros::NodeHandle* rosnode_;
/// \brief A mutex to lock access to fields that are used in ROS message callbacks
private: boost::mutex lock_;
private: ros::Publisher pub_;
private: ros::ServiceServer srv1_;
private: ros::ServiceServer srv2_;
/// \brief ROS Wrench topic name inputs
private: std::string topic_name_;
private: std::string service_name_;
/// \brief The Link this plugin is attached to, and will exert forces on.
private: std::string link_name_;
/// \brief for setting ROS name space
private: std::string robot_namespace_;
// Custom Callback Queue
private: ros::CallbackQueue queue_;
/// \brief Thead object for the running callback Thread.
private: boost::thread callback_queue_thread_;
// Pointer to the update event connection
private: event::ConnectionPtr update_connection_;
/// \brief: keep track of number of connections
private: int connect_count_;
private: void Connect();
private: void Disconnect();
};
/** \} */
/// @}
}
#endif

View File

@ -0,0 +1,100 @@
/*
* Copyright 2013 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* Desc: Video plugin for displaying ROS image topics on Ogre textures
* Author: Piyush Khandelwal
* Date: 26 July 2013
*/
#ifndef GAZEBO_ROS_VIDEO_H
#define GAZEBO_ROS_VIDEO_H
#include <boost/thread/mutex.hpp>
#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <opencv2/opencv.hpp>
#include <ros/advertise_options.h>
#include <ros/callback_queue.h>
#include <ros/ros.h>
#include <sensor_msgs/Image.h>
#include <gazebo/common/Events.hh>
#include <gazebo/common/Plugin.hh>
#include <gazebo/common/Time.hh>
#include <gazebo/rendering/rendering.hh>
#include <gazebo/transport/TransportTypes.hh>
namespace gazebo
{
class VideoVisual : public rendering::Visual
{
public:
VideoVisual(
const std::string &name, rendering::VisualPtr parent,
int height, int width);
virtual ~VideoVisual();
void render(const cv::Mat& image);
private:
Ogre::TexturePtr texture_;
int height_;
int width_;
};
class GazeboRosVideo : public VisualPlugin
{
public:
GazeboRosVideo();
virtual ~GazeboRosVideo();
void Load(rendering::VisualPtr parent, sdf::ElementPtr sdf);
void processImage(const sensor_msgs::ImageConstPtr &msg);
protected:
virtual void UpdateChild();
// Pointer to the model
rendering::VisualPtr model_;
// Pointer to the update event connection
event::ConnectionPtr update_connection_;
boost::shared_ptr<VideoVisual> video_visual_;
cv_bridge::CvImagePtr image_;
boost::mutex m_image_;
bool new_image_available_;
/// \brief A pointer to the ROS node. A node will be instantiated if it does not exist.
ros::NodeHandle* rosnode_;
// ROS Stuff
ros::Subscriber camera_subscriber_;
std::string robot_namespace_;
std::string topic_name_;
ros::CallbackQueue queue_;
boost::thread callback_queue_thread_;
void QueueThread();
};
}
#endif

View File

@ -0,0 +1,70 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2009-2010, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
#ifndef VISION_RECONFIGURE_HH
#define VISION_RECONFIGURE_HH
#include <ros/ros.h>
#include <std_msgs/Header.h>
#include <std_msgs/Int32.h>
#include <dynamic_reconfigure/server.h>
#include <boost/thread/thread.hpp>
#include <gazebo_plugins/CameraSynchronizerConfig.h>
#include <ros/callback_queue.h>
class VisionReconfigure
{
public:
VisionReconfigure();
~VisionReconfigure();
void ReconfigureCallback(gazebo_plugins::CameraSynchronizerConfig &config, uint32_t level);
void QueueThread();
void spinOnce();
void spin(double spin_frequency);
private:
ros::NodeHandle nh_;
ros::Publisher pub_projector_;
ros::Publisher pub_header_;
dynamic_reconfigure::Server<gazebo_plugins::CameraSynchronizerConfig> srv_;
std_msgs::Int32 projector_msg_;
ros::CallbackQueue queue_;
boost::thread callback_queue_thread_;
};
#endif

View File

@ -0,0 +1,55 @@
<?xml version="1.0"?>
<package format="2">
<name>gazebo_plugins</name>
<version>2.5.15</version>
<description>
Robot-independent Gazebo plugins for sensors, motors and dynamic reconfigurable components.
</description>
<maintainer email="jrivero@osrfoundation.org">Jose Luis Rivero</maintainer>
<license>BSD, Apache 2.0</license>
<url type="website">http://gazebosim.org/tutorials?cat=connect_ros</url>
<url type="bugtracker">https://github.com/ros-simulation/gazebo_ros_pkgs/issues</url>
<url type="repository">https://github.com/ros-simulation/gazebo_ros_pkgs</url>
<author>John Hsu</author>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>gazebo_dev</build_depend>
<!--
Need to use gazebo_dev since run script needs pkg-config
See: https://github.com/ros-simulation/gazebo_ros_pkgs/issues/323 for more info
-->
<exec_depend>gazebo_dev</exec_depend>
<depend>gazebo_msgs</depend>
<depend>geometry_msgs</depend>
<depend>sensor_msgs</depend>
<depend>trajectory_msgs</depend>
<depend>std_srvs</depend>
<depend>roscpp</depend>
<depend>rospy</depend>
<depend>nodelet</depend>
<depend>angles</depend>
<depend>nav_msgs</depend>
<depend>urdf</depend>
<depend>tf</depend>
<depend>tf2_ros</depend>
<depend>dynamic_reconfigure</depend>
<depend>rosgraph_msgs</depend>
<depend>image_transport</depend>
<depend>rosconsole</depend>
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>
<depend>cv_bridge</depend>
<depend>polled_camera</depend>
<depend>diagnostic_updater</depend>
<depend>camera_info_manager</depend>
<depend>std_msgs</depend>
<test_depend>rostest</test_depend>
</package>

View File

@ -0,0 +1,68 @@
#!/usr/bin/env python
#
# testing, do not use
#
# Provides quick access to the services exposed by gazebo_ros_factory plugin
import roslib, time
roslib.load_manifest('gazebo_plugins')
import rospy, sys
import string
from gazebo_plugins import gazebo_plugins_interface
from gazebo_plugins.msg import GazeboModel
from geometry_msgs.msg import Pose, Point, Quaternion
def usage():
print '''Commands:
load [param|file] [urdf|gazebo] <param/file name> <model name> <initial pose: x y z r p y> <namespace> - Load model
delete <model name> - Deletes the model named <model name>
'''
sys.exit(1)
if __name__ == "__main__":
if len(sys.argv) < 13:
print usage()
if sys.argv[1] == 'load':
if sys.argv[2] == 'param':
print "loading from parameter"
elif sys.argv[2] == 'file':
print "loading from file"
else:
print "invalid syntax, first argument has to be either param or file"
print usage()
if sys.argv[3] == 'urdf':
print "loading urdf"
elif sys.argv[3] == 'gazebo':
print "loading gazebo model"
else:
print "invalid syntax, xml type has to be either urdf or gazebo"
print usage()
param_name = sys.argv[4]
model_name = sys.argv[5]
lx = float(sys.argv[6])
ly = float(sys.argv[7])
lz = float(sys.argv[8])
#FIXME: rotation ignored for now
ax = float(sys.argv[9])
ay = float(sys.argv[10])
az = float(sys.argv[11])
namespace = sys.argv[12]
model_msg = GazeboModel(model_name,param_name,GazeboModel.URDF_PARAM_NAME,namespace,Pose(Point(lx,ly,lz),Quaternion()))
success = gazebo_plugins_interface.load_model(model_msg)
print "spawning success",success
elif sys.argv[1] == 'delete':
print "not implemented yet"
else:
print "unknown command: ",sys.argv[1]
print usage()

View File

@ -0,0 +1,218 @@
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the Willow Garage nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## Gazebo send position topic or calls set pose service for ros_sim_iface consumption
PKG = 'gazebo_plugins'
NAME = 'set_pose'
import math
import roslib
roslib.load_manifest(PKG)
import sys, unittest
import os, os.path, threading, time
import rospy, rostest
from gazebo_plugins.srv import SetPose
from std_msgs.msg import String
from geometry_msgs.msg import Pose,Quaternion,Point, PoseStamped, PoseWithCovariance, TwistWithCovariance, Twist, Vector3
from nav_msgs.msg import Odometry
import tf.transformations as tft
from numpy import float64
COV = [float64(0),float64(0),float64(0),float64(0),float64(0),float64(0), \
float64(0),float64(0),float64(0),float64(0),float64(0),float64(0), \
float64(0),float64(0),float64(0),float64(0),float64(0),float64(0), \
float64(0),float64(0),float64(0),float64(0),float64(0),float64(0), \
float64(0),float64(0),float64(0),float64(0),float64(0),float64(0), \
float64(0),float64(0),float64(0),float64(0),float64(0),float64(0) ]
def normalize_angle_positive(angle):
return math.fmod(math.fmod(angle, 2*math.pi) + 2*math.pi, 2*math.pi)
def normalize_angle(angle):
anorm = normalize_angle_positive(angle)
if anorm > math.pi:
anorm -= 2*math.pi
return anorm
def shortest_angular_distance(angle_from, angle_to):
angle_diff = normalize_angle_positive(angle_to) - normalize_angle_positive(angle_from)
if angle_diff > math.pi:
angle_diff = -(2*math.pi - angle_diff)
return normalize_angle(angle_diff)
class SimIfaceControl():
def __init__(self):
self.update_rate=10
self.timeout=1
self.target_p = [0,0,0] # position
self.target_q = [0,0,0] # quaternion
self.target_e = [0,0,0] # euler pose
self.wait_topic_initialized = False
self.frame_id = "world"
self.service_name = "set_pose_service"
self.topic_name = "set_pose_topic"
self.use_topic = False;
self.use_service = False;
self.wait_topic_name = "clock"
self.wait_for_topic = False;
rospy.init_node(NAME, anonymous=True)
def setPoseService(self,pose_msg):
print "waiting for service to set pose"
rospy.wait_for_service(self.service_name);
try:
set_pose = rospy.ServiceProxy(self.service_name, SetPose)
resp1 = set_pose(pose_msg)
return resp1.success
except rospy.ServiceException, e:
print "service call failed: %s"%e
def waitTopicInput(self,p3d):
#self.p3d_p = [p3d.pose.pose.position.x, p3d.pose.pose.position.y, p3d.pose.pose.position.z]
#self.p3d_q = [p3d.pose.pose.orientation.x, p3d.pose.pose.orientation.y, p3d.pose.pose.orientation.z, p3d.pose.pose.orientation.w]
#self.p3d_e = tft.euler_from_quaternion(self.p3d_q)
self.wait_topic_initialized = True
def setPose(self):
# get goal from commandline
for i in range(0,len(sys.argv)):
if sys.argv[i] == '-update_rate':
if len(sys.argv) > i+1:
self.update_rate = float(sys.argv[i+1])
if sys.argv[i] == '-timeout':
if len(sys.argv) > i+1:
self.timeout = float(sys.argv[i+1])
if sys.argv[i] == '-x':
if len(sys.argv) > i+1:
self.target_p[0] = float(sys.argv[i+1])
if sys.argv[i] == '-y':
if len(sys.argv) > i+1:
self.target_p[1] = float(sys.argv[i+1])
if sys.argv[i] == '-z':
if len(sys.argv) > i+1:
self.target_p[2] = float(sys.argv[i+1])
if sys.argv[i] == '-R':
if len(sys.argv) > i+1:
self.target_e[0] = float(sys.argv[i+1])
if sys.argv[i] == '-P':
if len(sys.argv) > i+1:
self.target_e[1] = float(sys.argv[i+1])
if sys.argv[i] == '-Y':
if len(sys.argv) > i+1:
self.target_e[2] = float(sys.argv[i+1])
if sys.argv[i] == '-f':
if len(sys.argv) > i+1:
self.frame_id = sys.argv[i+1]
if sys.argv[i] == '-s':
if len(sys.argv) > i+1:
self.service_name = sys.argv[i+1]
self.use_service = True;
if sys.argv[i] == '-t':
if len(sys.argv) > i+1:
self.topic_name = sys.argv[i+1]
self.use_topic = True;
if sys.argv[i] == '-p':
if len(sys.argv) > i+1:
self.wait_topic_name = sys.argv[i+1]
self.wait_for_topic = True;
# setup rospy
self.pub_set_pose_topic = rospy.Publisher(self.topic_name, Odometry)
rospy.Subscriber(self.wait_topic_name, rospy.AnyMsg, self.waitTopicInput)
# wait for topic if user requests
if self.wait_for_topic:
while not self.wait_topic_initialized:
time.sleep(0.1)
# compoose goal message
h = rospy.Header()
h.stamp = rospy.get_rostime()
h.frame_id = self.frame_id
p = Point(self.target_p[0],self.target_p[1],self.target_p[2])
tmpq = tft.quaternion_from_euler(self.target_e[0],self.target_e[1],self.target_e[2])
q = Quaternion(tmpq[0],tmpq[1],tmpq[2],tmpq[3])
pose = Pose(p,q)
pwc = PoseWithCovariance(pose,COV)
twc = TwistWithCovariance(Twist(Vector3(),Vector3()),COV)
child_frame_id = "" # what should this be?
target_pose = Odometry(h,child_frame_id,pwc,twc)
if self.use_service:
success = self.setPoseService(target_pose)
# publish topic if specified
if self.use_topic:
timeout_t = time.time() + self.timeout
while not rospy.is_shutdown() and time.time() < timeout_t:
# publish target pose
self.pub_set_pose_topic.publish(target_pose)
if self.update_rate > 0:
time.sleep(1.0/self.update_rate)
else:
time.sleep(0.001)
def print_usage(exit_code = 0):
print '''Commands:
-update_rate <Hz> - update rate, default to 10 Hz
-timeout <seconds> - test timeout in seconds. default to 1 seconds
-x <x in meters>
-y <y in meters>
-z <z in meters>
-R <roll in radians>
-P <pitch in radians>
-Y <yaw in radians>
-f target frame_id
-s set pose service name
-t set pose topic name
-p wait for this ros topic to be published first
'''
if __name__ == '__main__':
#print usage if not arguments
if len(sys.argv) == 1:
print_usage()
else:
sic = SimIfaceControl()
sic.setPose()

View File

@ -0,0 +1,131 @@
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the Willow Garage nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
## Gazebo send wrench topic for gazebo_ros_force consumption
PKG = 'gazebo_plugins'
NAME = 'set_wrench'
import math
import roslib
roslib.load_manifest(PKG)
import sys, unittest
import os, os.path, threading, time
import rospy, rostest
from geometry_msgs.msg import Wrench, Vector3
import tf.transformations as tft
from numpy import float64
class SimIfaceControl():
def __init__(self):
self.update_rate=10
self.target_l = [0,0,0] # linear
self.target_e = [0,0,0] # angular
self.topic_name = "set_wrench_topic"
self.timeout=1
rospy.init_node(NAME, anonymous=True)
def setWrench(self):
# get goal from commandline
for i in range(0,len(sys.argv)):
if sys.argv[i] == '-update_rate':
if len(sys.argv) > i+1:
self.update_rate = float(sys.argv[i+1])
if sys.argv[i] == '-timeout':
if len(sys.argv) > i+1:
self.timeout = float(sys.argv[i+1])
if sys.argv[i] == '-x':
if len(sys.argv) > i+1:
self.target_l[0] = float(sys.argv[i+1])
if sys.argv[i] == '-y':
if len(sys.argv) > i+1:
self.target_l[1] = float(sys.argv[i+1])
if sys.argv[i] == '-z':
if len(sys.argv) > i+1:
self.target_l[2] = float(sys.argv[i+1])
if sys.argv[i] == '-R':
if len(sys.argv) > i+1:
self.target_e[0] = float(sys.argv[i+1])
if sys.argv[i] == '-P':
if len(sys.argv) > i+1:
self.target_e[1] = float(sys.argv[i+1])
if sys.argv[i] == '-Y':
if len(sys.argv) > i+1:
self.target_e[2] = float(sys.argv[i+1])
if sys.argv[i] == '-t':
if len(sys.argv) > i+1:
self.topic_name = sys.argv[i+1]
# setup rospy
self.pub_set_wrench_topic = rospy.Publisher(self.topic_name, Wrench)
# compoose goal message
w = Wrench(Vector3(self.target_l[0],self.target_l[1],self.target_l[2]),Vector3(self.target_e[0],self.target_e[1],self.target_e[2]))
# publish topic if specified
timeout_t = time.time() + self.timeout
while not rospy.is_shutdown() and time.time() < timeout_t:
# publish target wrench
self.pub_set_wrench_topic.publish(w)
if self.update_rate > 0:
time.sleep(1.0/self.update_rate)
else:
time.sleep(0.001)
def print_usage(exit_code = 0):
print '''Commands:
-update_rate <Hz> - update rate, default to 10 Hz
-timeout <seconds> - test timeout in seconds. default to 1 seconds
-x <x in meters>
-y <y in meters>
-z <z in meters>
-R <roll in radians>
-P <pitch in radians>
-Y <yaw in radians>
-t set wrench topic name
'''
if __name__ == '__main__':
#print usage if not arguments
if len(sys.argv) == 1:
print_usage()
else:
sic = SimIfaceControl()
sic.setWrench()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import Range
import unittest
class TestRangePlugin(unittest.TestCase):
def test_max_range(self):
msg = rospy.wait_for_message('/sonar2', Range)
self.assertAlmostEqual(msg.range, msg.max_range)
def test_inside_range(self):
msg = rospy.wait_for_message('/sonar', Range)
self.assertTrue(msg.range < 0.25 and msg.range > 0.22)
if __name__ == '__main__':
import rostest
PKG_NAME = 'gazebo_plugins'
TEST_NAME = PKG_NAME + 'range_test'
rospy.init_node(TEST_NAME)
rostest.rosrun(PKG_NAME, TEST_NAME, TestRangePlugin)

View File

@ -0,0 +1,9 @@
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup()
d['packages'] = ['gazebo_plugins']
d['package_dir'] = {'':'src'}
setup(**d)

View File

@ -0,0 +1,118 @@
/*
* Copyright 2013 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <gazebo/sensors/DepthCameraSensor.hh>
#include <gazebo/sensors/CameraSensor.hh>
#include <gazebo_plugins/MultiCameraPlugin.h>
#include <gazebo_plugins/gazebo_ros_utils.h>
using namespace gazebo;
GZ_REGISTER_SENSOR_PLUGIN(MultiCameraPlugin)
/////////////////////////////////////////////////
MultiCameraPlugin::MultiCameraPlugin() : SensorPlugin()
{
}
/////////////////////////////////////////////////
MultiCameraPlugin::~MultiCameraPlugin()
{
this->parentSensor.reset();
this->camera.clear();
}
/////////////////////////////////////////////////
void MultiCameraPlugin::Load(sensors::SensorPtr _sensor,
sdf::ElementPtr /*_sdf*/)
{
if (!_sensor)
gzerr << "Invalid sensor pointer.\n";
GAZEBO_SENSORS_USING_DYNAMIC_POINTER_CAST;
this->parentSensor =
dynamic_pointer_cast<sensors::MultiCameraSensor>(_sensor);
if (!this->parentSensor)
{
gzerr << "MultiCameraPlugin requires a CameraSensor.\n";
if (dynamic_pointer_cast<sensors::DepthCameraSensor>(_sensor))
gzmsg << "It is a depth camera sensor\n";
if (dynamic_pointer_cast<sensors::CameraSensor>(_sensor))
gzmsg << "It is a camera sensor\n";
}
if (!this->parentSensor)
{
gzerr << "MultiCameraPlugin not attached to a camera sensor\n";
return;
}
for (unsigned int i = 0; i < this->parentSensor->CameraCount(); ++i)
{
this->camera.push_back(this->parentSensor->Camera(i));
// save camera attributes
this->width.push_back(this->camera[i]->ImageWidth());
this->height.push_back(this->camera[i]->ImageHeight());
this->depth.push_back(this->camera[i]->ImageDepth());
this->format.push_back(this->camera[i]->ImageFormat());
std::string cameraName = this->parentSensor->Camera(i)->Name();
// gzdbg << "camera(" << i << ") name [" << cameraName << "]\n";
// FIXME: hardcoded 2 camera support only
if (cameraName.find("left") != std::string::npos)
{
this->newFrameConnection.push_back(this->camera[i]->ConnectNewImageFrame(
boost::bind(&MultiCameraPlugin::OnNewFrameLeft,
this, _1, _2, _3, _4, _5)));
}
else if (cameraName.find("right") != std::string::npos)
{
this->newFrameConnection.push_back(this->camera[i]->ConnectNewImageFrame(
boost::bind(&MultiCameraPlugin::OnNewFrameRight,
this, _1, _2, _3, _4, _5)));
}
}
this->parentSensor->SetActive(true);
}
/////////////////////////////////////////////////
void MultiCameraPlugin::OnNewFrameLeft(const unsigned char * /*_image*/,
unsigned int /*_width*/,
unsigned int /*_height*/,
unsigned int /*_depth*/,
const std::string &/*_format*/)
{
/*rendering::Camera::SaveFrame(_image, this->width,
this->height, this->depth, this->format,
"/tmp/camera/me.jpg");
*/
}
/////////////////////////////////////////////////
void MultiCameraPlugin::OnNewFrameRight(const unsigned char * /*_image*/,
unsigned int /*_width*/,
unsigned int /*_height*/,
unsigned int /*_depth*/,
const std::string &/*_format*/)
{
/*rendering::Camera::SaveFrame(_image, this->width,
this->height, this->depth, this->format,
"/tmp/camera/me.jpg");
*/
}

View File

@ -0,0 +1,48 @@
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2009-2010, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
#include <gazebo_plugins/vision_reconfigure.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "camera_synchronizer");
VisionReconfigure vr;
double spin_frequency = 100.0;
ROS_INFO_NAMED("camera_synchronizer", "Starting to spin camera_synchronizer at %f Hz...",spin_frequency);
vr.spin(spin_frequency);
return 0;
}

Some files were not shown because too many files have changed in this diff Show More