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

Enable throttling for demos 6 and 14 #603

Draft
wants to merge 2 commits into
base: master
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
controller_manager:
ros__parameters:
update_rate: 10 # Hz
update_rate: 100 # Hz

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
Expand Down
8 changes: 4 additions & 4 deletions example_14/doc/userdoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ Tutorial steps
[ros2_control_node-1] Writing command: 5.00
[ros2_control_node-1] Sending data command: 5
[ros2_control_node-1]
[ros2_control_node-1] [INFO] [1728858168.775863217] [controller_manager.resource_manager.hardware_component.sensor.RRBotModularPositionSensorJoint2]: Reading...
[ros2_control_node-1] Got measured velocity 5.00
[ros2_control_node-1] Got state 0.29 for joint 'joint2'
[ros2_control_node-1]
[ros2_control_node-1] [INFO] [1728858168.776052116] [controller_manager.resource_manager.hardware_component.actuator.RRBotModularJoint2]: Writing...
[ros2_control_node-1] Writing command: 5.00
[ros2_control_node-1] Sending data command: 5
Expand All @@ -136,10 +140,6 @@ Tutorial steps
[ros2_control_node-1] Got measured velocity 5.00
[ros2_control_node-1] Got state 0.34 for joint 'joint1'
[ros2_control_node-1]
[ros2_control_node-1] [INFO] [1728858169.775863217] [controller_manager.resource_manager.hardware_component.sensor.RRBotModularPositionSensorJoint2]: Reading...
[ros2_control_node-1] Got measured velocity 5.00
[ros2_control_node-1] Got state 0.29 for joint 'joint2'
[ros2_control_node-1]


Files used for this demos
Expand Down
2 changes: 1 addition & 1 deletion example_14/hardware/rrbot_actuator_without_feedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ hardware_interface::return_type ros2_control_demo_example_14::RRBotActuatorWitho
std::ostringstream data;
data << hw_joint_command_;
ss << "Sending data command: " << data.str() << std::endl;
RCLCPP_INFO(get_logger(), ss.str().c_str());
RCLCPP_INFO_THROTTLE(get_logger(), *get_clock(), 500, ss.str().c_str());

// Simulate sending commands to the hardware
send(sock_, data.str().c_str(), strlen(data.str().c_str()), 0);
Expand Down
2 changes: 1 addition & 1 deletion example_14/hardware/rrbot_sensor_for_position_feedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ hardware_interface::return_type RRBotSensorPositionFeedback::read(
ss << "Got measured velocity " << measured_velocity << std::endl;
ss << "Got state " << hw_joint_state_ << " for joint '" << info_.joints[0].name << "'"
<< std::endl;
RCLCPP_INFO(get_logger(), ss.str().c_str());
RCLCPP_INFO_THROTTLE(get_logger(), *get_clock(), 500, ss.str().c_str());
// END: This part here is for exemplary purposes - Please do not copy to your production code

return hardware_interface::return_type::OK;
Expand Down
2 changes: 1 addition & 1 deletion example_6/bringup/config/rrbot_modular_actuators.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
controller_manager:
ros__parameters:
update_rate: 10 # Hz
update_rate: 100 # Hz

joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
Expand Down
4 changes: 2 additions & 2 deletions example_6/hardware/rrbot_actuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ hardware_interface::return_type RRBotModularJoint::read(
ss << std::fixed << std::setprecision(2) << std::endl
<< "\t" << hw_joint_state_ << " for joint '" << info_.joints[0].name.c_str() << "'";

RCLCPP_INFO(get_logger(), "%s", ss.str().c_str());
RCLCPP_INFO_THROTTLE(get_logger(), *get_clock(), 500, "%s", ss.str().c_str());
// END: This part here is for exemplary purposes - Please do not copy to your production code

return hardware_interface::return_type::OK;
Expand All @@ -181,7 +181,7 @@ hardware_interface::return_type ros2_control_demo_example_6::RRBotModularJoint::
ss << std::fixed << std::setprecision(2) << std::endl
<< "\t" << hw_joint_command_ << " for joint '" << info_.joints[0].name.c_str() << "'";

RCLCPP_INFO(get_logger(), "%s", ss.str().c_str());
RCLCPP_INFO_THROTTLE(get_logger(), *get_clock(), 500, "%s", ss.str().c_str());
// END: This part here is for exemplary purposes - Please do not copy to your production code

return hardware_interface::return_type::OK;
Expand Down
Loading