Extend-Robotics / photoneo-cpp-examples

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ColorCameraExtrinsicsToROS tool #3

Closed bmegli closed 1 year ago

bmegli commented 1 year ago

Overview

Small tool to dump color camera / depth extrinsics in ROS compatible format.

It generates small launchfile with static_transform_publisher

Note

Note that this is different from device computed color texture

Usage

Typical

./ColorCameraExtrinsicsToROS > MyColorCameraRangeExtrinsics.launch

Then you would include/run generated launchfile.

roslaunch ./MyColorCameraRangeExtrinsics.launch

Sample output

<?xml version="1.0" encoding="utf-8"?>

<!--
# Device: 0
#  Name:                    MotionCam-3D-TRD-058
#  Hardware Identification: TRD-058
#  Type:                    MotionCam-3D
#  Firmware version:        1.10.1
#  Variant:                 M+
#  IsFileCamera:            No
#  Feature-Alpha:           No
#  Feature-Color:           Yes
#  Status:                  Attached to PhoXi Control. Ready to connect

# Device: 1
#  Name:                    basic-example
#  Hardware Identification: InstalledExamples-basic-example
#  Type:                    PhoXi3DScan
#  Firmware version:        
#  Variant:                 
#  IsFileCamera:            Yes
#  Feature-Alpha:           No
#  Feature-Color:           No
#  Status:                  Not Attached to PhoXi Control. Ready to connect

# Device: 2
#  Name:                    color-example
#  Hardware Identification: InstalledExamples-color-example
#  Type:                    MotionCam-3D
#  Firmware version:        
#  Variant:                 
#  IsFileCamera:            Yes
#  Feature-Alpha:           No
#  Feature-Color:           Yes
#  Status:                  Not Attached to PhoXi Control. Ready to connect

# You have already PhoXi device opened in PhoXi Control, the API Example is connected to device: TRD-058

# ColorCameraImage (raw RGB, this is not depth aligned RGB texture!)
# ColorCameraScale: 0.5x0.5

# 3D sensor should be [0,0,0] with identity rotation (frame of reference)
# otherwise this tool will not generate correct extrinsics
# 3D sensor position: [0; 0; 0]
# 3D sensor X axis: [1; 0; 0]
# 3D sensor Y axis: [0; 1; 0]
# 3D sensor Z axis: [0; 0; 1]

# color camera position: [-285.575; 0.348021; -2.64781]
# color camera X axis: [0.999758; -0.021911; -0.00175325]
# color camera Y axis: [0.0219171; 0.999753; 0.00358584]
# color camera Z axis: [0.00167425; -0.0036234; 0.999992]
-->
<launch>
  <node pkg="tf2_ros" type="static_transform_publisher" name="range_color_camera_link_broadcaster" args="-0.285575 0.000348021 -0.00264781 0.00180242 0.000856928 -0.0109577 0.999938 range_optical_frame color_camera_optical_frame" />
</launch>

Visual Example

roslaunch ./MyColorCameraRangeExtrinsics.launch
  1. rviz -> Add -> TF
  2. Fixed Frame -> range_optical_frame

image

Implementation Note

It might be better to implement it by pulling global calibration data with extrinsics for raw ColorCamera.

With current implementation we depend on: