-
Notifications
You must be signed in to change notification settings - Fork 44
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 Interactive view control plugin #231
Conversation
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.
Can we add this plugin to scene3d.config
?
This plugin allows to control the camera in the 3D Scene.
It's worth remembering that there are multiple ways of controlling the user camera, and they're being spread across various plugins:
ViewAngle
provides canonical angles, set precise pose and projection type- The plugin added in Added camera tracking #226 provides "follow" and "move to"
- This plugin allows orbiting with a mouse
In the future we may want to have more camera control functionality:
- First person view control with mouse (I think it would be part of this plugin)
- Keyboard based view control (probably also part of this plugin)
I can imagine this being confusing for users in the future.
I think this plugin is basic enough that it could be part of MinimalScene
. On the other hand, some users may want to implement different orbit controls, so we either make this configurable, or let them implement their own thing. So since you've already started moving this to a new plugin, let's keep this separated.
I just think we should work on the names for all these plugins, so it's clear what each of them is for. This plugin is for orbiting with the mouse, possibly adding FPS control with the keyboard in the future. How about calling it InteractiveViewControl
?
return; | ||
|
||
this->camera = std::dynamic_pointer_cast<rendering::Camera>( | ||
this->scene->SensorByName("Scene3DCamera")); |
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 that hardcoding the name of the camera may be a bit limiting. Can we assume that the first camera is the user camera? Like the screenshot plugin does:
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.
With the recent changes in the PR of running in the process this may be not true. I included this change, I think all cameras except the one is moving should have a name similar to scene::camera(XXXX)
otherwise should be named like model_name::link_name::camera_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.
With the recent changes in the PR of running in the process this may be not true
Yeah I see your point. The problem is that the scene of Scene3D
or MinimalScene
may not be called scene
if the user passes a custom name through XML's <scene>
element. I ran into this while writing a test for #226 which had a different scene name.
So I think we need a different way of identifying the user camera. On Gazebo classic there was a separate class for the user camera, so that was easy. On Ignition Rendering I don't think there's any distinction.
Another thing to keep in mind is that in the future we may want to restore support for multiple user cameras in the same scene, and these plugins that attach to a camera may want to choose which camera to attach to (like we had in ign-gui0
).
Once gazebosim/gz-rendering#58 is tackled, maybe we could store a different property into the user camera(s)? @iche033 , do you have other ideas on how to identify if a camera is on the GUI or a sensor?
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.
include/ignition/gui/GuiEvents.hh
Outdated
@@ -255,6 +255,24 @@ namespace ignition | |||
/// for this event. | |||
private: bool menuEnabled; | |||
}; | |||
|
|||
class BlockOrbit : public QEvent |
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.
What's the intended use case for this event? I don't see it being used.
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.
BlockOrbit is emitted when the transform mode is on. it used here https://github.com/ignitionrobotics/ign-gazebo/pull/854/files
Codecov Report
@@ Coverage Diff @@
## main #231 +/- ##
==========================================
- Coverage 65.09% 64.29% -0.81%
==========================================
Files 28 30 +2
Lines 4286 4386 +100
==========================================
+ Hits 2790 2820 +30
- Misses 1496 1566 +70
Continue to review full report at Codecov.
|
Did you give this any thought, @ahcorde ? |
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 did a first pass and pushed some trivial changes in 7dce9b0.
@@ -892,7 +838,8 @@ void RenderWindowItem::wheelEvent(QWheelEvent *_e) | |||
#endif | |||
double scroll = (_e->angleDelta().y() > 0) ? -1.0 : 1.0; | |||
this->dataPtr->renderThread->ignRenderer.NewMouseEvent( | |||
this->dataPtr->mouseEvent, math::Vector2d(scroll, scroll)); | |||
this->dataPtr->mouseEvent); | |||
this->dataPtr->mouseEvent.SetScroll(scroll, scroll); |
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.
With some manual testing I can see that this works, but I'm not sure why the SetScroll
isn't before the event is sent.
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.
Not really sure about this... uhmm
/// \brief | ||
public: void OnRender(); | ||
|
||
math::Vector3d ScreenToScene( |
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.
We should consider putting this in a helper function that can be used by various plugins instead of copying it for every plugin that needs it. No need to do it now, maybe we can just add a TODO
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.
where do you think this should live? ign-rendering ?
Requires gazebosim/gz-rendering#358 |
@osrf-jenkins retest this please |
Signed-off-by: ahcorde <ahcorde@gmail.com>
c81302d
to
18d35ba
Compare
cleaned commit history because this PR was targeting a different branch |
Windows warnings should be fixed with this PR #254 |
Signed-off-by: Louise Poubel <louise@openrobotics.org>
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.
Signed-off-by: ahcorde ahcorde@gmail.com
🎉 New feature
Summary
This PR is part of the consolidation between the scene3d in ign-gui and ign-gazebo.
This plugin allows to control the camera in the 3D Scene.
Related PRs:
Test it
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge