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

Write tests for forcetorque plugin #20

Closed
traversaro opened this issue Aug 8, 2023 · 5 comments · Fixed by #30
Closed

Write tests for forcetorque plugin #20

traversaro opened this issue Aug 8, 2023 · 5 comments · Fixed by #30

Comments

@traversaro
Copy link
Member

Example for gazebo-classic: https://github.com/robotology/gazebo-yarp-plugins/tree/master/tests .

In general, we need to understand if we want to launch gz-sim as a library, or as an executable .

@traversaro traversaro changed the title Write tests for plugins Write tests for forcetorque plugin Aug 8, 2023
@traversaro
Copy link
Member Author

We can also check if somebody replies here: https://discord.com/channels/1077825543698927656/1080763334384697430/1138404740905046076 with useful pointers.

@traversaro
Copy link
Member Author

traversaro commented Aug 8, 2023

To launch gz-sim as a library, a possible example is https://github.com/gazebosim/gz-sim/tree/gz-sim7/examples/standalone/custom_server .

See also the test for the FT system in gazebo itself: https://github.com/gazebosim/gz-sim/blob/gz-sim7/test/integration/force_torque_system.cc#L48 .

@traversaro
Copy link
Member Author

traversaro commented Aug 8, 2023

I found some related material: https://gazebosim.org/api/sim/7/test_fixture.html and https://github.com/gazebosim/gz-sim/tree/gz-sim7/examples/standalone/gtest_setup . In particular the example shows also how to integrate with googletest, so probably it is a good starting point!

@lucapa17
Copy link
Contributor

lucapa17 commented Aug 9, 2023

@traversaro
For the moment we have done this 5589283.
We used gz::sim::TestFixture. The test simply compares the values coming from the yarp port and the expected values (e.g. forceZ must be equal to -9.8*10).
We don't know if it is a correct idea or if we should consider something else.

@traversaro
Copy link
Member Author

Nice start! The test is passing fine on your machines? Can you open a PR so that we can see if the test is passing fine also in the CI?

Probably a possible improvement is not directly read the port, but read it through the multipleanalogsensorsclient device. For an example of how to read the data via the multipleanalogsensorsclient , check the code in robotology/yarp#2881 (comment) (just the first section, the second section will only be usable once that PR is merged and released).

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 a pull request may close this issue.

2 participants