-
Notifications
You must be signed in to change notification settings - Fork 51
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
Inertia visual #326
Inertia visual #326
Conversation
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #326 +/- ##
==========================================
+ Coverage 57.91% 57.94% +0.02%
==========================================
Files 162 166 +4
Lines 16162 16385 +223
==========================================
+ Hits 9361 9494 +133
- Misses 6801 6891 +90
Continue to review full report at Codecov.
|
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@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.
Some small comments in the code. Two more things:
- Can you add some tests to these new classes?
- Can you add an example in the example folder? I'm fine doing this in another PR and maybe include in the same example wireframes too. And potencially all the other new features.
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
I was expecting to see a call to ignition::math::MassMatrix3::EquivalentBox as we do in osrf/gazebo's InertiaVisual::Load. How do you currently set the size of the inertia box? |
@scpeters The size of the inertia box is currently set in ign-gazebo's SceneManager. |
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.
Thank you for adding the tests! Do you mind to change the status of the PR from Draft to a normal PR ?
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@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.
Do you mind to add support for windows ? Take a look to this PR #291
If this class doesn't actually take inertial parameters as direct inputs, I'm not sure it makes sense to call this class
|
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
I see. I think using |
@iche033 do you mind to take a look ? |
That sounds good to me. Looking at the implementation, I think one API suggestion is to call the function |
ignition::math::Vector3d s(0.5, 0.5, 0.5); | ||
inertiaVisual->Load(p, s); | ||
|
||
EXPECT_NE(nullptr, inertiaVisual->BoxVisual()); |
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 you expand the test to include other APIs like Material
and OgreObject
?
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 the methods to get Material
and OgreObject
are local to Ogre 1 and 2 classes only, similar to the LightVisual test and the Ogre1 LightVisual class
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
I see that you added the |
+1 |
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
I moved the content to |
One possible fix to the Ogre2 bug is to destroy all child visuals whenever
|
what's the ogre2 bug? How about being explicit and just removing the BoxVisual instead of all child visuals |
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
In Ogre2, destroying an InertiaVisual doesn't, in turn, destroy its |
@atharva-18 how I can reproduce the issue ? |
These are the steps:
If we keep the
Presumably, this bug is also present in |
{ | ||
if (this->dataPtr->boxVis != nullptr) | ||
{ | ||
this->dataPtr->boxVis->Destroy(); |
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.
reset boxVis
so when Destroy
is called again, the above line won't be executed.
this->dataPtr->boxVis.reset();
After that, apply this patch, and see if it fixes the crash for you
diff --git a/ogre2/src/Ogre2Node.cc b/ogre2/src/Ogre2Node.cc
index 63a43a93..cff1e3e8 100644
--- a/ogre2/src/Ogre2Node.cc
+++ b/ogre2/src/Ogre2Node.cc
@@ -64,6 +64,8 @@ Ogre::SceneNode *Ogre2Node::Node() const
//////////////////////////////////////////////////
void Ogre2Node::Destroy()
{
+ if (ogreNode)
+ return;
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.
The crash is fixed, but UNIT_Scene_TEST
seems to be failing
Start 55: UNIT_Scene_TEST
55/93 Test #55: UNIT_Scene_TEST .......................***Failed 1.25 sec
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.
oops that should've been if (!ogreNode)
Can you take a look at the changes in this commit:
I think that fixes the test and crash.
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.
Fixed in dd42817
ogre2/src/Ogre2InertiaVisual.cc
Outdated
{ | ||
this->dataPtr->boxVis->Destroy(); | ||
} | ||
BaseInertiaVisual::Destroy(); |
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 this is not needed as we are handling most of the destruction of object ourselves.
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.
Destroying the crossLines
still requires us to call BaseInertiaVisual::Destroy()
, see #326 (comment)
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.
Fixed in dd42817
ogre2/src/Ogre2InertiaVisual.cc
Outdated
{ | ||
this->dataPtr->boxVis->Destroy(); | ||
} | ||
BaseInertiaVisual::Destroy(); |
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.
Destroy material:
if (this->dataPtr->material && this->Scene())
{
this->Scene()->DestroyMaterial(this->dataPtr->material);
this->dataPtr->material.reset();
}
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 am getting this message in the console
visualization_demo: /var/lib/jenkins/workspace/ogre-2.1-debbuilder/repo/OgreMain/src/OgreHlmsDatablock.cpp:170: virtual Ogre::HlmsDatablock::~HlmsDatablock(): Assertion `mLinkedRenderables.empty() && "This Datablock is still being used by some Renderables." " Change their Datablocks before destroying this."' failed.
Aborted (core dumped)
I think this is because of crossLines
still using the material. Explicitly destroying crossLines
before the material is giving an exception in the test
Start 17: UNIT_InertiaVisual_TEST
17/93 Test #17: UNIT_InertiaVisual_TEST ...............Child aborted***Exception: 0.33 sec
This material is also used in LightVisual
where it is not destroyed.
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.
Fixed in dd42817
set(TARGET_THIRD_PARTY_DEPENDS | ||
${TARGET_THIRD_PARTY_DEPENDS} | ||
GLEW::glew) |
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 was not able to build the demo with these lines as it complains about glew
I had to replace it with:
if (WIN32)
set(TARGET_THIRD_PARTY_DEPENDS
${TARGET_THIRD_PARTY_DEPENDS}
GLEW::glew
)
else ()
set(TARGET_THIRD_PARTY_DEPENDS
${TARGET_THIRD_PARTY_DEPENDS}
GLEW
)
endif()
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.
FIxed in ca3ac18
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@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.
Last comment from me
@@ -5,7 +5,7 @@ include_directories(SYSTEM | |||
${PROJECT_BINARY_DIR} | |||
) | |||
|
|||
find_package(ignition-rendering4) | |||
find_package(ignition-rendering6) |
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.
This change is not related to this PR I prefer to remove it from this PR
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.
created PR for this change: #343
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
617af60
to
2428882
Compare
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.
just have one more comment about ogre2 transparency setting for the purple box, otherwise it's working well for me.
material->SetTransparency(0.5); | ||
material->SetCastShadows(false); | ||
material->SetReceiveShadows(false); | ||
material->SetLightingEnabled(false); |
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.
looks like the semi-transparent purple box is occluding the green lines in the ogre2 visualization. I think you can disable depth write to make the transparency effect more like ogre 1.x (which has depth write disabled by default when objects are semi-transparent).
material->SetDepthWriteEnabled(false);
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.
Fixed in 42a6a414
Signed-off-by: Atharva Pusalkar <atharvapusalkar18@gmail.com>
This pull request has been mentioned on Gazebo Community. There might be relevant details there: |
🎉 New feature
Summary
Adds inertia visual to debug models.
Test it
I have added a sample called
visualization_demo
in the examples folder.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge