Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Removed extra -1 y,z multiplier for static links #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IanTheEngineer
Copy link

As I integrated the realsense static transforms with our system, I noticed there were a few unnecessary -1 multipliers in this driver for the camera extrinsic frames read from each realsense. When I overlaid them with the URDF, it became more obvious the -1's needed to go. The following are screenshots of the corrected static TF's read and published from a live realsense D415 camera (I also tested with a D435 and D435i and found these changes to work for all three models):

Front View:
fixed_frame_front

Top View with Frame Names:
fixed_tf_realsense

@IanTheEngineer
Copy link
Author

Just a follow-on comment: I suspect a similar issue is occurring in the refactor branch when calculating the camera frame translations -
https://github.com/intel/ros2_intel_realsense/blob/refactor/realsense_ros/src/rs_base.cpp#L283-L285

void RealSenseBase::composeTFMsgAndPublish()
...
  geometry_msgs::msg::TransformStamped msg;
  RCLCPP_DEBUG(node_.get_logger(), "Publish Static TF from %s to %s", from.c_str(), to.c_str());
  msg.header.stamp = t;
  msg.header.frame_id = from;
  msg.child_frame_id = to;
  msg.transform.translation.x = translation.z;
  msg.transform.translation.y = -translation.x;      // <--- here
  msg.transform.translation.z = -translation.y;      // <--- and here
  msg.transform.rotation.x = q.getX();
  msg.transform.rotation.y = q.getY();
  msg.transform.rotation.z = q.getZ();
  msg.transform.rotation.w = q.getW();
  static_tf_broadcaster_-> sendTransform(msg);

The translation frames read from the realsense camera device already have the correct sign.

@ahuizxc
Copy link
Contributor

ahuizxc commented Nov 18, 2019

Just a follow-on comment: I suspect a similar issue is occurring in the refactor branch when calculating the camera frame translations -
https://github.com/intel/ros2_intel_realsense/blob/refactor/realsense_ros/src/rs_base.cpp#L283-L285

void RealSenseBase::composeTFMsgAndPublish()
...
  geometry_msgs::msg::TransformStamped msg;
  RCLCPP_DEBUG(node_.get_logger(), "Publish Static TF from %s to %s", from.c_str(), to.c_str());
  msg.header.stamp = t;
  msg.header.frame_id = from;
  msg.child_frame_id = to;
  msg.transform.translation.x = translation.z;
  msg.transform.translation.y = -translation.x;      // <--- here
  msg.transform.translation.z = -translation.y;      // <--- and here
  msg.transform.rotation.x = q.getX();
  msg.transform.rotation.y = q.getY();
  msg.transform.rotation.z = q.getZ();
  msg.transform.rotation.w = q.getW();
  static_tf_broadcaster_-> sendTransform(msg);

The translation frames read from the realsense camera device already have the correct sign.

Hi Ian,The reason we do this is consistent with the ros version.
See here:
https://github.com/IntelRealSense/realsense-ros/blob/5190897d906a51d9bda437d8afe7d361102e5171/realsense2_camera/src/base_realsense_node.cpp#L1822

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants