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

WIP | ROS2 port #2

Draft
wants to merge 9 commits into
base: ros2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# C++
################################################################

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
92 changes: 48 additions & 44 deletions fetch_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,69 +1,73 @@
cmake_minimum_required(VERSION 3.7.2)
project(fetch_gazebo)

find_package(Boost REQUIRED)
find_package(gazebo REQUIRED)
find_package(ament_cmake REQUIRED)
find_package(angles REQUIRED)
find_package(control_toolbox REQUIRED)
find_package(gazebo_dev REQUIRED)
find_package(gazebo_ros REQUIRED)
find_package(robot_controllers REQUIRED)
find_package(robot_controllers_interface REQUIRED)
find_package(rclcpp REQUIRED)

find_package(catkin
REQUIRED
angles
control_toolbox
gazebo_ros
robot_controllers
robot_controllers_interface
)

include_directories(
include
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIR}
${GAZEBO_INCLUDE_DIRS}
)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

include_directories(include)
link_directories(
${GAZEBO_LIBRARY_DIRS}
${gazebo_dev_LIBRARY_DIRS}
)

catkin_package(
CATKIN_DEPENDS
control_toolbox
gazebo_plugins
gazebo_ros
robot_controllers
robot_controllers_interface
LIBRARIES
fetch_gazebo_plugin
INCLUDE_DIRS
include
# Libraries
add_library(fetch_gazebo_plugin SHARED
src/plugin.cpp
)

add_library(fetch_gazebo_plugin src/plugin.cpp)
target_link_libraries(fetch_gazebo_plugin
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
ament_target_dependencies(fetch_gazebo_plugin
angles
control_toolbox
gazebo_ros
robot_controllers
robot_controllers_interface
rclcpp
)

## Install
install(
TARGETS fetch_gazebo_plugin
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

ament_export_include_directories(
include
)

ament_export_dependencies(ament_cmake)
ament_export_dependencies(rclcpp)

install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
DESTINATION include/${PROJECT_NAME}
)

install(
PROGRAMS
scripts/prepare_simulated_robot.py
scripts/prepare_simulated_robot_pick_place.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
"scripts/prepare_simulated_robot.py"
"scripts/prepare_simulated_robot_pick_place.py"
DESTINATION bin
)

install(
DIRECTORY config include launch robots worlds models
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
DIRECTORY config launch robots worlds models
DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_package()
Empty file added fetch_gazebo/COLCON_IGNORE
Empty file.
22 changes: 13 additions & 9 deletions fetch_gazebo/package.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<package format="2">
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>fetch_gazebo</name>
<version>0.9.2</version>
<description>
Expand All @@ -15,29 +15,33 @@
<license>BSD</license>
<url>http://ros.org/wiki/fetch_gazebo</url>

<buildtool_depend>catkin</buildtool_depend>
<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>angles</build_depend>
<build_depend>gazebo_dev</build_depend>

<depend>control_toolbox</depend>
<depend>boost</depend>
<depend>gazebo_plugins</depend>
<depend>gazebo_ros</depend>
<depend>rclcpp</depend>
<depend>robot_controllers</depend>
<depend>robot_controllers_interface</depend>
<depend>sensor_msgs</depend>

<exec_depend>actionlib</exec_depend>
<!-- <exec_depend>actionlib</exec_depend> -->
<exec_depend>control_msgs</exec_depend>
<exec_depend>depth_image_proc</exec_depend>
<exec_depend>fetch_description</exec_depend>
<exec_depend>gazebo</exec_depend>
<exec_depend>gazebo_plugins</exec_depend>
<exec_depend>image_proc</exec_depend>
<exec_depend>nodelet</exec_depend>
<exec_depend>rgbd_launch</exec_depend>
<!-- <exec_depend>nodelet</exec_depend> -->
<!-- <exec_depend>rgbd_launch</exec_depend> -->
<exec_depend>trajectory_msgs</exec_depend>
<exec_depend>xacro</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>topic_tools</exec_depend>
<!-- <exec_depend>topic_tools</exec_depend> -->

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
6 changes: 3 additions & 3 deletions fetch_gazebo/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
// Author: Michael Ferguson

#include <ros/ros.h>
#include <sensor_msgs/JointState.h>
#include "sensor_msgs/msg/joint_state.hpp"
#include <robot_controllers_interface/controller_manager.h>
#include <fetch_gazebo/joint_handle.h>
#include <gazebo/common/common.hh>
Expand Down Expand Up @@ -123,7 +123,7 @@ void FetchGazeboPlugin::Init()
controller_manager_.init(pnh);

// Publish joint states only after controllers are fully ready
joint_state_pub_ = nh_.advertise<sensor_msgs::JointState>("joint_states", 10);
joint_state_pub_ = nh_.advertise<sensor_msgs::msg::JointState>("joint_states", 10);

ROS_INFO("Finished initializing FetchGazeboPlugin");
}
Expand Down Expand Up @@ -153,7 +153,7 @@ void FetchGazeboPlugin::OnUpdate(
return;

// Publish joint_state message
sensor_msgs::JointState js;
sensor_msgs::msg::JointState js;
js.header.stamp = ros::Time(currTime.Double());
for (size_t i = 0; i < joints_.size(); ++i)
{
Expand Down
Empty file added fetch_gazebo_demo/COLCON_IGNORE
Empty file.
Empty file added fetch_simulation/COLCON_IGNORE
Empty file.
Empty file added fetchit_challenge/COLCON_IGNORE
Empty file.