Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename packages with prefix xcub #31

Merged
merged 5 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ source install/setup.bash

### Install as a single CMake project

If you want to build this repository as a single CMake project, you can use the `CMakeLists.txt` provided in `xcub_moveit2_all_packages`:
If you want to build this repository as a single CMake project, you can use the `CMakeLists.txt` provided in `xcub_moveit_all_packages`:
traversaro marked this conversation as resolved.
Show resolved Hide resolved

~~~shell
git clone https://github.com/icub-tech-iit/xcub-moveit2/
cd xcub-moveit2/xcub_moveit2_all_packages
cd xcub-moveit2/xcub_moveit_all_packages
cmake -Bbuild -S. -DCMAKE_INSTALL_PREFIX=<install_prefix>
cmake --build build
cmake --install build
Expand Down Expand Up @@ -123,15 +123,15 @@ However, if you want to work in simulation instead of on the real hardware, you

This section aims to give a brief description of what each package contains.

### robot_controller
### xcub_ros2_controllers

This package contains `robot_controller` plugin that is used in [ros2_control](https://control.ros.org/master/index.html) framework. It includes:
This package contains `xcub_ros2_controllers` plugin that is used in [ros2_control](https://control.ros.org/master/index.html) framework. It includes:

- a `position state interface` used to read the position of each joint;
- a `velocity state interface` used to read the velocity of each joint;
- a `position command interface` used to forward the desired position to the joints.

### robot_moveit
### xcub_moveit_robot

This package contains some launch files, depending on the nodes you want to run.

Expand All @@ -140,26 +140,31 @@ This package contains some launch files, depending on the nodes you want to run.
- **`robot_controls.launch.py`**: this launch file allows to run the `controller manager` node for ros2_control and the nodes for the single controllers (one for each part).
- **`circle_demo.launch.py`** and **`grasp_demo.launch.py`**: as the name suggests, they are two examples of commanding the robot in the cartesian space using `torso + right_arm` as planning group.


Before running the nodes, make sure that your environment variable `YARP_ROBOT_NAME` is properly set with the name of your robot. If not, set it for each shell according to the chosen model, for example:

```shell
export YARP_ROBOT_NAME="icub"
export YARP_ROBOT_NAME="iCubGenova11"
```

or, for simulated models:

```shell
export YARP_ROBOT_NAME="iCubGazeboV2_5"
```

### icub_moveit_config
### xcub_icub_moveit_config
Nicogene marked this conversation as resolved.
Show resolved Hide resolved

This package contains the configuration files to make iCub working with MoveIt2. In particular, each of the parts of iCub robot (head, left_arm, right_arm, torso, left_leg and right_leg) are defined in terms of `planning group`, and for each of them a ros2_control of type `FollowJointTrajectory` is set.

### ergocub_moveit_config
### xcub_ergocub_moveit_config
Nicogene marked this conversation as resolved.
Show resolved Hide resolved

It contains the same information described in the previous paragraph, but customized with ergoCub specs.

### test_controller
### xcub_moveit_test_controller

In this folder, a test to sample the reaching space is available. It can be run as a ros2 node with the provided launch file called `test_controller.launch.py`. For this purpose, you can find more info in the [Use case](#use-case) paragraph above.

Moreover, a detailed report about the controller performance can be found [here](https://github.com/icub-tech-iit/xcub-moveit2/blob/master/test_controller/README.md#test-on-the-controller-performance) 📝.
Moreover, a detailed report about the controller performance can be found [here](https://github.com/icub-tech-iit/xcub-moveit2/blob/master/xcub_test_controller/README.md#test-on-the-controller-performance) 📝.

## Use case

Expand All @@ -175,10 +180,10 @@ colcon build
source install/setup.bash

# Remember to check if your robot name variable is set. If not:
export YARP_ROBOT_NAME="icub"
export YARP_ROBOT_NAME="iCubGazeboV2_5"

# Launch the start-up nodes
ros2 launch robot_moveit robot_sim.launch.py
ros2 launch xcub_moveit_robot robot_sim.launch.py
```

In this way, both rviz2 and gazebo windows are opened with the iCub model spawned in the two environments. At this point, open another shell, build and source the enviroment and then launch the ros2_control nodes:
Expand All @@ -188,10 +193,10 @@ cd ~/<ros2_ws>
source /opt/ros/humble/setup.bash
colcon build
source install/setup.bash
export YARP_ROBOT_NAME="icub"
export YARP_ROBOT_NAME="iCubGazeboV2_5"

# Launch the ros2_control nodes
ros2 launch robot_moveit robot_controls.launch.py
ros2 launch xcub_moveit_robot robot_controls.launch.py
```

To verify that everthing has been done successfully, you can run in a separate shell:
Expand All @@ -208,16 +213,16 @@ cd ~/<ros2_ws>
source /opt/ros/humble/setup.bash
colcon build
source install/setup.bash
export YARP_ROBOT_NAME="icub"
export YARP_ROBOT_NAME="iCubGazeboV2_5"

# For the grasping demo
ros2 launch robot_moveit grasp_demo.launch.py
ros2 launch xcub_moveit_robot grasp_demo.launch.py
```

If you want to see iCub performing a circle movement, instead of the last line, you can run:

```shell
ros2 launch robot_moveit circle_demo.launch.py
ros2 launch xcub_moveit_robot circle_demo.launch.py
```

and follow the instructions on the third shell you opened.
Expand All @@ -228,10 +233,10 @@ You should have something like this:

### Controller performance

If you want to test the ros2_control `robot_controller` performance, you can rely to the `test_controller` package. It contains a simple script to sample the reaching space in front of iCub model. To run the simulation, please follow the first two steps described in the [Run the demos](#run-the-demos) section. After that, open another shell, source your workspace and then launch:
If you want to test the ros2_control `xcub_ros2_controllers` performance, you can rely to the `xcub_moveit_test_controller` package. It contains a simple script to sample the reaching space in front of iCub model. To run the simulation, please follow the first two steps described in the [Run the demos](#run-the-demos) section. After that, open another shell, source your workspace and then launch:

```shell
ros2 launch test_controller test_controller.launch.py
ros2 launch xcub_moveit_test_controller test_controller.launch.py
```

In this way, the test will start and the acquired data in terms of ideal and real poses are saved in two separated files in your current directory. Finally, you can plot them using the Matlab scripts provided in the `utils` folder.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.22)
project(icub_moveit_config)
project(xcub_ergocub_moveit_config)

find_package(ament_cmake REQUIRED)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_demo_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_move_group_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_moveit_rviz_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_rsp_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_setup_assistant_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_spawn_controllers_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_static_virtual_joint_tfs_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("ergocub", package_name="ergocub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("ergocub", package_name="xcub_ergocub_moveit_config").to_moveit_configs()
return generate_warehouse_db_launch(moveit_config)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>ergocub_moveit_config</name>
<name>xcub_ergocub_moveit_config</name>
<version>0.3.0</version>
<description>
A ROS2 package with the configuration and launch files for using the ergoCub with the MoveIt Motion Planning Framework
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.22)
project(ergocub_moveit_config)
project(xcub_icub_moveit_config)

find_package(ament_cmake REQUIRED)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_demo_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_move_group_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_moveit_rviz_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_rsp_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_setup_assistant_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_spawn_controllers_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_static_virtual_joint_tfs_launch(moveit_config)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


def generate_launch_description():
moveit_config = MoveItConfigsBuilder("icub", package_name="icub_moveit_config").to_moveit_configs()
moveit_config = MoveItConfigsBuilder("icub", package_name="xcub_icub_moveit_config").to_moveit_configs()
return generate_warehouse_db_launch(moveit_config)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>icub_moveit_config</name>
<name>xcub_icub_moveit_config</name>
<version>0.3.0</version>
<description>
An automatically generated package with all the configuration and launch files for using the iCub with the MoveIt Motion Planning Framework
Expand Down
17 changes: 0 additions & 17 deletions xcub_moveit2_all_packages/CMakeLists.txt

This file was deleted.

17 changes: 17 additions & 0 deletions xcub_moveit_all_packages/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.22)
project(xcub-moveit2)

# This file is used to easily build the whole xcub-moveit2 repo
# as a single CMake project. To avoid interfering with the existing
# colcon workflows, this CMakeLists.txt is contained in a subfolder
# of the repo called all_packages, that contains a COLCON_IGNORE
# so that it will be excluded automatically by the colcon build command

# The order of inclusion was taken from colcon graph output
add_subdirectory(../xcub_ergocub_moveit_config ${CMAKE_CURRENT_BINARY_DIR}/xcub_ergocub_moveit_config)
add_subdirectory(../xcub_moveit_grasp ${CMAKE_CURRENT_BINARY_DIR}/xcub_moveit_grasp)
add_subdirectory(../xcub_icub_moveit_config ${CMAKE_CURRENT_BINARY_DIR}/xcub_icub_moveit_config)
add_subdirectory(../xcub_ros2_controllers ${CMAKE_CURRENT_BINARY_DIR}/xcub_ros2_controllers)
add_subdirectory(../xcub_moveit_robot ${CMAKE_CURRENT_BINARY_DIR}/xcub_moveit_robot)
add_subdirectory(../xcub_moveit_test_controller ${CMAKE_CURRENT_BINARY_DIR}/xcub_moveit_test_controller)

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(grasp_moveit)
project(xcub_moveit_grasp)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand Down
2 changes: 1 addition & 1 deletion grasp_moveit/package.xml → xcub_moveit_grasp/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>grasp_moveit</name>
<name>xcub_moveit_grasp</name>
<version>0.0.0</version>
<description>ROS2 package for grasping task</description>
<maintainer email="[email protected]">Martina Gloria</maintainer>
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions robot_moveit/CMakeLists.txt → xcub_moveit_robot/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(robot_moveit)
project(xcub_moveit_robot)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand All @@ -18,13 +18,13 @@ find_package(hardware_interface REQUIRED)
find_package(yarp_control_msgs REQUIRED)
find_package(YARP REQUIRED)

add_executable(robot_moveit src/robot_moveit.cpp launch/spawn_model.py)
target_include_directories(robot_moveit PUBLIC
add_executable(xcub_moveit_robot src/robot_moveit.cpp launch/spawn_model.py)
target_include_directories(xcub_moveit_robot PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(robot_moveit PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
target_compile_features(xcub_moveit_robot PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
ament_target_dependencies(
robot_moveit
xcub_moveit_robot
"moveit_ros_planning_interface"
"rclcpp"
"rclpy"
Expand All @@ -38,7 +38,7 @@ ament_target_dependencies(
target_sources(${PROJECT_NAME} PRIVATE src/robot_moveit.cpp)
target_link_libraries(${PROJECT_NAME} ${YARP_LIBRARIES})

install(TARGETS robot_moveit DESTINATION lib/${PROJECT_NAME})
install(TARGETS xcub_moveit_robot DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
install(PROGRAMS launch/spawn_model.py DESTINATION lib/${PROJECT_NAME})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ def generate_launch_description():

robot_name = check_robot_name()

moveit_config = MoveItConfigsBuilder(robot_name).to_moveit_configs()
moveit_config = MoveItConfigsBuilder("xcub_"+robot_name).to_moveit_configs()

circle_demo = Node(
name="robot_moveit",
package="robot_moveit",
executable="robot_moveit",
name="xcub_moveit_robot",
package="xcub_moveit_robot",
executable="xcub_moveit_robot",
output="screen",
parameters=[
moveit_config.robot_description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ def generate_launch_description():

robot_name = check_robot_name()

moveit_config = MoveItConfigsBuilder(robot_name).to_moveit_configs()
moveit_config = MoveItConfigsBuilder("xcub_"+robot_name).to_moveit_configs()

grasping_demo = Node(
name="grasping",
package="grasp_moveit",
executable="grasp_moveit",
package="xcub_moveit_grasp",
executable="xcub_moveit_grasp",
output="screen",
parameters=[
moveit_config.robot_description,
Expand Down
Loading
Loading