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

Added Effort plugin #990

Merged
merged 10 commits into from
Jul 11, 2023
Merged

Added Effort plugin #990

merged 10 commits into from
Jul 11, 2023

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Jun 7, 2023

Added Effort plugin

effort_plugin

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@ahcorde ahcorde self-assigned this Jun 7, 2023
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

First pass review.

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@ahcorde ahcorde requested a review from clalancette June 14, 2023 15:22
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

I left a few more comments; these all should be pretty easy to fix. Once that is done I'm happy with this.

if (joint->type == urdf::Joint::REVOLUTE || joint->type == 2) {
std::string joint_name = it->first;
urdf::JointLimitsSharedPtr limit = joint->limits;
joints_[joint_name] = createJoint(joint_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

At this point, createJoint is a one-liner, so I'll suggest we just inline it here:

Suggested change
joints_[joint_name] = createJoint(joint_name);
joints_[joint_name] = new JointInfo(joint_name, joints_category_);

and remove the the createJoint method.

// data gets popped from the front (oldest) and pushed to the back (newest)
std::deque<std::shared_ptr<rviz_rendering::EffortVisual>> visuals_;

typedef std::map<std::string, JointInfo *> M_JointInfo;
Copy link
Contributor

Choose a reason for hiding this comment

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

I just had a thought about this. If we instead made this:

Suggested change
typedef std::map<std::string, JointInfo *> M_JointInfo;
typedef std::map<std::string, std::unique_ptr<JointInfo>> M_JointInfo;

Then we wouldn't need to explicitly free it in the destructor. We'd also have to change where we allocate it to std::make_unique, but I think that is probably worth it.

robot_description_ = msg.data;
robot_model_ = std::shared_ptr<urdf::Model>(new urdf::Model());
if (!robot_model_->initString(robot_description_)) {
// ROS_ERROR("Unable to parse URDF description!");
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this commented-out code.


void EffortDisplay::processMessage(sensor_msgs::msg::JointState::ConstSharedPtr msg)
{
// Robot model might not be loaded already
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Robot model might not be loaded already
// Robot model might not be loaded yet

{
// Robot model might not be loaded already
if (!robot_model_) {
std::cerr << "Robot model might not be loaded yet" << '\n';
Copy link
Contributor

Choose a reason for hiding this comment

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

My previous comment about this still seems to be open:

"an unconditional print here seems problematic. It seems like 1) the user might miss this on the console, and 2) we might spam the user early on with a lot of these messages. Could we instead update the Status field somehow?"

(though maybe this isn't possible)

if (visuals_.size() == static_cast<size_t>(history_length_property_->getInt())) {
visual = visuals_.front();
} else {
visual.reset(new rviz_rendering::EffortVisual(context_->getSceneManager(), scene_node_));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think std::make_shared is generally preferred for memory layout and other reasons:

Suggested change
visual.reset(new rviz_rendering::EffortVisual(context_->getSceneManager(), scene_node_));
visual = std::make_shared<rviz_rendering::EffortVisual>(context_->getSceneManager(), scene_node_);

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@ahcorde ahcorde requested a review from clalancette June 15, 2023 22:58
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Contributor Author

ahcorde commented Jun 19, 2023

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Contributor Author

ahcorde commented Jun 19, 2023

  • Windows Build Status

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Contributor Author

ahcorde commented Jun 20, 2023

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

So the code here is looking good to me.

The thing I'm wondering about is whether we should actually add this to the default set of RViz plugins. That is, we already have a large set, and it already takes quite a long time to compile this package. Is this plugin important/universal enough that we should include it in the default set, or can we distribute it in a separate package instead?

@ahcorde
Copy link
Contributor Author

ahcorde commented Jun 21, 2023

So the code here is looking good to me.

The thing I'm wondering about is whether we should actually add this to the default set of RViz plugins. That is, we already have a large set, and it already takes quite a long time to compile this package. Is this plugin important/universal enough that we should include it in the default set, or can we distribute it in a separate package instead?

@clalancette I can add here two arguments:

  • Out of the box experience: When people are trying to migrate from ROS 1 to ROS 2, they will expect to have the same behaviour without any additional step.
  • Feature parity: With these 3 open PRs we will reach feature parity (finally).

@ahcorde
Copy link
Contributor Author

ahcorde commented Jun 26, 2023

friendly ping @clalancette

@clalancette
Copy link
Contributor

So here is the issue that I'm struggling with this.

First, we've gone many years without these plugins, and haven't had a lot of call for them. That doesn't mean there has been zero call for them, or that they don't have value, but these PRs are the first time I've heard of them requested. That makes me think that they aren't necessarily widely used, and hence could be in a separate package. That would also make it so that these plugins aren't release-critical, and thus keep from adding additional burden on the core maintainers.

Second, our build and test times are already absurd. Here are some numbers:

  • On Linux, it currently takes us 2 hours and 26 minutes to run a nightly full build and test. Of that, 59 minutes are spent compiling. And of that, the largest compile time is for rviz_default_plugins at 11 minutes.
  • On Windows, the situation is far more dire. It currently takes us 5 hours and 44 minutes to run a nightly full build and test. Of that, 2 hours 45 minutes are spent compiling. And of that, the largest compile time is for rviz_default_plugins at 32 minutes.

This combination of factors makes me think that these plugins should be released into a separate package for manipulation. Maybe rviz_manipulation_plugins or something like that. It could then be released into humble, iron, and rolling, and be available as normal.

All of that said, I could be convinced otherwise. I'd also like to hear from @ros2/team here for other opinions.

@sloretz
Copy link
Contributor

sloretz commented Jun 26, 2023

[...] And of that, the largest compile time is for rviz_default_plugins at 32 minutes.

I agree rviz_default_plugins is really slow to build. By how much does adding this plugin increase the compile time? If it increases it significantly then I'd see that as justification to put it in a different package.

@ahcorde
Copy link
Contributor Author

ahcorde commented Jun 29, 2023

I created this branch ahcorde/rolling/rviz_default_plugins_parity which includes the remaining rviz default plugins to get the feature parity. Let's see how much increase the compilation time.

  • Windows Build Status

@ahcorde
Copy link
Contributor Author

ahcorde commented Jun 30, 2023

@clalancette in this last build the time to compile rviz_default_plugins with these three new plugins is

Finished <<< rviz_default_plugins [22min 55s]

What do you think? can we move forward ?

@clalancette
Copy link
Contributor

What do you think? can we move forward ?

Looking at the build time in your example branch, it is actually substantially less than the current nightly CI times (22 minutes for your CI vs 32 minutes for nightly CI, and they were running on the same AWS instance). That seems counter-intuitive; we are adding code, so it should be at least the same amount of time, if not longer. Do you have any idea why that might be?

@codebot
Copy link
Member

codebot commented Jul 5, 2023

FWIW, I think it would be great to have this plugin included in the default set. It's very useful for sanity-checking things when debugging.

@ahcorde
Copy link
Contributor Author

ahcorde commented Jul 5, 2023

What do you think? can we move forward ?

Looking at the build time in your example branch, it is actually substantially less than the current nightly CI times (22 minutes for your CI vs 32 minutes for nightly CI, and they were running on the same AWS instance). That seems counter-intuitive; we are adding code, so it should be at least the same amount of time, if not longer. Do you have any idea why that might be?

I don´t have a answer for this, but maybe @j-rivero or @nuclearsandwich have one.

@ahcorde
Copy link
Contributor Author

ahcorde commented Jul 7, 2023

I was discussing this with @j-rivero offline, and these are his thoughts:

  • we need to check if both build are running with the same paremeters
  • changes in the CMakeLists.txt seems trivial, he can not explain any reduction in time.
  • There are failing test in CI but I think that are all related to linting. If there is a test failure in something time-consuming that could explain why the CI is running in less time but does not seem to be the case.

Last comment is not relevant because we are just comparing compilation times. I will check that the parameters are the same.

@ahcorde
Copy link
Contributor Author

ahcorde commented Jul 7, 2023

The only difference is the CI_CMAKE_BUILD_TYPE which is setted to Release. Launching again the job

  • Windows Build Status

@nuclearsandwich
Copy link
Member

I don´t have a answer for this, but maybe @j-rivero or @nuclearsandwich have one.

One thing that jumps out at me is the scoped build argument in the CI job

 build_args: --event-handlers console_cohesion+ console_package_list+ --cmake-args -DINSTALL_EXAMPLES=OFF -DSECURITY=ON -DAPPEND_PROJECT_NAME_TO_INCLUDEDIR=ON --packages-above-and-dependencies rviz_default_plugins rviz_rendering rviz_common, 

With fewer packages being built there's probably more capacity for the rviz_default_plugins build. To get a true apples-to-apples comparison you would need to build the same set of packages as we do in the nightlies.

@ahcorde
Copy link
Contributor Author

ahcorde commented Jul 10, 2023

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

I've left two small things to fix, then I think I'm happy with this.

rviz_default_plugins/CMakeLists.txt Outdated Show resolved Hide resolved
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Contributor Author

ahcorde commented Jul 11, 2023

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@ahcorde ahcorde requested a review from clalancette July 11, 2023 07:35
@clalancette clalancette merged commit e3b56ed into rolling Jul 11, 2023
@delete-merged-branch delete-merged-branch bot deleted the ahcorde/rolling/effort_plugin branch July 11, 2023 12:45
@ahcorde
Copy link
Contributor Author

ahcorde commented Jul 13, 2023

https://github.com/Mergifyio backport humble iron

@mergify
Copy link

mergify bot commented Jul 13, 2023

backport humble iron

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 13, 2023
* Added Effort plugin

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
(cherry picked from commit e3b56ed)
mergify bot pushed a commit that referenced this pull request Jul 13, 2023
* Added Effort plugin

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
(cherry picked from commit e3b56ed)
@clalancette clalancette mentioned this pull request Jul 14, 2023
ahcorde added a commit that referenced this pull request Jul 17, 2023
* Added Effort plugin

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
(cherry picked from commit e3b56ed)

Co-authored-by: Alejandro Hernández Cordero <alejandro@openrobotics.org>
ahcorde added a commit that referenced this pull request Jul 18, 2023
* Added Effort plugin

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
(cherry picked from commit e3b56ed)

Co-authored-by: Alejandro Hernández Cordero <alejandro@openrobotics.org>
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.

5 participants