Skip to content

Integrate pal_statistics for introspecting the ros2_control_demos #654

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
5 changes: 5 additions & 0 deletions example_12/controllers/src/passthrough_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ controller_interface::CallbackReturn PassthroughController::on_configure(
reference_interfaces_.resize(
reference_interface_names_.size(), std::numeric_limits<double>::quiet_NaN());

for (size_t i = 0; i < reference_interface_names_.size(); i++)
{
REGISTER_ROS2_CONTROL_INTROSPECTION(reference_interface_names_[i], &reference_interfaces_[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't reference interfaces exported by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes yes, they are.
I added to just show how to introspect internal variables. I didn't know what else to register in this controller

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I had a look now and don't find any other more useful variables to introspect in this repository. maybe we should have a look in ros2_controllers and register more variables to pal_statistics, currently most of the controllers have their own publisher with a custom status message type. not sure what is the best way in the controllers for doing so

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes, it is better to register some variables in the controllers

}

return controller_interface::CallbackReturn::SUCCESS;
}

Expand Down
4 changes: 4 additions & 0 deletions example_12/hardware/rrbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ hardware_interface::CallbackReturn RRBotSystemPositionOnlyHardware::on_init(
}
}

REGISTER_ROS2_CONTROL_INTROSPECTION("hw_start_sec", &hw_start_sec_);
REGISTER_ROS2_CONTROL_INTROSPECTION("hw_stop_sec", &hw_stop_sec_);
REGISTER_ROS2_CONTROL_INTROSPECTION("hw_slowdown", &hw_slowdown_);

return hardware_interface::CallbackReturn::SUCCESS;
}

Expand Down
5 changes: 5 additions & 0 deletions example_4/hardware/rrbot_system_with_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ hardware_interface::CallbackReturn RRBotSystemWithSensorHardware::on_init(
}
}

REGISTER_ROS2_CONTROL_INTROSPECTION("hw_start_sec", &hw_start_sec_);
REGISTER_ROS2_CONTROL_INTROSPECTION("hw_stop_sec", &hw_stop_sec_);
REGISTER_ROS2_CONTROL_INTROSPECTION("hw_slowdown", &hw_slowdown_);
REGISTER_ROS2_CONTROL_INTROSPECTION("hw_sensor_change", &hw_sensor_change_);

return hardware_interface::CallbackReturn::SUCCESS;
}

Expand Down
Loading