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

fix imu topic frame_id with came_name ns #2680

Conversation

brsbilgin
Copy link

@brsbilgin brsbilgin commented Apr 2, 2023

The imu topic frame was published with default name space which is "camera" even i gave different name to the camera_name parameter. The frame name was always "camera_imu_optical_frame" never changed according the camera_name

@Nir-Az Nir-Az mentioned this pull request Apr 10, 2023
@SamerKhshiboun
Copy link
Collaborator

SamerKhshiboun commented Apr 10, 2023

Hi @brsbilgin

I think that the current code is behaving as expected, and no need for these changes
The camera name is working good, as also the axes both in ROS CS and in Optical CS.
with PR #2684 applied (should be merged soon), these are the screenshots from rviz2 after running with D435i:

ros2 launch realsense2_camera rs_launch.py camera_name:=test_name enable_accel:=true enable_gyro:=true unite_imu_method:=2

image
image

@@ -59,8 +59,8 @@ using realsense2_camera_msgs::msg::Extrinsics;
using realsense2_camera_msgs::msg::IMUInfo;

#define FRAME_ID(sip) (static_cast<std::ostringstream&&>(std::ostringstream() << _camera_name << "_" << STREAM_NAME(sip) << "_frame")).str()
#define IMU_FRAME_ID (static_cast<std::ostringstream&&>(std::ostringstream() << _camera_name << "_imu_frame")).str()
#define IMU_OPTICAL_FRAME_ID (static_cast<std::ostringstream&&>(std::ostringstream() << _camera_name << "_imu_optical_frame")).str()
#define IMU_FRAME_ID (static_cast<std::ostringstream&&>(std::ostringstream() << _camera_name << "_" << "imu_frame")).str()
Copy link
Collaborator

Choose a reason for hiding this comment

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

already working good.
why to split "_" from the rest of the const string ?

imu_msg.angular_velocity.x = gyro_data.m_data.x();
imu_msg.angular_velocity.y = gyro_data.m_data.y();
imu_msg.angular_velocity.z = gyro_data.m_data.z();
imu_msg.angular_velocity.x = -gyro_data.m_data.z();
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to swap axes, these gyro frame is in ROS CS, and IMU frame should be in same coordinates.
this is not the optical one, which we publish later in other function.

@SamerKhshiboun
Copy link
Collaborator

Closing this PR.
See #2684 for more details

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