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

Use Rviz as a component #1140

Draft
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Draft

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Feb 15, 2024

Related with this issue #1114

TODOs

  • Change name of the container (parameter?)
  • Do you want to launch rviz always as a component? (parameter?)

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
@ahcorde ahcorde self-assigned this Feb 15, 2024
@roncapat
Copy link
Contributor

From my point of view, launching it always as a component (really, a component host) shall be fine.

@roncapat
Copy link
Contributor

What was the logic before, with the name of Rviz node?

@roncapat
Copy link
Contributor

roncapat commented Apr 14, 2024

@ahcorde can this one be merged for Jazzy?
Edit: it could be worth in the future to allow the user to select a different executor, for example a MultiThreadedExecutor.

@roncapat
Copy link
Contributor

Friendly ping @ahcorde :)

@james-yoo
Copy link

Any updates?

@@ -399,6 +400,7 @@ private Q_SLOTS:
rclcpp::executors::SingleThreadedExecutor::SharedPtr executor_;
ros_integration::RosNodeAbstractionIface::WeakPtr rviz_ros_node_;
rviz_common::transformation::TransformationManager * transformation_manager_;
std::shared_ptr<ros_integration::ComponentManager> mgr_;
Copy link
Member

Choose a reason for hiding this comment

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

Explicitly initialize to nullptr in constructors' initialization list?

@@ -225,7 +226,15 @@ VisualizationManager::VisualizationManager(

connect(this, SIGNAL(timeJumped()), this, SLOT(resetTime()));

executor_->add_node(rviz_ros_node_.lock()->get_raw_node());
if (!mgr_) {
mgr_ = std::make_shared<ros_integration::ComponentManager>(executor_);
Copy link
Member

Choose a reason for hiding this comment

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

Should we allow users to configure the name of the component manager and pass it along as an argument here?
There could be name clashes with other component containers running. It would also make adding nodes to this container less ambiguious by being able to specify the right name.

using rclcpp_components::ComponentManager::ComponentManager;

void
add_node_to_executor(
Copy link
Member

Choose a reason for hiding this comment

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

Move impl to a .cpp file?

auto node_id = unique_id_++;
node_wrappers_[node_id] = node;
if (auto exec = this->executor_.lock()) {
exec->add_node(node.get_node_base_interface(), true);
Copy link
Member

Choose a reason for hiding this comment

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

Drop true since it is the default arg.

Suggested change
exec->add_node(node.get_node_base_interface(), true);
exec->add_node(node.get_node_base_interface());

@@ -44,7 +44,7 @@ namespace ros_integration
{

RosNodeAbstraction::RosNodeAbstraction(const std::string & node_name)
: raw_node_(rclcpp::Node::make_shared(node_name))
: raw_node_(rclcpp::Node::make_shared(node_name, rclcpp::NodeOptions().use_intra_process_comms(true)))
Copy link
Member

Choose a reason for hiding this comment

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

Make use_intra_process_comms a configurable parameter for users to specify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants