Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.
Merged
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,39 @@ jobs:
. /opt/ros/galactic/local_setup.sh
colcon test --event-handlers console_direct+ --packages-select gazebo_ros2_control gazebo_ros2_control_demos
colcon test-result
build_testing:
runs-on: ubuntu-latest
container:
image: osrf/ros:galactic-desktop
steps:
- uses: actions/checkout@v2
- name: Setup colcon workspace
id: configure
run: |
cd ..
mkdir -p /home/ros2_ws/src
cp -r gazebo_ros2_control /home/ros2_ws/src/
sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2-testing/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
apt-get update && apt-get upgrade -q -y
apt-get update && apt-get install -q -y --no-install-recommends \
dirmngr \
gnupg2 \
lsb-release \
python3-colcon-ros
cd /home/ros2_ws/src/
rosdep update
rosdep install --from-paths ./ -i -y --rosdistro galactic \
--ignore-src
- name: Build project
id: build
run: |
cd /home/ros2_ws/
. /opt/ros/galactic/local_setup.sh
colcon build --packages-up-to gazebo_ros2_control_demos
- name: Run tests
id: test
run: |
cd /home/ros2_ws/
. /opt/ros/galactic/local_setup.sh
colcon test --event-handlers console_direct+ --packages-select gazebo_ros2_control gazebo_ros2_control_demos
colcon test-result
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GazeboSystem : public GazeboSystemInterface
{
public:
// Documentation Inherited
hardware_interface::return_type configure(const hardware_interface::HardwareInfo & system_info)
CallbackReturn on_init(const hardware_interface::HardwareInfo & system_info)
override;

// Documentation Inherited
Expand All @@ -48,10 +48,10 @@ class GazeboSystem : public GazeboSystemInterface
std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;

// Documentation Inherited
hardware_interface::return_type start() override;
CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;

// Documentation Inherited
hardware_interface::return_type stop() override;
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;

// Documentation Inherited
hardware_interface::return_type read() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
#include "gazebo/physics/Model.hh"
#include "gazebo/physics/physics.hh"

#include "hardware_interface/base_interface.hpp"
#include "hardware_interface/system_interface.hpp"
#include "hardware_interface/types/hardware_interface_type_values.hpp"

#include "rclcpp/rclcpp.hpp"

Expand Down Expand Up @@ -60,7 +58,7 @@ class SafeEnum

// SystemInterface provides API-level access to read and command joint properties.
class GazeboSystemInterface
: public hardware_interface::BaseInterface<hardware_interface::SystemInterface>
: public hardware_interface::SystemInterface
{
public:
/// \brief Initilize the system interface
Expand Down
23 changes: 12 additions & 11 deletions gazebo_ros2_control/src/gazebo_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "gazebo/sensors/ImuSensor.hh"
#include "gazebo/sensors/ForceTorqueSensor.hh"
#include "gazebo/sensors/SensorManager.hh"

#include "hardware_interface/types/hardware_interface_type_values.hpp"

class gazebo_ros2_control::GazeboSystemPrivate
{
public:
Expand Down Expand Up @@ -346,13 +349,13 @@ void GazeboSystem::registerSensors(
}
}

hardware_interface::return_type
GazeboSystem::configure(const hardware_interface::HardwareInfo & actuator_info)
CallbackReturn
GazeboSystem::on_init(const hardware_interface::HardwareInfo & actuator_info)
{
if (configure_default(actuator_info) != hardware_interface::return_type::OK) {
return hardware_interface::return_type::ERROR;
if (hardware_interface::SystemInterface::on_init(actuator_info) != CallbackReturn::SUCCESS) {
return CallbackReturn::ERROR;
}
return hardware_interface::return_type::OK;
return CallbackReturn::SUCCESS;
}

std::vector<hardware_interface::StateInterface>
Expand All @@ -367,16 +370,14 @@ GazeboSystem::export_command_interfaces()
return std::move(this->dataPtr->command_interfaces_);
}

hardware_interface::return_type GazeboSystem::start()
CallbackReturn GazeboSystem::on_activate(const rclcpp_lifecycle::State & previous_state)
{
status_ = hardware_interface::status::STARTED;
return hardware_interface::return_type::OK;
return CallbackReturn::SUCCESS;
}

hardware_interface::return_type GazeboSystem::stop()
CallbackReturn GazeboSystem::on_deactivate(const rclcpp_lifecycle::State & previous_state)
{
status_ = hardware_interface::status::STOPPED;
return hardware_interface::return_type::OK;
return CallbackReturn::SUCCESS;
}

hardware_interface::return_type GazeboSystem::read()
Expand Down