-
Notifications
You must be signed in to change notification settings - Fork 266
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 origin axes config plugin #150
Conversation
Signed-off-by: ahcorde <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-gazebo4 #150 +/- ##
===============================================
- Coverage 77.37% 77.31% -0.07%
===============================================
Files 217 219 +2
Lines 12217 12567 +350
===============================================
+ Hits 9453 9716 +263
- Misses 2764 2851 +87
Continue to review full report at Codecov.
|
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.
Thanks for the new feature 😄 I'm not sure why, but it failed to create the arrows for me, printed these and then crashed when I tried to change the size:
[GUI] [Wrn] [OriginAxesConfig.cc:161] Creating origin axes
[GUI] [Err] [OriginAxesConfig.cc:169] Failed to create origin axes, origin axes config plugin won't work.
/home/chapulina/dome_ws/install/lib/ign-gazebo-4/plugins/gui/libOriginAxesConfig.so(_ZN8ignition6gazebo16OriginAxesConfig10UpdateSizeEi+0x31) [0x7f9128df05e1] /home/chapulina/dome_ws/src/ign-gazebo/src/gui/plugins/origin_axes/OriginAxesConfig.cc:198
/home/chapulina/dome_ws/install/lib/ign-gazebo-4/plugins/gui/libOriginAxesConfig.so(_ZN8ignition6gazebo16OriginAxesConfig11qt_metacallEN11QMetaObject4CallEiPPv+0x63) [0x7f9128df4563] /home/chapulina/dome_ws/build/ignition-gazebo4/src/gui/plugins/origin_axes/moc_OriginAxesConfig.cpp:110
I was not able to get the arrows in the config plugins based only in the ID. is there any way to get the arrows based on the name?
Looking at the implementation, it looks like each arrow is a visual composed of 2 child visuals (cone and cylinder). So I think you should be able to give it a name when you create it, and access it later using Scene::VisualByName
. Just be careful with overlapping names in case the user instantiates more than one origin axis.
Going forward, we should target plugins like this which don't* have any Gazebo-specific code to ign-gui
. This way they're available to a wider user base. No need to change this PR, just something to keep in mind.
* I know that right now we only have the render event on this repo, but we should move that to ign-gui
soon.
auto root = scene->RootVisual(); | ||
this->dataPtr->x_axis = scene->CreateArrowVisual(); | ||
this->dataPtr->y_axis = scene->CreateArrowVisual(); | ||
this->dataPtr->z_axis = scene->CreateArrowVisual(); |
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.
On Gazebo-classic the origin axes were implemented using dynamic lines instead of arrows. Most of the time users need the origin to be long and without arrows, see this comment. @iche033 can correct me if I'm wrong, but I believe the lines should be less expensive to render, since we don't have the arrow head and the extra triangles from the cylinders. I'm not advocating for a change, I just think it should be pointed out.
Having said all that, I think it's totally valid to add support for custom axes like RViz's axes displays, which ties into the work @Sarath18 will be doing 😄 To that end, here are some suggestions to make the current plugin more flexible:
- Add an option to set the pose
- Add an option to set the radius
- Add an option to change the arrows into lines
This is definitely feature creep for this PR, but I'll just mention it as an idea for the future:
- Let the user attach an axis to any entity that has a pose component
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.
yes lines are less expensive to render. I think a generic axes plugin would be useful, e.g. for visualizing frames. That could be done by changing the name of this plugin to just AxesPlugin and adding a pose widget.
Signed-off-by: ahcorde <[email protected]>
Thank you for the review @chapulina. I forgot to mention that this PR builds on top of this other PR gazebosim/gz-rendering#87. I created this other PR gazebosim/gz-rendering#88 to scale the I can also modify the current implementation of |
Signed-off-by: ahcorde <[email protected]>
LoadAxesbyName(name_entity); | ||
} | ||
|
||
void AxesConfig::EntitiesInScene() |
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.
@chapulina, Is there other way to get the entitie names from a plugin?
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.
If you change the plugin to inherit from gazebo::GuiSystem
, then you could use an Each
call to get for example the names of all visuals, links, collisions, models, etc. The downside is that this plugin would become Gazebo-specific so we can't port it to ign-gui
later.
LoadAxesbyName(name_entity); | ||
} | ||
|
||
void AxesConfig::EntitiesInScene() |
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.
If you change the plugin to inherit from gazebo::GuiSystem
, then you could use an Each
call to get for example the names of all visuals, links, collisions, models, etc. The downside is that this plugin would become Gazebo-specific so we can't port it to ign-gui
later.
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
…/ignitionrobotics/ign-gazebo into ahcorde/feature/OriginAxesConfig
Signed-off-by: ahcorde <[email protected]>
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'm still a bit confused about the use case for this plugin. Is it meant to show the world origin, or the origins of entities?
For entities, I think it would be good to also allow attaching to links, collisions, visuals, lights, etc. Basically anything that has a pose component. If we want to keep it not gazebo-specific, then maybe attach to any visual in the scene?
pitch.value = AxesConfig.axesPitch | ||
yaw.value = AxesConfig.axesYaw | ||
} | ||
onAccepted: { |
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.
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.
@chapulina, yes, this is intentional. The GUI allows you to check or uncheck the Show Axes
option that enables the axes for the selected entity. I did it like this because you may want to visualize more than one axes on the scene.
Do you expect a different behaviour ?
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 see. The usage is still a bit not intuitive to me. For example, if multiple models have axes showing, and I hide the axes for one of them. When I change to another entity, that entity's axes disappear:
I'd expect that when I select the "sphere" from the dropdown, the sphere keeps its axes showing, and the "Show Axes" box checks itself. That is, the widget updates itself to match the currently model on the dropdown.
Signed-off-by: ahcorde <[email protected]>
This plugin will create an axes for each entity in the world. I can extend the plugin to accept other types of objects in the scene. |
Removing the beta label, this can go in a minor release. |
…e/OriginAxesConfig
Signed-off-by: ahcorde <[email protected]>
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.
Since this PR doesn't need anything from ign-gazebo
, what do you think of moving it to ign-gui
, so other applications can also use it? Now that ign-gazebo
can use ignition::gui::events::Render
, this plugin doesn't need to be here.
Layout.fillWidth: true | ||
} | ||
|
||
ComboBox { |
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.
All the information on the plugin applies to the entity that's selected on the combo box. So I think it makes sense to put the dropdown on the top of the plugin, above the checkboxes.
Closing this PR in favour of this other PR in ign-gui gazebosim/gz-gui#182 |
I have been playing a little bit around ignition-gazebo. I have created a config plugin to add and configure the origin axes. I was trying to do something similar as the grid. This is created in ignition-rendering using the method
showGrid()
. I was planning to add a new method calledshowOriginAxes()
. but arrows are build based on two visuals: a cone and a cylinder. I was not able to get the arrows in the config plugins based only in the ID. is there any way to get the arrows based on the name?Signed-off-by: ahcorde [email protected]