-
Notifications
You must be signed in to change notification settings - Fork 214
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
Added Effort plugin #990
Conversation
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass review.
rviz_default_plugins/include/rviz_default_plugins/displays/effort/effort_display.hpp
Outdated
Show resolved
Hide resolved
rviz_default_plugins/include/rviz_default_plugins/displays/effort/effort_display.hpp
Outdated
Show resolved
Hide resolved
rviz_default_plugins/src/rviz_default_plugins/displays/effort/effort_display.cpp
Outdated
Show resolved
Hide resolved
rviz_default_plugins/src/rviz_default_plugins/displays/effort/effort_display.cpp
Outdated
Show resolved
Hide resolved
rviz_rendering/test/rviz_rendering/objects/effort_visual_test.cpp
Outdated
Show resolved
Hide resolved
rviz_rendering/test/rviz_rendering/objects/effort_visual_test.cpp
Outdated
Show resolved
Hide resolved
rviz_rendering/test/rviz_rendering/objects/effort_visual_test.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
There was a problem hiding this 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); |
There was a problem hiding this comment.
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:
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; |
There was a problem hiding this comment.
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:
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!"); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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'; |
There was a problem hiding this comment.
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_)); |
There was a problem hiding this comment.
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:
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>
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>
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
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:
|
friendly ping @clalancette |
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:
This combination of factors makes me think that these plugins should be released into a separate package for manipulation. Maybe All of that said, I could be convinced otherwise. I'd also like to hear from @ros2/team here for other opinions. |
I agree |
@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 ? |
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? |
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. |
I don´t have a answer for this, but maybe @j-rivero or @nuclearsandwich have one. |
I was discussing this with @j-rivero offline, and these are his thoughts:
Last comment is not relevant because we are just comparing compilation times. I will check that the parameters are the same. |
One thing that jumps out at me is the scoped build argument in the CI job
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. |
There was a problem hiding this 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/test/rviz_default_plugins/publishers/effort_publisher.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
https://github.com/Mergifyio backport humble iron |
✅ Backports have been created
|
* Added Effort plugin Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com> (cherry picked from commit e3b56ed)
* Added Effort plugin Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com> (cherry picked from commit e3b56ed)
Added Effort plugin