Skip to content

Add imu assembly error publisher#217

Closed
CQin-Cat wants to merge 2 commits into
rm-controls:masterfrom
CQin-Cat:feature/AssemblyErrorPub
Closed

Add imu assembly error publisher#217
CQin-Cat wants to merge 2 commits into
rm-controls:masterfrom
CQin-Cat:feature/AssemblyErrorPub

Conversation

@CQin-Cat

Copy link
Copy Markdown

Add AssemblyErrorPub to calculate and publish IMU roll and pitch assembly errors. This function accurately publishes the assembly error if and only if the yaw offset is an integer multiple of 90 degrees.

Copilot AI review requested due to automatic review settings July 18, 2026 06:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an IMU assembly error publisher to the orientation controller so roll/pitch (and derived yaw component) assembly errors can be computed from TF and published on a dedicated topic.

Changes:

  • Initialize a realtime publisher for rm_msgs::AssemblyErrorData on imu_assembly_error.
  • Call a new publishing routine from the controller update loop to compute/publish assembly error.
  • Extend the controller header with new includes, method declaration, and state members for publishing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
rm_orientation_controller/src/orientation_controller.cpp Adds publisher initialization, update-loop call, and the AssemblyErrorPub computation/publish implementation.
rm_orientation_controller/include/rm_orientation_controller/orientation_controller.h Declares the new publisher, loop counter, and AssemblyErrorPub method; adds required message/publisher includes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +108 to +111
catch (tf2::TransformException& ex)
{
ROS_WARN("%s", ex.what());
}
Comment on lines +115 to +118
tf2::Matrix3x3(target2imu.getRotation()).getRPY(roll_imu, pitch_imu, yaw_imu);
roll_imu = std::round(roll_imu / (M_PI / 2));
pitch_imu = std::round(pitch_imu / (M_PI / 2));
yaw_imu = std::round(yaw_imu / (M_PI / 2));
Comment on lines +126 to +130
error_eigen << roll_error, pitch_error, 0.0;
assembly_error_eigen = R_eigen.transpose() * error_eigen;
if (loop_count_ % 100 == 0)
{
if (assembly_error_pub_->trylock())
bool getTransform(const ros::Time& time, geometry_msgs::TransformStamped& source2target, const double x,
const double y, const double z, const double w);
void imuDataCallback(const sensor_msgs::Imu::ConstPtr& msg);
void AssemblyErrorPub(const ros::Time& time);
@CQin-Cat

Copy link
Copy Markdown
Author

I've added the required AssemblyErrorData.msg in the corresponding rm_control PR. I'd appreciate it if the PR could be reviewed and merged soon.

@CQin-Cat CQin-Cat closed this Jul 25, 2026
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.

2 participants