From cf803911309bd9919c752e670e8cfc96e6fed290 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 29 Feb 2024 19:35:40 +0000 Subject: [PATCH 1/5] Updated demos 1, 10, 11, 12, 14 --- example_1/bringup/launch/rrbot.launch.py | 2 +- example_10/bringup/launch/rrbot.launch.py | 2 +- example_11/bringup/launch/carlikebot.launch.py | 5 ----- example_12/bringup/launch/rrbot.launch.py | 2 +- ..._without_feedback_sensors_for_position_feedback.launch.py | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/example_1/bringup/launch/rrbot.launch.py b/example_1/bringup/launch/rrbot.launch.py index e25a132ab..0de1813d1 100644 --- a/example_1/bringup/launch/rrbot.launch.py +++ b/example_1/bringup/launch/rrbot.launch.py @@ -67,7 +67,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_10/bringup/launch/rrbot.launch.py b/example_10/bringup/launch/rrbot.launch.py index 9326d4690..7e975d565 100644 --- a/example_10/bringup/launch/rrbot.launch.py +++ b/example_10/bringup/launch/rrbot.launch.py @@ -50,7 +50,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_11/bringup/launch/carlikebot.launch.py b/example_11/bringup/launch/carlikebot.launch.py index a15ea1256..1ada54ad1 100644 --- a/example_11/bringup/launch/carlikebot.launch.py +++ b/example_11/bringup/launch/carlikebot.launch.py @@ -78,7 +78,6 @@ def generate_launch_description(): parameters=[robot_controllers], output="both", remappings=[ - ("~/robot_description", "/robot_description"), ("/bicycle_steering_controller/tf_odometry", "/tf"), ], condition=IfCondition(remap_odometry_tf), @@ -89,7 +88,6 @@ def generate_launch_description(): parameters=[robot_controllers], output="both", remappings=[ - ("~/robot_description", "/robot_description"), ], condition=UnlessCondition(remap_odometry_tf), ) @@ -98,9 +96,6 @@ def generate_launch_description(): executable="robot_state_publisher", output="both", parameters=[robot_description], - remappings=[ - ("~/robot_description", "/robot_description"), - ], ) rviz_node = Node( package="rviz2", diff --git a/example_12/bringup/launch/rrbot.launch.py b/example_12/bringup/launch/rrbot.launch.py index 07b4a486b..b89c521ed 100644 --- a/example_12/bringup/launch/rrbot.launch.py +++ b/example_12/bringup/launch/rrbot.launch.py @@ -53,7 +53,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_14/bringup/launch/rrbot_modular_actuators_without_feedback_sensors_for_position_feedback.launch.py b/example_14/bringup/launch/rrbot_modular_actuators_without_feedback_sensors_for_position_feedback.launch.py index f988a5c70..6c263c12d 100644 --- a/example_14/bringup/launch/rrbot_modular_actuators_without_feedback_sensors_for_position_feedback.launch.py +++ b/example_14/bringup/launch/rrbot_modular_actuators_without_feedback_sensors_for_position_feedback.launch.py @@ -96,7 +96,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( From 798f77c7a5b4f7358e53ff23e92f20545763096a Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Sat, 2 Mar 2024 20:15:53 +0000 Subject: [PATCH 2/5] Example 14: Check for NaN in write method Since activation of the "hardware" takes some time, the resource manager might try to write the initial NaN value to the hardware. This commit adds a check to the write method for that. --- .../rrbot_actuator_without_feedback.cpp | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/example_14/hardware/rrbot_actuator_without_feedback.cpp b/example_14/hardware/rrbot_actuator_without_feedback.cpp index 3c7a6b887..f45344a94 100644 --- a/example_14/hardware/rrbot_actuator_without_feedback.cpp +++ b/example_14/hardware/rrbot_actuator_without_feedback.cpp @@ -183,21 +183,23 @@ hardware_interface::return_type RRBotActuatorWithoutFeedback::read( hardware_interface::return_type ros2_control_demo_example_14::RRBotActuatorWithoutFeedback::write( const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/) { - // START: This part here is for exemplary purposes - Please do not copy to your production code - RCLCPP_INFO( - rclcpp::get_logger("RRBotActuatorWithoutFeedback"), "Writing command: %f", hw_joint_command_); - - // Simulate sending commands to the hardware - std::ostringstream data; - data << hw_joint_command_; - RCLCPP_INFO( - rclcpp::get_logger("RRBotActuatorWithoutFeedback"), "Sending data command: %s", - data.str().c_str()); - send(sock_, data.str().c_str(), strlen(data.str().c_str()), 0); + if (!std::isnan(hw_joint_command_)) + { + // START: This part here is for exemplary purposes - Please do not copy to your production code + RCLCPP_INFO( + rclcpp::get_logger("RRBotActuatorWithoutFeedback"), "Writing command: %f", hw_joint_command_); - RCLCPP_INFO(rclcpp::get_logger("RRBotActuatorWithoutFeedback"), "Joints successfully written!"); - // END: This part here is for exemplary purposes - Please do not copy to your production code + // Simulate sending commands to the hardware + std::ostringstream data; + data << hw_joint_command_; + RCLCPP_INFO( + rclcpp::get_logger("RRBotActuatorWithoutFeedback"), "Sending data command: %s", + data.str().c_str()); + send(sock_, data.str().c_str(), strlen(data.str().c_str()), 0); + RCLCPP_INFO(rclcpp::get_logger("RRBotActuatorWithoutFeedback"), "Joints successfully written!"); + // END: This part here is for exemplary purposes - Please do not copy to your production code + } return hardware_interface::return_type::OK; } From 20c5d732ab79a2f4eaa4b5bd8975a8bd090bb776 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Sat, 2 Mar 2024 22:48:56 +0000 Subject: [PATCH 3/5] Fix formatting --- example_11/bringup/launch/carlikebot.launch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/example_11/bringup/launch/carlikebot.launch.py b/example_11/bringup/launch/carlikebot.launch.py index 1ada54ad1..4a7adce19 100644 --- a/example_11/bringup/launch/carlikebot.launch.py +++ b/example_11/bringup/launch/carlikebot.launch.py @@ -87,8 +87,7 @@ def generate_launch_description(): executable="ros2_control_node", parameters=[robot_controllers], output="both", - remappings=[ - ], + remappings=[], condition=UnlessCondition(remap_odometry_tf), ) robot_state_pub_bicycle_node = Node( From a55a1a2d2fb05199b51671349c28de2547158d69 Mon Sep 17 00:00:00 2001 From: "Felix Exner (fexner)" Date: Sat, 2 Mar 2024 23:58:25 +0100 Subject: [PATCH 4/5] Update example_14/hardware/rrbot_actuator_without_feedback.cpp Co-authored-by: Sai Kishor Kothakota --- example_14/hardware/rrbot_actuator_without_feedback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_14/hardware/rrbot_actuator_without_feedback.cpp b/example_14/hardware/rrbot_actuator_without_feedback.cpp index f45344a94..6feb8067c 100644 --- a/example_14/hardware/rrbot_actuator_without_feedback.cpp +++ b/example_14/hardware/rrbot_actuator_without_feedback.cpp @@ -183,7 +183,7 @@ hardware_interface::return_type RRBotActuatorWithoutFeedback::read( hardware_interface::return_type ros2_control_demo_example_14::RRBotActuatorWithoutFeedback::write( const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/) { - if (!std::isnan(hw_joint_command_)) + if (std::isfinite(hw_joint_command_)) { // START: This part here is for exemplary purposes - Please do not copy to your production code RCLCPP_INFO( From e68ae942ff2014df03722c6c695c5d07e97fb843 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Sat, 2 Mar 2024 23:23:57 +0000 Subject: [PATCH 5/5] Updated missing demos --- example_2/bringup/launch/diffbot.launch.py | 2 +- example_3/bringup/launch/rrbot_system_multi_interface.launch.py | 2 +- example_4/bringup/launch/rrbot_system_with_sensor.launch.py | 2 +- .../bringup/launch/rrbot_system_with_external_sensor.launch.py | 2 +- example_6/bringup/launch/rrbot_modular_actuators.launch.py | 2 +- example_7/bringup/launch/r6bot_controller.launch.py | 2 +- .../launch/rrbot_transmissions_system_position_only.launch.py | 2 +- example_9/bringup/launch/rrbot.launch.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example_2/bringup/launch/diffbot.launch.py b/example_2/bringup/launch/diffbot.launch.py index 7a71af0b8..04b454a0f 100644 --- a/example_2/bringup/launch/diffbot.launch.py +++ b/example_2/bringup/launch/diffbot.launch.py @@ -73,7 +73,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_3/bringup/launch/rrbot_system_multi_interface.launch.py b/example_3/bringup/launch/rrbot_system_multi_interface.launch.py index e10c7997e..969cf745f 100644 --- a/example_3/bringup/launch/rrbot_system_multi_interface.launch.py +++ b/example_3/bringup/launch/rrbot_system_multi_interface.launch.py @@ -119,7 +119,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_4/bringup/launch/rrbot_system_with_sensor.launch.py b/example_4/bringup/launch/rrbot_system_with_sensor.launch.py index b95039147..857d5963e 100644 --- a/example_4/bringup/launch/rrbot_system_with_sensor.launch.py +++ b/example_4/bringup/launch/rrbot_system_with_sensor.launch.py @@ -111,7 +111,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_5/bringup/launch/rrbot_system_with_external_sensor.launch.py b/example_5/bringup/launch/rrbot_system_with_external_sensor.launch.py index 229195642..675499902 100755 --- a/example_5/bringup/launch/rrbot_system_with_external_sensor.launch.py +++ b/example_5/bringup/launch/rrbot_system_with_external_sensor.launch.py @@ -111,7 +111,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_6/bringup/launch/rrbot_modular_actuators.launch.py b/example_6/bringup/launch/rrbot_modular_actuators.launch.py index 24821fd70..8c097d899 100644 --- a/example_6/bringup/launch/rrbot_modular_actuators.launch.py +++ b/example_6/bringup/launch/rrbot_modular_actuators.launch.py @@ -119,7 +119,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_7/bringup/launch/r6bot_controller.launch.py b/example_7/bringup/launch/r6bot_controller.launch.py index bc3e048ba..135c69453 100644 --- a/example_7/bringup/launch/r6bot_controller.launch.py +++ b/example_7/bringup/launch/r6bot_controller.launch.py @@ -52,7 +52,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], remappings=[ ( "/forward_position_controller/commands", diff --git a/example_8/bringup/launch/rrbot_transmissions_system_position_only.launch.py b/example_8/bringup/launch/rrbot_transmissions_system_position_only.launch.py index f42999770..4476a3f35 100644 --- a/example_8/bringup/launch/rrbot_transmissions_system_position_only.launch.py +++ b/example_8/bringup/launch/rrbot_transmissions_system_position_only.launch.py @@ -96,7 +96,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node( diff --git a/example_9/bringup/launch/rrbot.launch.py b/example_9/bringup/launch/rrbot.launch.py index 2a61c1cee..fbc54bcc0 100644 --- a/example_9/bringup/launch/rrbot.launch.py +++ b/example_9/bringup/launch/rrbot.launch.py @@ -68,7 +68,7 @@ def generate_launch_description(): control_node = Node( package="controller_manager", executable="ros2_control_node", - parameters=[robot_description, robot_controllers], + parameters=[robot_controllers], output="both", ) robot_state_pub_node = Node(