diff --git a/README.md b/README.md index 64fc20f..be17188 100644 --- a/README.md +++ b/README.md @@ -1,86 +1,121 @@ -Attach two Gazebo models with a virtual joint in a generalized grasp hack +# Gazebo Link Attacher -# Build +## Overview -```` -mkdir -p gazebo_link_attacher_ws/src -cd gazebo_link_attacher_ws/src -catkin_init_workspace -git clone https://github.com/pal-robotics/gazebo_ros_link_attacher.git -cd .. +- Attach two Gazebo models with a virtual joint in a generalized grasp hack. -rosdep update -rosdep install --from-paths src --ignore-src -y --rosdistro humble +**Keywords:** gazebo, link, model -colcon build -source install/setup.bash +## License +- The source code is released under a [Apache License 2.0](https://github.com/Brazilian-Institute-of-Robotics/gazebo_ros_link_attacher/blob/main/LICENSE). -```` +**Author:** Claudia Ramos\ +**Affiliation:** Brazilian Institute of Robotics\ +**Maintainer:** Claudia Ramos, +The `gazebo_ros_link_attacher` package has been tested under ROS2 humble and Ubuntu 22.04. This package has been forked from . -# Launch +## Installation - ros2 launch gazebo_ros_link_attacher test_attacher.py +### Building -Empty world with the plugin `libgazebo_ros_link_attacher.so` loaded (in the *worlds* folder). +- **Building with colcon** -Which provides the `/link_attacher_node/attach` service to specify two models and their links to be attached. +To build from source, clone the latest version from this repository into your `colcon` workspace and compile the package using -And `/link_attacher_node/detach` service to specify two models and their links to be detached. +```sh + cd YOUR_WORKSPACE/src + git clone https://github.com/Brazilian-Institute-of-Robotics/gazebo_ros_link_attacher.git + cd YOUR_WORKSPACE + source /opt/ros/${ROS_DISTRO}/setup.bash + colcon build --packages-select gazebo_ros_link_attacher --event-handlers console_direct+ + source install/setup.bash +``` -![gazebo screenshot](doc/ss.png) +- **Building from autoproj** -# Run demo +See build configuration based on autoproj. After Installation and configuration of autoproj, run the following commands: -In another shell, be sure to do `source install/setup.bash` of your workspace. +```sh + cd YOUR_WORKSPACE + source env.sh + amake gazebo_ros_link_attacher + source install/setup.bash +``` - ros2 run gazebo_ros_link_attacher spawn_models.py +### Unit Tests -Three cubes will be spawned. +Run the unit tests with - ros2 run gazebo_ros_link_attacher attach.py +```sh + colcon test --packages-select gazebo_ros_link_attacher --event-handlers console_direct+ +``` -The cubes will be attached all between themselves as (1,2), (2,3), (3,1). You can move them with the GUI and you'll see they will move together. +Run the unit tests with autoproj - ros2 run gazebo_ros_link_attacher detach.py +```sh + autoproj test enable gazebo_ros_link_attacher + amake + autoproj test exec gazebo_ros_link_attacher +``` -The cubes will be detached and you can move them separately again. +## Usage -You can also spawn items with the GUI and run a rosservice call: -```` -ros2 service call /attach 'gazebo_ros_link_attacher/srv/Attach' '{model_name_1: 'cube1', -link_name_1: 'link', -model_name_2: 'cube2', -link_name_2: 'link'}' -```` +## Run demo -And same thing to detach: -```` -ros2 service call /detach 'gazebo_ros_link_attacher/srv/Attach' '{model_name_1: 'cube1', -link_name_1: 'link', -model_name_2: 'cube2', -link_name_2: 'link'}' -```` +Run the command below to start an empty world with the plugin `libgazebo_ros_link_attacher.so` loaded (in the *worlds* folder). + +```sh +ros2 launch gazebo_ros_link_attacher test_attacher.py +``` +It provides the `/link_attacher_node/attach` service to specify two models and their links to be attached. And `/link_attacher_node/detach` service to specify two models and their links to be detached. -# Current status -It works! +![gazebo screenshot](doc/ss.png) -~~Currently it crashes with:~~ +In another shell, run the command below to spawn three cubes: +```sh + ros2 run gazebo_ros_link_attacher spawn_models.py +``` + +The cubes will be attached all between themselves as (1,2), (2,3), (3,1). You can move them with the GUI and you'll see they will move together. + + ```sh + ros2 run gazebo_ros_link_attacher attach.py + ``` + +And with 'detach.py' the cubes will be detached and you can move them separately again. + + ```sh + ros2 run gazebo_ros_link_attacher detach.py + ``` + +You can also spawn items with the GUI and run a rosservice call: + +```sh + ros2 service call /attach 'gazebo_ros_link_attacher/srv/Attach' '{model_name_1: 'cube1', + link_name_1: 'link', + model_name_2: 'cube2', + link_name_2: 'link'}' ```` -***** Internal Program Error - assertion (self->inertial != __null) failed in static void gazebo::physics::ODELink::MoveCallback(dBodyID): -/tmp/buildd/gazebo4-4.1.3/gazebo/physics/ode/ODELink.cc(178): Inertial pointer is NULL -Aborted (core dumped) + +And same thing to detach: + +```sh + ros2 service call /detach 'gazebo_ros_link_attacher/srv/Attach' '{model_name_1: 'cube1', + link_name_1: 'link', + model_name_2: 'cube2', + link_name_2: 'link'}' ```` -~~Which I've only seen this other useful information: [Bitbucket gazebo removing moving model with ode friction fails](https://bitbucket.org/osrf/gazebo/issues/1177/removing-moving-model-with-ode-friction). But it didn't help me solve my crash. I guess when attaching one model to the other it removes the second one to re-create it attached to the first or something like that.~~ +## Launch file + +- [test_attacher.py](launch/test_attacher.py) -~~And also this other issue: [Visualizing dynamically created joints](https://bitbucket.org/osrf/gazebo/issues/1077/visualizing-dynamically-created-joints) made me add a couple of lines more.~~ + - Start an empty world with the plugin `libgazebo_ros_link_attacher.so` loaded. Which provides the `/link_attacher_node/attach` service to specify two models and their links to be attached. -~~The method to attach the links is based on the grasp hack of the Gripper in gazebo/physics: -[Gripper.hh](https://bitbucket.org/osrf/gazebo/src/1d1e3a542af81670f43a120e1df7190592bc4c0f/gazebo/physics/Gripper.hh?at=default&fileviewer=file-view-default) -[Gripper.cc](https://bitbucket.org/osrf/gazebo/src/1d1e3a542af81670f43a120e1df7190592bc4c0f/gazebo/physics/Gripper.cc?at=default&fileviewer=file-view-default)~~ +## Bugs & Feature Requests -~~Which is to create a revolute joint on the first model (with range of motion 0) linking a link on the first model and a link on the second model.~~ +- Please report bugs and request features using the [Issue Tracker](https://github.com/Brazilian-Institute-of-Robotics/gazebo_ros_link_attacher/issues).