-
Notifications
You must be signed in to change notification settings - Fork 268
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
Force offset and vector magnitude support in ApplyForceTorque #2056
Force offset and vector magnitude support in ApplyForceTorque #2056
Conversation
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
Signed-off-by: Henrique-BO <[email protected]>
…-sim into apply_force_torque_offset
#include <gz/utils/ImplPtr.hh> | ||
|
||
#include <gz/math/Vector3.hh> | ||
#include <gz/rendering/RenderTypes.hh> |
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.
nit: include what you need and not all
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 I'm using some declarations from those headers shouldn't I need to include them?
#include <gz/gui/Helpers.hh> | ||
#include <gz/gui/MainWindow.hh> | ||
#include <gz/math/Pose3.hh> | ||
#include <gz/math/Quaternion.hh> | ||
#include <gz/math/Vector3.hh> |
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 <gz/math/Vector3.hh> | |
#include <gz/math/Vector2.hh> | |
#include <gz/math/Vector3.hh> |
@@ -18,15 +18,27 @@ | |||
#include <mutex> |
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 <mutex> | |
#include <memory> | |
#include <mutex> |
|
||
#include <gz/common/Console.hh> | ||
#include <gz/common/MeshManager.hh> | ||
#include <gz/math/Vector3.hh> |
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 <gz/math/Vector3.hh> | |
#include <gz/math/Quaternion.hh> | |
#include <gz/math/Vector3.hh> |
* limitations under the License. | ||
* | ||
*/ | ||
|
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 <memory> |
#include <gz/common/Console.hh> | ||
#include <gz/common/MeshManager.hh> | ||
#include <gz/math/Vector3.hh> | ||
#include <gz/rendering/ArrowVisual.hh> |
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 <gz/rendering/ArrowVisual.hh> | |
#include <gz/rendering/ArrowVisual.hh> | |
#include <gz/rendering/Material.hh> |
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.
Done in c4819ef
Signed-off-by: Henrique-BO <[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.
Works pretty well! Just have couple minor comments.
Signed-off-by: Henrique-BO <[email protected]>
Is there a way to remove the semi-transparent apply force / torque visuals once I'm done using the plugin? Closing the gui plugin does not seem to remove/hide the visuals? |
Setting the magnitude (or each component) to zero removes the visual. Do you think that's enough? Closing the plugin should remove the visuals though, I'll fix that. |
This should be good enough, thanks! |
Signed-off-by: Henrique-BO <[email protected]>
Fixed in 2c83ce2 However, I noticed that this bug also happens in the |
this->dataPtr->forceVisual->SetVisible(false); | ||
this->dataPtr->forceVisual->Destroy(); | ||
|
||
this->dataPtr->torqueVisual->SetVisible(false); | ||
this->dataPtr->torqueVisual->Destroy(); | ||
|
||
this->dataPtr->gizmoVisual->SetVisible(false); | ||
this->dataPtr->gizmoVisual->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.
ah yes this works but prefer to use Scene::DestroyNode
as it ensures the the visuals are also removed from the scene's internal list of nodes:
this->dataPtr->forceVisual->SetVisible(false); | |
this->dataPtr->forceVisual->Destroy(); | |
this->dataPtr->torqueVisual->SetVisible(false); | |
this->dataPtr->torqueVisual->Destroy(); | |
this->dataPtr->gizmoVisual->SetVisible(false); | |
this->dataPtr->gizmoVisual->Destroy(); | |
this->dataPtr->scene->DestroyNode(this->dataPtr->forceVisual, true); | |
this->dataPtr->scene->DestroyNode(this->dataPtr->torqueVisual, true); | |
this->dataPtr->scene->DestroyNode(this->dataPtr->gizmoVisual, true); | |
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.
Alright, changed it in db942e4
Signed-off-by: Henrique-BO <[email protected]>
Adds tutorials for the new ApplyForceTorque plugin (including the features added in #2051 and #2056) and for the new MouseDrag plugin. --------- Signed-off-by: Henrique-BO <[email protected]>
🎉 New feature
Requires #2051
Requires #2026
Summary
Adds support for specifying the offset of the force application point through the GUI in the ApplyForceTorque plugin. This offset is also reflected in the visualization of the force vector.
Also adds fields for the magnitude of the force and torque vectors on the interface. Changing the components of a vector automatically updates the value of its magnitude, while changing the vector's magnitude automatically scales its components, maintaining its direction.
Test it
Open any test world.
Load the Apply Force Torque plugin from the plugin dropdown.
Select a model or link and specify a force and torque.
Change the values of the offset and magnitudes and observe the effects.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.