Skip to content
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

Rigidbody velocity get set #464

Merged
merged 8 commits into from
Feb 6, 2020
Merged

Rigidbody velocity get set #464

merged 8 commits into from
Feb 6, 2020

Conversation

aclegg3
Copy link
Contributor

@aclegg3 aclegg3 commented Jan 30, 2020

Motivation and Context

We can currently manipulate objects kinematically via position|orientation and dynamically via force|torque. This change sets the stage for velocity control by adding support for getting|setting rigid body linear|angular velocity via Bullet physics.

Viewer demo updates: (for demo purposes: happy to modify/remove for final merge)

  • Added velocity control 'E' and anti-gravity mode 'G' for most recently added object with on-screen text to display current setting.
  • Added commandVelocity variable to store and apply a velocity control setting.

Notes:

  • This enables setting initial velocity for a sim step, not constant velocity (forces will change the velocity within the simulation step). Therefore use shorter steps and remove/counter forces (such as gravity) for more accurate control.
  • This does not allow setting velocity for objects with MotionType::KINEMATIC or MotionType::STATIC. In other words, it only currently enables velocity manipulation for MotionType::DYNAMIC BulletRigidObjects.

How Has This Been Tested

New C++ test and viewer demo:

Example 1: anti-grav velocity control of cheezit box
box_vel_antigrav

Example 2: velocity control with gravity of chef_can
can_vel_grav

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aclegg3 aclegg3 self-assigned this Jan 30, 2020
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jan 30, 2020
@1heart
Copy link

1heart commented Jan 30, 2020

Codecov Report

Merging #464 into master will increase coverage by 0.14%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #464      +/-   ##
==========================================
+ Coverage   57.81%   57.96%   +0.14%     
==========================================
  Files         161      161              
  Lines        7067     7123      +56     
  Branches       84       84              
==========================================
+ Hits         4086     4129      +43     
- Misses       2981     2994      +13     
Flag Coverage Δ
#CPP 52.90% <76.78%> (+0.32%) ⬆️
#JavaScript 10.00% <ø> (ø) ⬆️
#Python 79.20% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a23722f...3476de8. Read the comment docs.

src/utils/viewer/viewer.cpp Outdated Show resolved Hide resolved
src/utils/viewer/viewer.cpp Outdated Show resolved Hide resolved
src/utils/viewer/viewer.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@bigbike bigbike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my inline comments. Thanks!

@codecov
Copy link

codecov bot commented Feb 5, 2020

Codecov Report

Merging #464 into master will increase coverage by 1.22%.
The diff coverage is 95.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #464      +/-   ##
==========================================
+ Coverage   57.96%   59.19%   +1.22%     
==========================================
  Files         161      165       +4     
  Lines        7123     7347     +224     
  Branches       84       84              
==========================================
+ Hits         4129     4349     +220     
- Misses       2994     2998       +4
Flag Coverage Δ
#CPP 52.18% <94.84%> (-0.73%) ⬇️
#JavaScript 100% <ø> (+90%) ⬆️
#Python 79.73% <98.87%> (+0.53%) ⬆️
Impacted Files Coverage Δ
src/esp/gfx/PTexMeshDrawable.h 0% <ø> (ø) ⬆️
src/esp/gfx/Drawable.h 50% <ø> (ø) ⬆️
src/esp/gfx/RenderCamera.h 100% <ø> (ø) ⬆️
src/tests/ResourceManagerTest.cpp 100% <ø> (+3.44%) ⬆️
src/esp/gfx/GenericDrawable.h 100% <ø> (ø) ⬆️
src/esp/gfx/PrimitiveIDDrawable.h 0% <ø> (ø) ⬆️
src/esp/gfx/GenericDrawable.cpp 100% <ø> (ø) ⬆️
src/esp/assets/ResourceManager.h 100% <ø> (ø) ⬆️
src/esp/physics/PhysicsManager.h 31.81% <ø> (ø) ⬆️
src/esp/gfx/PTexMeshDrawable.cpp 0% <0%> (ø) ⬆️
... and 35 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a4f93f3...04c5d08. Read the comment docs.

@aclegg3
Copy link
Contributor Author

aclegg3 commented Feb 5, 2020

See my inline comments. Thanks!

Thanks for the comments. The viewer changes were really just to demonstrate the functionality in the videos and I've removed them until the full velocity control feature set is ready.

@aclegg3 aclegg3 requested a review from bigbike February 5, 2020 23:48
@aclegg3 aclegg3 merged commit d130d41 into master Feb 6, 2020
@aclegg3 aclegg3 deleted the rigidbody-velocity-get-set branch February 6, 2020 16:31
Ram81 pushed a commit to Ram81/habitat-web-sim that referenced this pull request Dec 10, 2020
* Add get/set instantaneous linear/angular velocity for RigidBody and PhysicsManager implemented through BulletRigidBody. Added C++ test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants