Skip to content

Commit

Permalink
Port motion control handles and simulation to Iron
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanscherzinger committed Sep 21, 2023
1 parent 02fc845 commit 0c84c9c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MotionControlHandle : public controller_interface::ControllerInterface
MotionControlHandle();
~MotionControlHandle();

#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
virtual LifecycleNodeInterface::CallbackReturn on_init() override;
#elif defined CARTESIAN_CONTROLLERS_FOXY
virtual controller_interface::return_type init(const std::string & controller_name) override;
Expand All @@ -93,7 +93,7 @@ class MotionControlHandle : public controller_interface::ControllerInterface
controller_interface::InterfaceConfiguration command_interface_configuration() const override;
controller_interface::InterfaceConfiguration state_interface_configuration() const override;

#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
controller_interface::return_type update(const rclcpp::Time & time, const rclcpp::Duration & period) override;
#elif defined CARTESIAN_CONTROLLERS_FOXY
controller_interface::return_type update() override;
Expand Down
6 changes: 3 additions & 3 deletions cartesian_controller_handles/src/motion_control_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ MotionControlHandle::on_deactivate(const rclcpp_lifecycle::State& previous_state
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS;
}

#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
controller_interface::return_type MotionControlHandle::update(const rclcpp::Time& time,
const rclcpp::Duration& period)
#elif defined CARTESIAN_CONTROLLERS_FOXY
Expand Down Expand Up @@ -121,7 +121,7 @@ MotionControlHandle::state_interface_configuration() const
}


#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
MotionControlHandle::on_init()
{
Expand All @@ -141,7 +141,7 @@ controller_interface::return_type MotionControlHandle::init(const std::string& c
auto_declare<std::string>("end_effector_link", "");
auto_declare<std::vector<std::string> >("joints", std::vector<std::string>());

#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS;
#elif defined CARTESIAN_CONTROLLERS_FOXY
return controller_interface::return_type::OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ constexpr char HW_IF_DAMPING[] = "damping";
* controller_manager coordinated library.
*
*/
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
class Simulator : public hardware_interface::SystemInterface
#elif defined CARTESIAN_CONTROLLERS_FOXY
class Simulator : public hardware_interface::BaseInterface<hardware_interface::SystemInterface>
Expand All @@ -83,7 +83,7 @@ class Simulator : public hardware_interface::BaseInterface<hardware_interface::S

RCLCPP_SHARED_PTR_DEFINITIONS(Simulator)

#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
CallbackReturn on_init(const hardware_interface::HardwareInfo& info) override;
#elif defined CARTESIAN_CONTROLLERS_FOXY
return_type configure(const hardware_interface::HardwareInfo& info) override;
Expand All @@ -97,7 +97,7 @@ class Simulator : public hardware_interface::BaseInterface<hardware_interface::S
const std::vector<std::string>& stop_interfaces) override;


#if defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
return_type read(const rclcpp::Time& time, const rclcpp::Duration& period) override;
return_type write(const rclcpp::Time& time, const rclcpp::Duration& period) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

import os
distro = os.environ['ROS_DISTRO']
if distro == 'humble' or distro == 'galactic':
if distro == 'iron' or distro == 'humble' or distro == 'galactic':
spawner = "spawner"
else: # foxy
spawner = "spawner.py"
Expand Down
16 changes: 8 additions & 8 deletions cartesian_controller_simulation/src/system_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

namespace cartesian_controller_simulation {

#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
Simulator::CallbackReturn Simulator::on_init(const hardware_interface::HardwareInfo& info)
{
// Keep an internal copy of the given configuration
Expand Down Expand Up @@ -105,7 +105,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn
RCLCPP_ERROR(rclcpp::get_logger("Simulator"),
"Joint '%s' needs two possible command interfaces.",
joint.name.c_str());
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
return Simulator::CallbackReturn::ERROR;
#elif defined CARTESIAN_CONTROLLERS_FOXY
return Simulator::return_type::ERROR;
Expand All @@ -120,7 +120,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn
joint.name.c_str(),
hardware_interface::HW_IF_POSITION,
hardware_interface::HW_IF_VELOCITY);
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
return Simulator::CallbackReturn::ERROR;
#elif defined CARTESIAN_CONTROLLERS_FOXY
return Simulator::return_type::ERROR;
Expand All @@ -132,7 +132,7 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn
RCLCPP_ERROR(rclcpp::get_logger("Simulator"),
"Joint '%s' needs 3 state interfaces.",
joint.name.c_str());
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
return Simulator::CallbackReturn::ERROR;
#elif defined CARTESIAN_CONTROLLERS_FOXY
return Simulator::return_type::ERROR;
Expand All @@ -149,15 +149,15 @@ Simulator::return_type Simulator::configure(const hardware_interface::HardwareIn
hardware_interface::HW_IF_POSITION,
hardware_interface::HW_IF_VELOCITY,
hardware_interface::HW_IF_EFFORT);
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
return Simulator::CallbackReturn::ERROR;
#elif defined CARTESIAN_CONTROLLERS_FOXY
return Simulator::return_type::ERROR;
#endif
}
}

#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
return Simulator::CallbackReturn::SUCCESS;
#elif defined CARTESIAN_CONTROLLERS_FOXY
return Simulator::return_type::OK;
Expand Down Expand Up @@ -222,7 +222,7 @@ Simulator::return_type Simulator::stop()
#endif


#if defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
Simulator::return_type Simulator::read([[maybe_unused]] const rclcpp::Time& time,
[[maybe_unused]] const rclcpp::Duration& period)
#elif defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_FOXY
Expand All @@ -249,7 +249,7 @@ Simulator::return_type Simulator::read()
return return_type::OK;
}

#if defined CARTESIAN_CONTROLLERS_HUMBLE
#if defined CARTESIAN_CONTROLLERS_HUMBLE || defined CARTESIAN_CONTROLLERS_IRON
Simulator::return_type Simulator::write([[maybe_unused]] const rclcpp::Time& time,
[[maybe_unused]] const rclcpp::Duration& period)
#elif defined CARTESIAN_CONTROLLERS_GALACTIC || defined CARTESIAN_CONTROLLERS_FOXY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_invalid_controller_initialization(self):
controller manager contains our controllers and if they have the
expected state.
"""
if os.environ['ROS_DISTRO'] == 'humble':
if os.environ['ROS_DISTRO'] == 'humble' or os.environ['ROS_DISTRO'] == 'iron':
expected_state = 'unconfigured'
else: # galactic, foxy
expected_state = 'finalized'
Expand Down

0 comments on commit 0c84c9c

Please sign in to comment.