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

MuscleNP #99

Merged
merged 163 commits into from
Nov 26, 2014
Merged

MuscleNP #99

merged 163 commits into from
Nov 26, 2014

Conversation

brtietz
Copy link
Contributor

@brtietz brtietz commented Nov 18, 2014

This is a big merge. Here's a summary:

Some important notes to start:

  1. You'll need to rebuild bullet for this and do a clean build of your repository, as its much more stable with double precision. I'll make a separate thread where we can discuss that in more depth and I can post the results. Rebuilding also includes some additional modifications to tgDemoApplicaiton in the patching process that allow us to render the new strings properly and avoid a serious memory leak.

  2. There have been some additional changes to the builder tools in tgUtil and tgSphereInfo that have global implications as well as some lower level changes that shouldn't be noticeable at a high level (btRigidBodies have been changed to btCollisionObjects). These need to be verified with unit tests (another forthcoming issue).

Now, what's all here?

  1. Oops - I had some local merge issues and dragged along the Corde commits from before June. These are pretty harmless and boring (just a simple text printout at this point) so I'm not opposed to merging them. Actually merging in the full Corde branch will be more interesting.

  2. I've gone through and dropped profiling information for btQuickProfiler in a few relevant places so I can see runtimes. We should consider adding the BT_NO_PROFILE flag to our cmake build so these can be turned off if that's desirable.

  3. Within core:
    a) muscleAnchor has become a much more fully featured class, as it has to store data for multiple types of anchors, yet still be the same object for rendering and other purposes. I'm open to making a base class and doing some casting if people prefer that to the booleans I'm using right now.
    b) Muscle2P stores its data a little differently so that Muscle2P and MuscleNP can both be rendered by the same funcitons
    c) Some fixes for the ground class
    d) The world is equipped to handle bullet's ghost objects

  4. For tgcreator:
    a) Anything involving a rigid body has been changed slightly to accommodate storing a btCollisionObject instead and getting the rigid body with a cast in the getRigidBody() funciton
    b) tgUtil's getQuaternionBetween function returns negative identity instead of the result of a random vector. @ryan1248 suggested this is insufficient for all cases, but I need to see the test it fails.
    c) tgSphereInfo had a corrective sign change so the string actually appears on the outside of the sphere.

  5. Finally MuscleNP and associated classes
    a) MuscleNP is a child class of Muscle2P, since the controller interface is identical. The calculateAndApplyForce function is a lot beefier, since it also has to handle all of the bullet contact information. This is split between four private functions, which I can explain in detail if you have questions - hopefully the documentation suffices.
    b) tgMultiPointStringInfo constructs a tgLinearString with a MuscleNP.
    c) There are two ghost object construction classes here as well. They are no longer used in this branch, but I believe DuCTT uses them in the DuCTT branch
    d) The demo classes are in my dev folder: muscleNPTests (two in one with conditional compiles), muscleNPEnergy (almost an integration test), sphereFeet (repurposed superball), and tetraCollisions)

There are still a few cases where MuscleNP blows up, which mostly have to do with figuring out the correct order for new contacts, but they're not common in tensegrity applications. The methods used here have the potential to improve Corde's contact dynamics with some additional work, but runtime may need to be addressed in that case.

brtietz added 30 commits June 18, 2014 14:50
…ssipation term further, it appears to add energy
@vsunspiral
Copy link
Contributor

Brian,
This is great! I'm so glad to see this finally merging in with trunk, and I hope that other folks get a chance to look at the details of this in the near future!

vytas

On Nov 18, 2014, at 12:48 PM, Brian Mirletz notifications@github.com wrote:

This is a big merge. Here's a summary:

Some important notes to start:

  1. You'll need to rebuild bullet for this and do a clean build of your repository, as its much more stable with double precision. I'll make a separate thread where we can discuss that in more depth and I can post the results. Rebuilding also includes some additional modifications to tgDemoApplicaiton in the patching process that allow us to render the new strings properly and avoid a serious memory leak.

  2. There have been some additional changes to the builder tools in tgUtil and tgSphereInfo that have global implications as well as some lower level changes that shouldn't be noticeable at a high level (btRigidBodies have been changed to btCollisionObjects). These need to be verified with unit tests (another forthcoming issue).

Now, what's all here?

  1. Oops - I had some local merge issues and dragged along the Corde commits from before June. These are pretty harmless and boring (just a simple text printout at this point) so I'm not opposed to merging them. Actually merging in the full Corde branch will be more interesting.

  2. I've gone through and dropped profiling information for btQuickProfiler in a few relevant places so I can see runtimes. We should consider adding the BT_NO_PROFILE flag to our cmake build so these can be turned off if that's desirable.

  3. Within core:
    a) muscleAnchor has become a much more fully featured class, as it has to store data for multiple types of anchors, yet still be the same object for rendering and other purposes. I'm open to making a base class and doing some casting if people prefer that to the booleans I'm using right now.
    b) Muscle2P stores its data a little differently so that Muscle2P and MuscleNP can both be rendered by the same funcitons
    c) Some fixes for the ground class
    d) The world is equipped to handle bullet's ghost objects

  4. For tgcreator:
    a) Anything involving a rigid body has been changed slightly to accommodate storing a btCollisionObject instead and getting the rigid body with a cast in the getRigidBody() funciton
    b) tgUtil's getQuaternionBetween function returns negative identity instead of the result of a random vector. @ryan1248 suggested this is insufficient for all cases, but I need to see the test it fails.
    c) tgSphereInfo had a corrective sign change so the string actually appears on the outside of the sphere.

  5. Finally MuscleNP and associated classes
    a) MuscleNP is a child class of Muscle2P, since the controller interface is identical. The calculateAndApplyForce function is a lot beefier, since it also has to handle all of the bullet contact information. This is split between four private functions, which I can explain in detail if you have questions - hopefully the documentation suffices.
    b) tgMultiPointStringInfo constructs a tgLinearString with a MuscleNP.
    c) There are two ghost object construction classes here as well. They are no longer used in this branch, but I believe DuCTT uses them in the DuCTT branch
    d) The demo classes are in my dev folder: muscleNPTests (two in one with conditional compiles), muscleNPEnergy (almost an integration test), sphereFeet (repurposed superball), and tetraCollisions)

There are still a few cases where MuscleNP blows up, which mostly have to do with figuring out the correct order for new contacts, but they're not common in tensegrity applications. The methods used here have the potential to improve Corde's contact dynamics with some additional work, but runtime may need to be addressed in that case.

You can merge this Pull Request by running

git pull https://github.com/NASA-Tensegrity-Robotics-Toolkit/NTRTsim MuscleNP
Or view, comment on, or merge it at:

#99

Commit Summary

Adding folder and header file for new models
Define elements
Adding cpp file for CordeModel
Adding main and CMakeLists file for Corde testing
Prepping variables in ComputeInternalForces
Defining parameters in header file
A few comments for corde, mostly testing branching
working config, partial implementation of forces
Adding other x equations, error checking for config
Constructors for the position and quaternion elements
Simple constructor and destructor
Running corde internal forces in one dimension, blows up
Adding double precision to build, causes faults. Will debug on another branch
Making Corde model double precision, note this breaks everything else for now
Working corde model (for 1 s of simulation in 1D), Need to examine dissipation term further, it appears to add energy
Proper definition of Use_Double_Precision flag
Messing around with Corde more
Merged with master
Noticed the units on Spillman's dissipation constants
Completed force loop
quaternion stiffnesses, renamed quaternion elements
q1 torques finished, q2 in progress
All torque equations
Apply all torques
Complete equations for unconstrained motion. Boundry condition issues still need to be addressed
Updated debugging printouts and using proper quaternion matrix
Fixed bug, now stable along z axis
Corrected a numerical instability in constraint equations
Merge branch 'master' of https://github.com/NASA-Tensegrity-Robotics-Toolkit/NTRTsim
Updating to corde latest Merge branch 'corde' of https://github.com/NASA-Tensegrity-Robotics-Toolkit/NTRTsim
pre merge commit
Merged with setup_bullet.sh
Catching up this repo with origin master
Basic classes to utilize ghost objects for collision detection
Modifications to run with the object. Currently segfaults due to lack of collision shape
Functional overlapping pair cache
Better overlapping pair tests
split muscle2P and muscleAnchor into seperate files
Cleanup of includes for tgRigidInfo, updating transforms for ghost objects
Fixed rendering for new ghost objects
Preliminary narrow-phase code, need to debug
Comments
Fixed broadphase error for proper use of ghost objects
More debugging info for MuscleNP
Preliminary collision resolution model
Quick model demonstrating contact dynamics
New data for muscleAnchor, const correctness for muscleAnchor, testing necessity of RB checks for new contacts
Comparison object for muscle anchors, more const correctness
Correct capitilzation for muscleAnchor files, towards anchor lists for muscleNP
Rendering for MuscleNP, required modifications to Muscle2P to avoid nasty casting
Bugfix in anchor definition
Updating bounding boxes for anchors. Needs improvement
First cut point pruning algorithm
Sketch of force application, bugfixes, improved pruning algorithm, updating center of bounding boxes
Updated abs, correct way of centering AABB for MuscleNP
Fixed force direction for traditional anchors
Fixed force direction for traditional anchors
Working contact dynamics with poor collision shape updates
Adding a new Ghost Info class, minor changes to MuscleNP, etc
Upcasting for tgRigidInfo to store as a btCollisionObject
Building version using ghost objects and the builder tools- still need to work out details to get it working
Working builder tool ghost objects
Compounding boxes for collision objects
Compounding boxes for collision objects
Merge branch 'MuscleNP' of https://github.com/NASA-Tensegrity-Robotics-Toolkit/NTRTsim into MuscleNP
Minor changes
Avoid leaking collision objects that are created at runtime
Remove unncessary conditional compiles
Two point builder tools option, just a simple box
Sanity checks on force magnitude
Reduced couts in MuscleNP
Profiling for MuscleNP
Additional profiling
Stripped down collision object creation
Compound Objects without the builder tools
Bugfixes so more collisions are detected
Updating contact normals for muscle anchors, MuscleNP considers the length between its anchors, prunes accordingly, max force computations adjusted
Improved anchor contact normal tracking
Better determination of contact point
Improved pruning for redundant contacts
ifdef guards for couts
Pruning based on relative normal directions, reduced length threshold
Prune all pushing nodes in a first pass, increases quality of remaining nodes
some additional debugging phrases
Pruning by radius of curvature...
Testing a single contact per manifold
Checking contact lengths before insertion into the vector
Improved force application
Previous commit, but with less pruning
Check normals before inserting new contacts
Sliding anchors, which are deleted based on AABB. Had to make anchors non-const do do this
Limiting force on a rigid body basis
Remove manifold tracking from muscleAnchor
Zero g testing for simpleMuscleNP, remove unnecessary includes for MuscleNP
Working TetraSpine with collisions - note, the change to tgSphereInfo will change ICRA2015 applications
Profiling info
Clean up collision shapes on deletion of MuscleNP
Fixing merge error in setup.sh
Ensure tgMultiPointStringInfo actually adds the ghost object to the world, removed unnecessary deletion from updateCollisionObject
Energy testing for MuscleNP. Some comments in tgUtil about issues I'm finding
Changes to tgBulletGround to make sure values are initialized, better cleanup for Muscle2P and MuscleNP
Some conditional compiles in MuscleNP and related, a fix for a hack in tgUtil
Completely remove getArbitraryVector function
Better reporting of total forces on objects
Update compound objects instead of adding/removing from simulation
More fixes for tgMultiPointStringInfo
Improved force application, plus some crazy ideas for better contact detection in the conditional compiles
New patch file containing additional changes to tgDemoApplication
Manifold updating for anchors. Improvement for momentum case, still testing others. Also now building bullet at double precision, may need to work this into bin/build.sh
Making a second effort to copy the manifold before deleting the anchor
Always update - best across the board performance
Scaling force vectors by components
Better contact normal updates, forces conserving momentum 1.5%
Pruning after adding new anchors improves performance
A few different tests. Minor bugfixes to conserve momentum across more cases
Update contact normal more frequently reduces the number of contacts
Clean up anchor functions we're no longer using
More cleanup for muscleAnchor
Check to make sure this is the closest manifold, also local sorting scheme
Accurate local search for new anchor order
Final implementation of line pos sort - kind of explosive
First cut of improvements and bugfixes from anchorPositions branch
Fixed insertion point
ifdefs for debugging, improved anchor deletion scheme
Merge remaining pieces of anchorPositions
Include dist deletion again
Change simpleMuscleNP back over, comments
Remove unused cable position functions
Remove string position from anchor constructor and data members (difficult to keep up to date)
Simplification of logic for muscleAnchor updates
Comments for muscleAnchor, cleanup of getManifoldDistance
Improvements to pruning procedure and manifold updates, comments
Deleting overlapping pair cache helps full structures
Changing return type of calculateAndApplyForce since no one looks at that force vector, many comments for MuscleNP
Two string test, silence couts from MuscleNP
First cut at 'backwards' iterations to determine position. Minor stability improvements
First cut at 'backwards' iterations to determine position. Minor stability improvements
Bugfixes for new iteratons, added stability
Finished with MuscleNP, cleaned up some unnecessary includes
Comments for muscleAnchor, returning a reference for force instead of a copy
Merge in latest commits to master
File Changes

M bin/setup/patches/OpenGLPatch.diff (1602)
M bin/setup/setup_bullet.sh (2)
M resources/src/learningSpines/TetrahedralComplex/logs/scores.csv (4)
M src/core/CMakeLists.txt (1)
M src/core/Muscle2P.cpp (73)
M src/core/Muscle2P.h (46)
A src/core/muscleAnchor.cpp (302)
A src/core/muscleAnchor.h (201)
M src/core/terrain/tgBulletGround.cpp (5)
M src/core/terrain/tgBulletGround.h (3)
M src/core/terrain/tgEmptyGround.cpp (3)
M src/core/tgBulletRenderer.cpp (55)
M src/core/tgLinearString.cpp (9)
M src/core/tgSimulation.cpp (8)
M src/core/tgWorldBulletPhysicsImpl.cpp (39)
M src/core/tgWorldBulletPhysicsImpl.h (12)
M src/dev/CMakeLists.txt (1)
M src/dev/btietz/CMakeLists.txt (4)
A src/dev/btietz/Corde/AppCordeTest.cpp (94)
A src/dev/btietz/Corde/AppLineInsertionCheck.cpp (105)
A src/dev/btietz/Corde/CMakeLists.txt (19)
A src/dev/btietz/Corde/CordeModel.cpp (579)
A src/dev/btietz/Corde/CordeModel.h (167)
A src/dev/btietz/muscleNPEnergy/AppMuscleNPCons.cpp (79)
A src/dev/btietz/muscleNPEnergy/CMakeLists.txt (6)
A src/dev/btietz/muscleNPEnergy/MuscleNPCons.cpp (177)
A src/dev/btietz/muscleNPEnergy/MuscleNPCons.h (93)
A src/dev/btietz/muscleNPTests/AppsimpleMuscleNP.cpp (83)
A src/dev/btietz/muscleNPTests/CMakeLists.txt (6)
A src/dev/btietz/muscleNPTests/simpleMuscleNP.cpp (151)
A src/dev/btietz/muscleNPTests/simpleMuscleNP.h (93)
M src/dev/btietz/sphereFeet/AppSUPERSphereball.cpp (7)
M src/dev/btietz/sphereFeet/CMakeLists.txt (2)
M src/dev/btietz/sphereFeet/T6SphereModel.cpp (12)
A src/dev/btietz/tetraCollisions/AppTetraSpineCol.cpp (100)
A src/dev/btietz/tetraCollisions/CMakeLists.txt (26)
A src/dev/btietz/tetraCollisions/TetraSpineCollisions.cpp (317)
A src/dev/btietz/tetraCollisions/TetraSpineCollisions.h (60)
A src/dev/btietz/tetraCollisions/colSpineSine.cpp (210)
A src/dev/btietz/tetraCollisions/colSpineSine.h (69)
A src/dev/btietz/tetraCollisions/controlVars.json (14)
A src/dev/muscleNP/CMakeLists.txt (16)
A src/dev/muscleNP/MuscleNP.cpp (858)
A src/dev/muscleNP/MuscleNP.h (262)
A src/dev/muscleNP/tgGhostInfo.cpp (125)
A src/dev/muscleNP/tgGhostInfo.h (135)
A src/dev/muscleNP/tgGhostModel.cpp (71)
A src/dev/muscleNP/tgGhostModel.h (81)
A src/dev/muscleNP/tgMultiPointStringInfo.cpp (133)
A src/dev/muscleNP/tgMultiPointStringInfo.h (93)
M src/examples/learningSpines/TetrahedralComplex/AppFlemonsSpineLearning.cpp (5)
M src/examples/learningSpines/tgCPGStringControl.cpp (1)
M src/inc.CMakeBullet.txt (4)
M src/tgcreator/tgBoxInfo.cpp (8)
M src/tgcreator/tgBoxInfo.h (2)
M src/tgcreator/tgCompoundRigidInfo.cpp (33)
M src/tgcreator/tgCompoundRigidInfo.h (40)
M src/tgcreator/tgRigidAutoCompound.cpp (4)
M src/tgcreator/tgRigidAutoCompound.h (3)
M src/tgcreator/tgRigidInfo.cpp (17)
M src/tgcreator/tgRigidInfo.h (68)
M src/tgcreator/tgRodInfo.cpp (8)
M src/tgcreator/tgSphereInfo.cpp (10)
M src/tgcreator/tgStructureInfo.cpp (2)
M src/tgcreator/tgUtil.h (43)
Patch Links:

https://github.com/NASA-Tensegrity-Robotics-Toolkit/NTRTsim/pull/99.patch
https://github.com/NASA-Tensegrity-Robotics-Toolkit/NTRTsim/pull/99.diff

Reply to this email directly or view it on GitHub.


Vytas SunSpiral
Dynamic Tensegrity Robotics Lab
cell- 510-847-4600
Office: 650-604-4363
N269 Rm. 100

Stinger Ghaffarian Technologies
Intelligent Robotics Group
NASA Ames Research Center

I will not tiptoe cautiously through life only to
arrive safely at death.

@PerryBhandal
Copy link
Member

Brian,
Are there any areas which you think are most likely to contain errors? Given the scope of the changes, looking at every single change isn't practical for me time wise. That said, if there are some areas where an extra set of eyes would help in review please let me know.

@axydes
Copy link
Contributor

axydes commented Nov 19, 2014

  1. c) The two ghost object construction classes (mostly tgGhostInfo) were
    used as an inspiration for DuCTT's ghost object classes but are not used
    directly. They might be useful to keep as inspiration for others as well.
    But I have no issue getting rid of them since DuCTT doesn't use them.

Alexander Xydes

On Tue, Nov 18, 2014 at 5:27 PM, Perry Bhandal notifications@github.com
wrote:

Brian,
Are there any areas which you think are most likely to contain errors?
Given the scope of the changes, looking at every single change isn't
practical for me time wise. That said, if there are some areas where an
extra set of eyes would help in review please let me know.


Reply to this email directly or view it on GitHub
#99 (comment)
.

@brtietz
Copy link
Contributor Author

brtietz commented Nov 19, 2014

@PerryBhandal I think the most likely errors are covered in issues #100 and #101. The other big question I'd like input on is whether or not we include btQuickProfiler by default. The effects of that are pretty obvious if you run any app.

Finally - to make my vague references to "special cases" more clear, I'd appreciate some help brainstorming a robust way to maintain and place contacts. Right now the method I'm using vigorously deletes existing anchors if the permanent anchors cross the string, limiting our ability to wrap around objects (see this situation, where I move the rod slightly to the left of the last video I sent around: http://youtu.be/Wyl2-cowmN0). I don't expect a typical tensegrity to encounter this situation, but we can do a lot more if the code can handle it. Integrating with Corde would also help handle this, but is more effort that I have time for right now.

@brtietz
Copy link
Contributor Author

brtietz commented Nov 24, 2014

I'm ready to merge this in. If anyone has further review they would like to do, or would rather wait until we transition to double precision for a little while longer, let me know by the morning.

brtietz added a commit that referenced this pull request Nov 26, 2014
Merging in MuscleNP, new muscle constructors and examples. This closes #96

Note the following about this merge:

1) The simulator is now running at double precision by default. We recommend migrating, as it increases simulator accuracy for a minor increase in memory usage (see: #100). In order to migrate you need to do one of the following:

a) delete your env and build directories and re-run setup.sh, followed by a clean build (bin/build.sh)

b) Rebuild bullet at double precision (cd to the bullet directory: env/build/bullet, run "ccmake .", turn double precision on, generate new cmake files, run make install), then do the same thing to NTRT (ccmake build, toggle option on and generate, run bin/build.sh)

2) The order of the parameters in tgBaseString::config has changed. The third parameter is now pretension, in units of force, to allow pretension in cables without a controller. Rotation has been moved to the end, history is fourth, and everything else has been left unchanged. If your code was in master, I've updated it for you. If you were just specifying stiffness and damping you don't need to do anything, but otherwise check tgBaseString::config and make sure everything is as you expect.

There's a new example of the 3 bar prism (3_prism_no_control) showing how to use this new pretension parameter.

Finally - there's a new cable model in dev - MuscleNP, which includes contact dynamics. There's several examples of its use in my dev directory (btietz), the most interesting of which is TCContact, which demonstrates their use on hilly terrain. Changing your models to use contact dynamics is just a matter of using dev/tgMultiPointStringInfo instead of tgLinearStringInfo, so it should be easy to play with. Its still in beta, so let me know if you find bugs (or post them to github).
@brtietz brtietz merged commit 86f08a7 into master Nov 26, 2014
@brtietz brtietz deleted the MuscleNP branch November 26, 2014 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants