This repository contains the ROS 2 interface for Mech-Eye Industrial 3D Camera.
Ubuntu 20.04 and ROS Humble have been tested to work with this interface.
| Package | Version |
|---|---|
| OpenCV | >= 3 |
| PCL | >= 1.8 |
| Mech-Eye API | latest |
If you have installed 'ros-humble-desktop' successfully, run the following commands to install the dependencies.
sudo apt install libopencv-dev
sudo apt install ros-humble-cv-bridge
sudo apt install libpcl-dev
sudo apt install ros-humble-pcl-conversions
sudo apt install python3-colcon-common-extensionsDownload Mech-Eye API from Mech-Mind's website and install it with sudo apt.
Clone and compile the interface with the following commands:
mkdir -p ~/colcon_ws/src && cd ~/colcon_ws/src
git clone https://github.com/MechMindRobotics/mecheye_ros2_interface.git
cd ~/colcon_ws
colcon build-
Source the build workspace and run the interface:
source ~/colcon_ws/install/setup.bash ros2 run mecheye_ros_interface start
-
Enter the index number of the camera to which you want to connect, and press the Enter key.
-
Open a new terminal, source the workspace and invoke a service:
source ~/colcon_ws/install/setup.bash ros2 service call [/service_name] [mecheye_ros_interface/srv/ServiceName] "{parameter_name: parameter_value}"
Note: For code examples of each service, check the "Services" section below.
- Interface functions are described in the online documentation Mech-Eye API Reference.
- Change the following configurations in
~/colcon_ws/src/mecheye_ros2_interface/src/MechMindCamera.cppaccording to your needs:save_filein line 18: To enable file saving to the designated path, change the value totrue.Note: You can change the paths for file saving in
/mecheye_ros2_interface/src/MechMindCamera.cpp.camera_ipin line 17: Assign the IP address of your camera as the value to this parameter.Note: To connect to a camera by its IP address, you also need to uncomment lines 44 to 55, and comment lines 39 to 40 and lines 57 to 59.
Note: Remember to run
colcon buildagain after making changes toMechMindCamera.hand*.cpp.
Camera calibration and metadata.
Color image encoded as "bgr8".
Depth image encoded as 32-bit float.
Point cloud data.
Textured point cloud data.
Invoke this service to add a parameter group. The newly added parameter group is automatically selected as the current parameter group.
This service has one parameter:
value(string): the name of the parameter group to be added.
Example: add a parameter group named "123"
ros2 service call /add_user_set mecheye_ros_interface/srv/AddUserSet "{value: '123'}"# Parameter group names that consist of numbers only must be surrounded with single quotation marks.Invoke this service to obtain a 2D image.
Example:
ros2 service call /capture_color_map mecheye_ros_interface/srv/CaptureColorMapInvoke this service to obtain a textured point cloud.
Example:
ros2 service call /capture_color_point_cloud mecheye_ros_interface/srv/CaptureColorPointCloudInvoke this service to obtain a depth map.
Example:
ros2 service call /capture_depth_map mecheye_ros_interface/srv/CaptureDepthMapInvoke this service to obtain an untextured point cloud.
Example:
ros2 service call /capture_point_cloud mecheye_ros_interface/srv/CapturePointCloudInvoke this service to delete the specified parameter group.
This service has one parameter:
value(string): the name of the parameter group to be deleted.
Example: delete the parameter group named "123"
ros2 service call /delete_user_set mecheye_ros_interface/srv/DeleteUserSet "{value: 123}"Invoke this service to print the following information of the currently connected camera:
- Model
- Serial number (ID)
- Hardware version
- Firmware version
- IP address
- Port
Example:
ros2 service call /device_info mecheye_ros_interface/srv/DeviceInfoInvoke this service to obtain the current ExpectedGrayValue value.
Example:
ros2 service call /get_2d_expected_gray_value mecheye_ros_interface/srv/Get2DExpectedGrayValueInvoke this service to obtain the current Scan2DExposureMode value.
Example:
ros2 service call /get_2d_exposure_mode mecheye_ros_interface/srv/Get2DExposureModeInvoke this service to obtain the current HDRExposureSequence value.
Example:
ros2 service call /get_2d_exposure_sequence mecheye_ros_interface/srv/Get2DExposureSequenceInvoke this service to obtain the current 2D ExposureTime value.
Example:
ros2 service call /get_2d_exposure_time mecheye_ros_interface/srv/Get2DExposureTimeInvoke this service to obtain the current Scan2DROI values.
Example:
ros2 service call /get_2d_roi mecheye_ros_interface/srv/Get2DROIInvoke this service to obtain the current SharpenFactor value.
Example:
ros2 service call /get_2d_sharpen_factor mecheye_ros_interface/srv/Get2DSharpenFactorInvoke this service to obtain the current ToneMappingEnable value.
Example:
ros2 service call /get_2d_tone_mapping mecheye_ros_interface/srv/Get2DToneMappingEnableInvoke this service to get the current 3D ExposureSequence values.
Example:
ros2 service call /get_3d_exposure mecheye_ros_interface/srv/Get3DExposureInvoke this service to obtain the current Gain value.
Example:
ros2 service call /get_3d_gain mecheye_ros_interface/srv/Get3DGainInvoke this service to obtain the current Scan3DROI values.
Example:
ros2 service call /get_3d_roi mecheye_ros_interface/srv/Get3DROIInvoke this service to obtain the names of all available parameter groups.
Example:
ros2 service call /get_all_user_sets mecheye_ros_interface/srv/GetAllUserSetsInvoke this service to get the current CloudOutlierFilterMode value.
Example:
ros2 service call /get_cloud_outlier_filter_mode mecheye_ros_interface/srv/GetCloudOutlierFilterModeInvoke this service to get the current CloudSmoothMode value.
Example:
ros2 service call /get_cloud_smooth_mode mecheye_ros_interface/srv/GetCloudSmoothModeInvoke this service to obtain the name of the currently selected parameter group.
Example:
ros2 service call /get_current_user_set mecheye_ros_interface/srv/GetCurrentUserSetInvoke this service to obtain the current DepthRange value.
Example:
ros2 service call /get_depth_range mecheye_ros_interface/srv/GetDepthRangeInvoke this service to obtain the current FringeContrastThreshold value.
Example:
ros2 service call /get_fringe_contrast_threshold mecheye_ros_interface/srv/GetFringeContrastThresholdInvoke this service to obtain the current FringeMinThreshold value.
Example:
ros2 service call /get_fringe_min_threshold mecheye_ros_interface/srv/GetFringeMinThresholdInvoke this service to obtain the current laser camera settings.
Note: This service is only available for a laser camera.
Example:
ros2 service call /get_laser_settings mecheye_ros_interface/srv/GetLaserSettingsInvoke this service to obtain the current AntiFlickerMode value.
Note: This service is only available for PRO (V4), PRO M (V4), NANO (V4), and Nano (V3).
Example:
ros2 service call /get_projector_anti_flicker_mode mecheye_ros_interface/srv/GetProjectorAntiFlickerModeInvoke this service to obtain the current FringeCodingMode value.
Note: This service is only available for PRO S (V4), PRO M (V4), Nano (V3), and Pro XS (V3).
Example:
ros2 service call /get_projector_fringe_coding_mode mecheye_ros_interface/srv/GetProjectorFringeCodingModeInvoke this service to obtain the current powerLevel value.
Note: This service is only available for DLP cameras, excluding Deep (V3) and Pro L Enhanced (V3).
Example:
ros2 service call /get_projector_power_level mecheye_ros_interface/srv/GetProjectorPowerLevelInvoke this service to obtain the current UHP camera settings.
Note: This service is only available for the UHP series.
Example:
ros2 service call /get_uhp_settings mecheye_ros_interface/srv/GetUhpSettingsInvoke this service to obtain the current UhpCaptureMode value.
Note: This service is only available for the UHP series.
Example:
ros2 service call /get_uhp_capture_mode mecheye_ros_interface/srv/GetUhpCaptureModeInvoke this service to obtain the current UhpFringeCodingMode value.
Note: This service is only available for the UHP series.
Example:
ros2 service call /get_uhp_fringe_coding_mode mecheye_ros_interface/srv/GetUhpFringeCodingModeInvoke this service to set the value of ExpectedGrayValue value.
Note:
ExpectedGrayValueonly takes effect whenScan2DExposureModeis set toAuto.
This service has one parameter:
value(int32): theExpectedGrayValuevalue to be set. The value range is 0–255.
Example: set the value of ExpectedGrayValue to 20
ros2 service call /set_2d_expected_gray_value mecheye_ros_interface/srv/Set2DExpectedGrayValue "{value: 20}"Invoke this service to set the value of Scan2DExposureMode.
This service has one parameter:
value(string): theScan2DExposureModevalue to be set. Values include "Timed", "Auto", "HDR", and "Flash".
Example: set the value of Scan2DExposureMode to "HDR"
ros2 service call /set_2d_exposure_mode mecheye_ros_interface/srv/Set2DExposureMode "{value: HDR}"Invoke this service to set the value of HDRExposureSequence.
Note:
HDRExposureSequenceonly takes effect whenScan2DExposureModeis set toHDR.
This service has one parameter:
sequence(float64[]): theHDRExposureSequencevalues to be set.- Value range: 0.1–999.0
- Number of elements in the sequence: 1–5
Example: set the values of HDRExposureSequence to 30.0, 35.5, and 40.0
ros2 service call /set_2d_exposure_sequence mecheye_ros_interface/srv/Set2DExposureSequence "{sequence: [30.0,35.5,40.0]}"Invoke this service to set the value of 2D ExposureTime.
Note: 2D
ExposureTimeonly takes effect whenScan2DExposureModeis set toTimed.
This service has one parameter:
value(float64): the 2DExposureTimevalue to be set. The value range is 0.1–999.0.
Example: set the values of 2D ExposureTime to 35.5
ros2 service call /set_2d_exposure_time mecheye_ros_interface/srv/Set2DExposureTime "{value: 35.5}"Invoke this service to obtain the values of Scan2DROI.
Note:
Scan2DROIonly takes effect whenScan2DExposureModeis set toAuto.
This service has four parameters:
x(uint32): the x coordinate of the upper-left corner of the auto-exposure ROI.y(uint32): the y coordinate of the upper-left corner of the auto-exposure ROI.width(uint32): the width of the auto-exposure ROI.height(uint32): the height of the auto-exposure ROI.
Example: set the values of 2D Scan2DROI to 20, 20 , 600, and 800
ros2 service call /set_2d_roi mecheye_ros_interface/srv/Set2DROI "{x: 20, y: 20, width: 600, height: 800}"Invoke this service to set the value of SharpenFactor.
This service has one parameter:
value(float64): theSharpenFactorvalue to be set. The value range is 0.0–5.0.
Example: set the value of SharpenFactor to 0.5
ros2 service call /set_2d_sharpen_factor mecheye_ros_interface/srv/Set2DSharpenFactor "{value: 0.5}"Invoke this service to set the value of ToneMappingEnable.
This service has one parameter:
value(bool): theToneMappingEnablevalue to be set.
Example: set the value of ToneMappingEnable to True
ros2 service call /set_2d_tone_mapping mecheye_ros_interface/srv/Set2DToneMappingEnable "{value: True}"Invoke this service to set the value of 3D ExposureSequence.
This service has one parameter:
sequence(float64[]): the 3DExposureSequencevalues to be set.- Value range: 0.1–99.0
- Number of elements in the sequence: 1–3
Example: set the values of 3D ExposureSequence to 30.0, 35.5, and 40.0
ros2 service call /set_3d_exposure mecheye_ros_interface/srv/Set3DExposure "{sequence: [30.0,35.5,40.0]}"Invoke this service to set the value of Gain.
This service has one parameter:
value(float64): theGainvalue to be set. The value range is 0.0–16.0.
Example: set the value of Gain to 2.5
ros2 service call /set_3d_gain mecheye_ros_interface/srv/Set3DGain "{value: 2.5}"Invoke this service to set the value of Scan3DROI.
This service has four parameters:
x(uint32): the x coordinate of the upper-left corner of the ROI.y(uint32): the y coordinate of the upper-left corner of the ROI.width(uint32): the width of the ROI.height(uint32): the height of the ROI.
Example: set the values of Scan3DROI to 20, 20, 600, and 800
ros2 service call /set_3d_roi mecheye_ros_interface/srv/Set3DROI "{x: 20, y: 20, width: 600, height: 800}"Invoke this service to set the value of CloudOutlierFilterMode.
This service has one parameter:
value(string): theCloudOutlierFilterModevalue to be set. Values include "Off", "Weak", and "Normal".
Example: set the value of CloudOutlierFilterMode to "Off"
ros2 service call /set_cloud_outlier_filter_mode mecheye_ros_interface/srv/SetCloudOutlierFilterMode "{value: 'Off'}"# The value "Off" must be surrounded with single quotation marks.Invoke this service to set the value of CloudSmoothMode.
This service has one parameter:
value(string): theCloudSmoothModevalue to be set. Values include "Off", "Weak", "Normal" and "Strong".
Example: set the value of CloudSmoothMode to "Off"
ros2 service call /set_cloud_smooth_mode mecheye_ros_interface/srv/SetCloudSmoothMode "{value: 'Off'}"# The value "Off" must be surrounded with single quotation marks.Invoke this service to select the parameter group to use.
This service has one parameter:
value(string): the name of the parameter group to be selected. The "default" and "calib" parameter groups are built-in.
Example: select the "123" parameter group
ros2 service call /set_current_user_set mecheye_ros_interface/srv/SetCurrentUserSet "{value: 123}" Invoke this service to set the value of DepthRange.
This service has two parameters:
lower(int32): The lower limit of the depth range. The value range is 1–4000.upper(int32): The upper limit of the depth range. The value range is 2-5000 (must be greater than the value oflower).
Example: set the values of DepthRange to 300 and 1000
ros2 service call /set_depth_range mecheye_ros_interface/srv/SetDepthRange "{lower: 300, upper: 1000}"Invoke this service to set the value of FringeContrastThreshold.
This service has one parameter:
value(int32): theFringeContrastThresholdvalue to be set. The value range is 1-100.
Example: set the values of FringeContrastThreshold to 3
ros2 service call /set_fringe_contrast_threshold mecheye_ros_interface/srv/SetFringeContrastThreshold "{value: 3}"Invoke this service to set the value of FringeMinThreshold.
This service has one parameter:
value(int32): theFringeMinThresholdvalue to be set. The value range is 1-100.
Example: set the values of FringeMinThreshold to 3
ros2 service call /set_fringe_min_threshold mecheye_ros_interface/srv/SetFringeMinThreshold "{value: 3}"Invoke this service to set the laser camera settings.
Note: This service is only available for a laser camera.
This service has five parameters:
fringe_coding_mode(string): theLaserFringeCodingModevalue to be set. Values include "Fast" and "Accurate".frame_range_start(int32): theframeRangeStartvalue to be set. The value range is 0-100.frame_range_end(int32): theframeRangeEndvalue to be set. The value range is 0-100 (also must satisfy:frame_range_end-frame_range_start>= 25).frame_partition_count(int32): theframePartitionCountvalue to be set. The value range is 1-4.power_level(int32): thepowerLevelvalue to be set. The value range is 20-100.
Example: set the values of the laser camera settings to "Fast", 20, 80, 2, and 60.
ros2 service call /set_laser_settings mecheye_ros_interface/srv/SetLaserSettings "{fringe_coding_mode: Fast, frame_range_start: 20, frame_range_end: 80, frame_partition_count: 2, power_level: 60}"Invoke this service to set the value of AntiFlickerMode.
Note: This service is only available for PRO (V4), PRO M (V4), NANO (V4), and Nano (V3).
This service has one parameter:
value(string): theAntiFlickerModevalue to be set. Values include "Off", "AC50Hz", and "AC60Hz".
Example: set the value of AntiFlickerMode to "Off"
ros2 service call /set_projector_anti_flicker_mode mecheye_ros_interface/srv/SetProjectorAntiFlickerMode "{value: 'Off'}"# The value "Off" must be surrounded with single quotation marks.Invoke this service to set the value of FringeCodingMode.
Note: This service is only available for PRO S (V4), PRO M (V4), Nano (V3), and Pro XS (V3).
This service has one parameter:
value(string): theFringeCodingModevalue to be set. Values include "Fast" and "Accurate".
Example: set the value of FringeCodingMode to "Accurate"
ros2 service call /set_projector_fringe_coding_mode mecheye_ros_interface/srv/SetProjectorFringeCodingMode "{value: Accurate}"Invoke this service to obtain the current powerLevel value.
Note: This service is only available for DLP cameras, excluding Deep (V3) and Pro L Enhanced (V3).
This service has one parameter:
value(string): thepowerLevelvalue to be set. Values include "Low", "Normal", and "High".
Example: set the value of powerLevel to "High"
ros2 service call /set_projector_power_level mecheye_ros_interface/srv/SetProjectorPowerLevel "{value: High}"Invoke this service to set the UHP camera settings.
This service has two parameters:
capture_mode(string): theUhpCaptureModevalue to be set. Values include "Camera1", "Camera2", and "Merge".fringe_coding_mode(string): theUhpFringeCodingModevalue to be set. Values include "Fast" and "Accurate".
Example: set the UHP camera settings to "Merge" and "Accurage"
ros2 service call /set_uhp_settings mecheye_ros_interface/srv/SetUhpSettings "{capture_mode: Merge, fringe_coding_mode: Accurate}"Invoke this service to set the value of UhpCaptureMode.
This service has one parameter:
capture_mode(string): theUhpCaptureModevalue to be set. Values include "Camera1", "Camera2", and "Merge".
Example: set the value of UhpCaptureMode to "Merge"
ros2 service call /set_uhp_capture_mode mecheye_ros_interface/srv/SetUhpCaptureMode "{capture_mode: Merge}"Invoke this service to set the value of UhpFringeCodingMode.
This service has one parameter:
fringe_coding_mode(string): theUhpFringeCodingModevalue to be set. Values include "Fast" and "Accurate".
Example: set the value of UhpFringeCodingMode to "Accurate"
ros2 service call /set_uhp_fringe_coding_mode mecheye_ros_interface/srv/SetUhpFringeCodingMode "{value: Accurate}"