diff --git a/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in b/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in index eae574b8..cf2a8220 100644 --- a/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in +++ b/cartesian_controller_base/include/cartesian_controller_base/ROS2VersionConfig.h.in @@ -1,7 +1,7 @@ // Cmake will update these defines depending on our current ROS_DISTRO. // We use this mechanism to react to API changes in ROS2-control. // -#cmakedefine CARTESIAN_CONTROLLERS_FOXY -#cmakedefine CARTESIAN_CONTROLLERS_GALACTIC + #cmakedefine CARTESIAN_CONTROLLERS_HUMBLE #cmakedefine CARTESIAN_CONTROLLERS_IRON +#cmakedefine CARTESIAN_CONTROLLERS_JAZZY diff --git a/cartesian_controller_base/src/cartesian_controller_base.cpp b/cartesian_controller_base/src/cartesian_controller_base.cpp index 0948584b..528bf3a4 100644 --- a/cartesian_controller_base/src/cartesian_controller_base.cpp +++ b/cartesian_controller_base/src/cartesian_controller_base.cpp @@ -131,7 +131,12 @@ CartesianControllerBase::on_configure(const rclcpp_lifecycle::State & previous_s urdf::Model robot_model; KDL::Tree robot_tree; +#if defined CARTESIAN_CONTROLLERS_JAZZY + m_robot_description = this->get_robot_description(); +#else m_robot_description = get_node()->get_parameter("robot_description").as_string(); +#endif + if (m_robot_description.empty()) { RCLCPP_ERROR(get_node()->get_logger(), "robot_description is empty"); diff --git a/cartesian_controller_simulation/launch/simulation.launch.py b/cartesian_controller_simulation/launch/simulation.launch.py index 479a02d7..f23e6e0d 100644 --- a/cartesian_controller_simulation/launch/simulation.launch.py +++ b/cartesian_controller_simulation/launch/simulation.launch.py @@ -90,7 +90,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_controllers], + parameters=[robot_description, robot_controllers], # prefix="screen -d -m gdb -command=/home/stefan/.gdb_debug_config --ex run --args", # noqa E501 output="both", remappings=[ diff --git a/cartesian_controller_tests/integration_tests/integration_tests.py b/cartesian_controller_tests/integration_tests/integration_tests.py index 0266e99d..ad87b6ba 100755 --- a/cartesian_controller_tests/integration_tests/integration_tests.py +++ b/cartesian_controller_tests/integration_tests/integration_tests.py @@ -7,7 +7,6 @@ from launch.substitutions import PathJoinSubstitution from launch_ros.substitutions import FindPackageShare -import os import time import rclpy from rclpy.node import Node @@ -16,8 +15,6 @@ from geometry_msgs.msg import PoseStamped from geometry_msgs.msg import WrenchStamped -distro = os.environ["ROS_DISTRO"] - def generate_test_description(): setup = IncludeLaunchDescription( @@ -118,10 +115,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" or os.environ["ROS_DISTRO"] == "iron": - expected_state = "unconfigured" - else: # galactic, foxy - expected_state = "finalized" + expected_state = "unconfigured" for name in self.invalid_controllers: self.assertTrue( self.check_state(name, expected_state), @@ -215,19 +209,13 @@ def check_state(self, controller, state): def start_controller(self, controller): """Start the given controller""" req = SwitchController.Request() - if distro in ["humble", "iron"]: - req.activate_controllers = [controller] - else: - req.start_controllers = [controller] + req.activate_controllers = [controller] self.perform_switch(req) def stop_controller(self, controller): """Stop the given controller""" req = SwitchController.Request() - if distro in ["humble", "iron"]: - req.deactivate_controllers = [controller] - else: - req.stop_controllers = [controller] + req.deactivate_controllers = [controller] self.perform_switch(req) def perform_switch(self, req):