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

Auto generated model. #89

Merged
merged 57 commits into from
Jan 6, 2022
Merged

Auto generated model. #89

merged 57 commits into from
Jan 6, 2022

Conversation

arjo129
Copy link
Member

@arjo129 arjo129 commented Nov 22, 2021

This PR adds a script which creates an automatically generated model and some tests. The script parses the XML and calculates the appropriate center of mass and buoyancy volumes based on the constraints given.

How the script works

The script reads an SDF-like file with the poses of individual links and computes their moments. It then calculates the correct position of the center of mass of the vehicle and applies this to the link whose inertial pose is marked with @calculated along with the appropriate mass.

Finally for any link whose collision volume that has been marked as @neutral_buoyancy the system will write the link to have neutral buoyancy.

Requires upstream: gazebosim/gz-sim#1211

Things to look out for in this PR.

Without #96 I expect most of the tests to fail except for the newly added tests which test the hydro-static stability of the vehicle. The newly FlatWorld tests assert that the vehicle is neutrally buoyant so it doesn't move any where to start of. There are no inherent oscillations. The TiltedWorld test asserts that the vehicle when placed in a certain pitch will oscillate without hydrodynamics to damp it. The maximum of this oscillation should be its starting pitch. Both these tests only check the buoyancy of the vehicle and no hydrodynamics.

Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
@tfoote tfoote self-requested a review November 23, 2021 02:21
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129 arjo129 mentioned this pull request Nov 25, 2021
28 tasks
arjo129 added a commit that referenced this pull request Dec 21, 2021
This  PR depends on #89, #96.

Recommended review order is #89 > #96 > this PR. If we want I can cherry pick this branch as the changes are independent of the underlying code. The merge order should be this PR > #96 > #89.

There is a slight change in the center of rotation of the yoyo mission with #96. This leads to test expectations failing. Rather than use position to check whether the vehicle is yoyoing, I think we should use @tfoote's suggestion and use yaw rate which makes the test independent of the center of rotation and hence more robust while at the same time ensuring that the vehicle actually moves in a circle.

Signed-off-by: Arjo Chakravarty <[email protected]>
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

The smaller collisions look really strange

PR89_coll

I know they're calculated in a way to achieve stability, but shouldn't they at least be reasonably placed and scaled? If we're going with whatever brings stability, I'd recommend we just get rid of these small collisions and rely on just one or two large collisions for buoyancy.

I also noticed that the battery's CoM seems to be way forward now, outside the battery itself:

PR89_com

lrauv_description/CMakeLists.txt Outdated Show resolved Hide resolved
lrauv_description/test/test_hydrostatic_stability.cc Outdated Show resolved Hide resolved
<joint_name>battery_joint</joint_name>
<use_velocity_commands>true</use_velocity_commands>
<cmd_max>0.0007</cmd_max>
</plugin>
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment explaining why we're loading only these plugins instead of loading tethys_equipped?

We should also consider putting these into a new model. Right now the plugins are duplicated on the 2 world files and on tethys_equipped - it will be hard to keep them all in sync.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a unit test for the vehicle's hydrostatics I am not interested in the hydrodynamics. We could alternativelyu create a tethys_hydrostatic model which the tethys_equipped model will inherit in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we document that on the file? It's not immediately obvious to a reader why DetachableJoint and JointPositionController are needed for hydrostatics.

We could alternativelyu create a tethys_hydrostatic model which the tethys_equipped model will inherit in the future.

+1, I like the idea of incrementally building the model, ticketed #131.

lrauv_ignition_plugins/worlds/buoyant_tethys.sdf Outdated Show resolved Hide resolved
lrauv_description/test/test_hydrostatic_stability.cc Outdated Show resolved Hide resolved
prev_pose = pose;
}

// Since we start the system at 0.08 pitch, we should not exceed this.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check minPitch too?

It would also be interesting to check that the vehicle is actually bouncing up and down, because the current test would also pass if the amplitude is decreasing (which shouldn't happen because we don't have hydrodynamics loaded), or even if the vehicle were stopped in place. I'm not sure what the quickest way of testing this would be, maybe checking that the pitch rate keeps going up and down?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good point. I think we should ticket this so it can be revisited. I'm not sure if minPitch is the best way to go or something else. We should check for oscillations and amplitude of the oscillations.

lrauv_description/test/test_hydrostatic_stability.cc Outdated Show resolved Hide resolved
@arjo129
Copy link
Member Author

arjo129 commented Dec 22, 2021 via email

chapulina pushed a commit that referenced this pull request Jan 5, 2022
This  PR depends on #89, #96.

Recommended review order is #89 > #96 > this PR. If we want I can cherry pick this branch as the changes are independent of the underlying code. The merge order should be this PR > #96 > #89.

There is a slight change in the center of rotation of the yoyo mission with #96. This leads to test expectations failing. Rather than use position to check whether the vehicle is yoyoing, I think we should use @tfoote's suggestion and use yaw rate which makes the test independent of the center of rotation and hence more robust while at the same time ensuring that the vehicle actually moves in a circle.

Signed-off-by: Arjo Chakravarty <[email protected]>
chapulina added a commit that referenced this pull request Jan 6, 2022
…o main) (#133)

* bump depth expectations

Signed-off-by: Arjo Chakravarty <[email protected]>

* Check yaw rates instead of positions when yoyoing

This  PR depends on #89, #96.

Recommended review order is #89 > #96 > this PR. If we want I can cherry pick this branch as the changes are independent of the underlying code. The merge order should be this PR > #96 > #89.

There is a slight change in the center of rotation of the yoyo mission with #96. This leads to test expectations failing. Rather than use position to check whether the vehicle is yoyoing, I think we should use @tfoote's suggestion and use yaw rate which makes the test independent of the center of rotation and hence more robust while at the same time ensuring that the vehicle actually moves in a circle.

Signed-off-by: Arjo Chakravarty <[email protected]>

* remove unused variable

Signed-off-by: Arjo Chakravarty <[email protected]>

* Fix tolerances. :man-facepalming:

Signed-off-by: Arjo Chakravarty <[email protected]>

* increase ramp up time

Signed-off-by: Arjo Chakravarty <[email protected]>

* Fix bad merge and increase tolerance

Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Arjo Chakravarty <[email protected]>
@chapulina
Copy link
Contributor

I'm close to approving this. Just checking if you missed these 2 comments, @arjo129:

@arjo129
Copy link
Member Author

arjo129 commented Jan 6, 2022

Thanks a lot I've addressed the feedback from those two.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Let's get it in, thanks for the patience! 🚀

@arjo129 arjo129 merged commit 41b2419 into main Jan 6, 2022
@arjo129 arjo129 deleted the arjo/autogenerated_model branch January 6, 2022 06:36
@caguero caguero mentioned this pull request Nov 2, 2021
40 tasks
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.

Automated hydrostatic stability. Investigate weird oscillation in main
4 participants