Skip to content

Lianchangle666/mecheye_ros_interface

 
 

Repository files navigation

Mech-Eye ROS Interface

This repository contains the ROS 1 interface for Mech-Eye Industrial 3D Camera.

Installation

ROS and Ubuntu Version Requirements

Dependencies

Package Version
OpenCV >= 3
PCL >= 1.8
Eigen 3.3.0
VTK 6.3.0
Mech-Eye API latest

Install Mech-Eye API

Download Mech-Eye API from Mech-Mind's website and install it with sudo apt.

Clone and Compile the Interface

Clone and compile the interface with the following commands:

mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
git clone https://github.com/MechMindRobotics/mecheye_ros_interface
cd ~/catkin_ws
catkin_make

Start Using the Interface

  1. Source the build workspace and launch the interface:

    source ~/catkin_ws/devel/setup.bash
    roslaunch mecheye_ros_interface start_camera.launch
  2. Enter the index number of the camera to which you want to connect, and press the Enter key.

  3. Open a new terminal, source the workspace and invoke a service:

    source ~/catkin_ws/devel/setup.bash
    rosservice call [/service] [arguments]

    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 ~/catkin_ws/src/mecheye_ros_interface/launch/start_camera.launch according to your needs:

    • save_file: To enable file saving to the designated path, change the default value to true.

      Note: You can change the paths for file saving in /mecheye_ros_interface/src/MechMindCamera.cpp.

    • camera_ip: Change the default value to the IP address of your camera.

      Note: To connect to a camera by its IP address, you also need to edit MechMindCamera.cpp. Uncomment lines 79 to 90, and comment lines 74 to 75 and lines 92 to 94.

    Note: Remember to run catkin_make again after making changes to start_camera.launch and *.cpp.

Topics

/mechmind/camera_info

Camera calibration and metadata.

/mechmind/color_image

Color image encoded as "bgr8."

/mechmind/depth_image

Depth image encoded as 32-bit float.

/mechmind/point_cloud

Point cloud data.

/mechmind/color_point_cloud

Textured point cloud data.

Services

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"

rosservice call /add_user_set '!!str 123' # For parameter group names that consist of numbers only, add "!!str" before the name.

Invoke this service to obtain a 2D image.

Example:

rosservice call /capture_color_map

Invoke this service to obtain a textured point cloud.

Example:

rosservice call /capture_color_point_cloud

Invoke this service to obtain a depth map.

Example:

rosservice call /capture_depth_map

Invoke this service to obtain an untextured point cloud.

Example:

rosservice call /capture_point_cloud

Invoke 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"

rosservice call /delete_user_set '!!str 123' # For parameter group names that consist of numbers only, add "!!str" before the name.

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:

rosservice call /device_info

Invoke this service to obtain the current ExpectedGrayValue value.

Example:

rosservice call /get_2d_expected_gray_value

Invoke this service to obtain the current Scan2DExposureMode value.

Example:

rosservice call /get_2d_exposure_mode

Invoke this service to obtain the current HDRExposureSequence value.

Example:

rosservice call /get_2d_exposure_sequence

Invoke this service to obtain the current 2D ExposureTime value.

Example:

rosservice call /get_2d_exposure_time

Invoke this service to obtain the current Scan2DROI values.

Example:

rosservice call /get_2d_roi

Invoke this service to obtain the current SharpenFactor value.

Example:

rosservice call /get_2d_sharpen_factor

Invoke this service to obtain the current ToneMappingEnable value.

Example:

rosservice call /get_2d_tone_mapping

Invoke this service to get the current 3D ExposureSequence values.

Example:

rosservice call /get_3d_exposure

Invoke this service to obtain the current Gain value.

Example:

rosservice call /get_3d_gain

Invoke this service to obtain the current Scan3DROI values.

Example:

rosservice call /get_3d_roi

Invoke this service to obtain the names of all available parameter groups.

Example:

rosservice call /get_all_user_sets

Invoke this service to get the current CloudOutlierFilterMode value.

Example:

rosservice call /get_cloud_outlier_filter_mode

Invoke this service to get the current CloudSmoothMode value.

Example:

rosservice call /get_cloud_smooth_mode

Invoke this service to obtain the name of the currently selected parameter group.

Example:

rosservice call /get_current_user_set

Invoke this service to obtain the current DepthRange value.

Example:

rosservice call /get_depth_range

Invoke this service to obtain the current FringeContrastThreshold value.

Example:

rosservice call /get_fringe_contrast_threshold

Invoke this service to obtain the current FringeMinThreshold value.

Example:

rosservice call /get_fringe_min_threshold

Invoke this service to obtain the current laser camera settings.

Note: This service is only available for a laser camera.

Example:

rosservice call /get_laser_settings

Invoke 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:

rosservice call /get_projector_antiflickermode

Invoke 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:

rosservice call /get_projector_fringecodingmode

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).

Example:

rosservice call /get_projector_powerlevel

Invoke this service to obtain the current UHP camera settings.

Note: This service is only available for the UHP series.

Example:

rosservice call /get_uhp_settings

Invoke this service to obtain the current UhpCaptureMode value.

Note: This service is only available for the UHP series.

Example:

rosservice call /get_uhp_capture_mode

Invoke this service to obtain the current UhpFringeCodingMode value.

Note: This service is only available for the UHP series.

Example:

rosservice call /get_uhp_fringe_coding_mode

Invoke this service to set the value of ExpectedGrayValue value.

Note: ExpectedGrayValue only takes effect when Scan2DExposureMode is set to Auto.

This service has one parameter:

  • value (int32): the ExpectedGrayValue value to be set. The value range is 0–255.

Example: set the value of ExpectedGrayValue to 20

rosservice call /set_2d_expected_gray_value 20

Invoke this service to set the value of Scan2DExposureMode.

This service has one parameter:

  • value (string): the Scan2DExposureMode value to be set. Values include "Timed", "Auto", "HDR", and "Flash".

Example: set the value of Scan2DExposureMode to "HDR"

rosservice call /set_2d_exposure_mode 'HDR'

Invoke this service to set the value of HDRExposureSequence.

Note: HDRExposureSequence only takes effect when Scan2DExposureMode is set to HDR.

This service has one parameter:

  • sequence (float64[]): the HDRExposureSequence values 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

rosservice call /set_2d_exposure_sequence [30.0,35.5,40.0]# Do not put spaces between elements in the sequence. Otherwise the element after a space will be passed as a string.

Invoke this service to set the value of 2D ExposureTime.

Note: 2D ExposureTime only takes effect when Scan2DExposureMode is set to Timed.

This service has one parameter:

  • value (float64): the 2D ExposureTime value to be set. The value range is 0.1–999.0.

Example: set the values of 2D ExposureTime to 35.5

rosservice call /set_2d_exposure_time 35.5

Invoke this service to obtain the values of Scan2DROI.

Note: Scan2DROI only takes effect when Scan2DExposureMode is set to Auto.

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

rosservice call /set_2d_roi 20 20 600 800

Invoke this service to set the value of SharpenFactor.

This service has one parameter:

  • value (float64): the SharpenFactor value to be set. The value range is 0.0–5.0.

Example: set the value of SharpenFactor to 0.5

rosservice call /set_2d_sharpen_factor 0.5

Invoke this service to set the value of ToneMappingEnable.

This service has one parameter:

  • value (bool): the ToneMappingEnable value to be set.

Example: set the value of ToneMappingEnable to True

rosservice call /set_2d_tone_mapping True

Invoke this service to set the value of 3D ExposureSequence.

This service has one parameter:

  • sequence (float64[]): the 3D ExposureSequence values 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

rosservice call /set_3d_exposure [30.0,35.5,40.0]# Do not put spaces between elements in the sequence. Otherwise the element after a space will be passed as a string.

Invoke this service to set the value of Gain.

This service has one parameter:

  • value (float64): the Gain value to be set. The value range is 0.0–16.0.

Example: set the value of Gain to 2.5

rosservice call /set_3d_gain 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

rosservice call /set_3d_roi 20 20 600 800

Invoke this service to set the value of CloudOutlierFilterMode.

This service has one parameter:

  • value (string): the CloudOutlierFilterMode value to be set. Values include "Off", "Weak", and "Normal".

Example: set the value of CloudOutlierFilterMode to "Off"

rosservice call /set_cloud_outlier_filter_mode '!!str Off' # The value "Off" must be input as '!!str Off'.

Invoke this service to set the value of CloudSmoothMode.

This service has one parameter:

  • value (string): the CloudSmoothMode value to be set. Values include "Off", "Weak", "Normal" and "Strong".

Example: set the value of CloudSmoothMode to "Off "

rosservice call /set_cloud_smooth_mode '!!str Off' # The value "Off" must be input as '!!str Off'.

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

rosservice call /set_current_user_set '!!str 123' # For parameter group names that consist of numbers only, add "!!str" before the name.

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 of lower).

Example: set the values of DepthRange to 300 and 1000

rosservice call /set_depth_range 300 1000

Invoke this service to set the value of FringeContrastThreshold.

This service has one parameter:

  • value (int32): the FringeContrastThreshold value to be set. The value range is 1-100.

Example: set the values of FringeContrastThreshold to 3

rosservice call /set_fringe_contrast_threshold 3

Invoke this service to set the value of FringeMinThreshold.

This service has one parameter:

  • value (int32): the FringeMinThreshold value to be set. The value range is 1-100.

Example: set the values of FringeMinThreshold to 3

rosservice call /set_fringe_min_threshold 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:

  • fringeCodingMode (string): the LaserFringeCodingMode value to be set. Values include "Fast" and "Accurate".
  • frameRangeStart (int32): the frameRangeStart value to be set. The value range is 0-100.
  • frameRangeEnd (int32): the frameRangeEnd value to be set. The value range is 0-100 (also must satisfy: frameRangeEnd - frameRangeStart >= 25).
  • framePartitionCount (int32): the framePartitionCount value to be set. The value range is 1-4.
  • powerLevel (int32): the powerLevel value 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.

rosservice call /set_laser_settings 'Fast' 20 80 2 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): the AntiFlickerMode value to be set. Values include "Off", "AC50Hz", and "AC60Hz".

Example: set the value of AntiFlickerMode to "Off"

rosservice call /set_projector_antiflickermode '!!str Off'# The value "Off" must be input as '!!str Off'.

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): the FringeCodingMode value to be set. Values include "Fast" and "Accurate".

Example: set the value of FringeCodingMode to "Accurate"

rosservice call /set_projector_fringecodingmode '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): the powerLevel value to be set. Values include "Low", "Normal", and "High".

Example: set the value of powerLevel to "High"

rosservice call /set_projector_powerlevel 'High'

Invoke this service to set the UHP camera settings.

This service has two parameters:

  • capture_mode (string): the UhpCaptureMode value to be set. Values include "Camera1", "Camera2", and "Merge".
  • fringe_coding_mode (string): the UhpFringeCodingMode value to be set. Values include "Fast" and "Accurate".

Example: set the UHP camera settings to "Merge" and "Accurage"

rosservice call /set_uhp_settings 'Merge' 'Accurate'

Invoke this service to set the value of UhpCaptureMode.

This service has one parameter:

  • capture_mode (string): the UhpCaptureMode value to be set. Values include "Camera1", "Camera2", and "Merge".

Example: set the value of UhpCaptureMode to "Merge"

rosservice call /set_uhp_capture_mode 'Merge'

Invoke this service to set the value of UhpFringeCodingMode.

This service has one parameter:

  • fringe_coding_mode (string): the UhpFringeCodingMode value to be set. Values include "Fast" and "Accurate".

Example: set the value of UhpFringeCodingMode to "Accurate"

rosservice call /set_uhp_fringe_coding_mode 'Accurate'

About

Official ROS interface for Mech-Eye cameras.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 95.6%
  • CMake 4.4%