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

ForceTorqueSensor: add API for newest measurement #449

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

scpeters
Copy link
Member

🎉 New feature

Needed for gazebosim/gz-sim#2268 and gazebosim/gz-sim#2391.

Summary

Currently the wrench data published by gz-transport is not available via the C++ API. This pull request adds an accessor to the most recent Wrench message that is identical to that published on gz-transport.

Test it

Build and run bin/INTEGRATION_force_torque

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

This allows the most recent Wrench message to be
accessed via the API instead of only via gz-transport.

Signed-off-by: Steve Peters <[email protected]>
@@ -247,7 +250,7 @@ bool ForceTorqueSensor::Update(const std::chrono::steady_clock::duration &_now)
applyNoise(TORQUE_Y_NOISE_N_M, measuredTorque.Y());
applyNoise(TORQUE_Z_NOISE_N_M, measuredTorque.Z());

msgs::Wrench msg;
msgs::Wrench &msg = this->dataPtr->measuredWrench;
*msg.mutable_header()->mutable_stamp() = msgs::Convert(_now);
auto frame = msg.mutable_header()->add_data();
Copy link
Member Author

Choose a reason for hiding this comment

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

there is an issue here; working on a fix

Copy link
Member Author

Choose a reason for hiding this comment

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

it was adding a new key-value pair for the "frame_id" to the header map at every timestep. I've changed it in 738a9da to allocate the key-value pair in the constructor and update it at each timestep instead

Allocate the key-value pair in the constructor and update
it for each measurement.

Signed-off-by: Steve Peters <[email protected]>
@azeey
Copy link
Contributor

azeey commented Jul 22, 2024

cc @bperseghetti

@scpeters scpeters merged commit fdf8e02 into main Jul 29, 2024
8 checks passed
@scpeters scpeters deleted the scpeters/force_torque_measured_wrench_api branch July 29, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants