Saltar al contenido principal
Versión del documento: V1.0; fecha de revisión: 2024-10-12.

Descripción general

El SDK de cámara MRDVS para Linux incluye ejemplos de C/C++, Java (servicio HTTP), ROS y ROS 2. Los ejemplos muestran el flujo de trabajo básico del SDK; añade la lógica específica de tu aplicación y el control de errores para tu proyecto. Completa primero la configuración del entorno, el script de instalación y las comprobaciones del directorio de ejemplos. Después, sigue la sección de compilación y ejecución correspondiente a tu lenguaje de destino. El apéndice enumera métodos de instalación para dependencias comunes y paquetes de prueba.

Sistema y entorno

Sistemas compatibles y versiones de dependencias

Se admiten los siguientes sistemas Linux. A continuación se indican las versiones predeterminadas de los programas:

2.2 Comprobar la versión del sistema y de la aplicación

2.2.1 Comprobar la versión del sistema

resultado:
Iconos relacionados con la vista de la versión del sistema
Número de versión de lanzamiento del sistema operativo: 5.15.0
  • Número de versión principal: 5
  • Número de versión: 15 [Los números impares son versiones de desarrollo y los pares son versiones estables]
  • Número de revisión: 0 [Número de modificaciones]
  • N.° de revisión de esta versión: 97
  • Versión del kernel: #107~20.0.4.1; normalmente, la versión del sistema es la versión del kernel

2.2.2 Comprobar la versión de Cmake

resultado:
Iconos relacionados con la vista de la versión de Cmake
Indica la versión de Cmake 3.16.3

2.2.3 Comprobar la versión de Gcc

resultado:
Iconos relacionados con la vista de la versión de Gcc
El número de versión aparece en el recuadro azul de la esquina inferior izquierda. La versión de este ejemplo es: 9.4.0

2.2.4 Ver la versión de Opencv

resultado:
Iconos relacionados con la vista de la versión de Opencv
La versión de este ejemplo es 3.2.0

2.2.5 Comprobar la versión de Pcl

resultado: La versión de este ejemplo es 1.8.1

2.2.6 Ver la versión de ROS

resultado:
Iconos relacionados con la vista de la versión de ROS
La versión de este ejemplo es eloquent (la versión de ros2 correspondiente a Ubuntu18.04)
Icono relacionado con la vista de la versión de ROS 2
La versión de este ejemplo es noetic (la versión de ros1 correspondiente a Ubuntu20)

2.3 Crear un entorno de desarrollo básico

Debes actualizar la lista de instalación antes de instalar:
El resultado es el siguiente:
Ilustraciones relacionadas con la creación de un entorno de desarrollo básico

2.3.1 Instalar Cmake

Iconos relacionados con la instalación de Cmake

2.3.2 Instalar Gcc

Iconos relacionados con la instalación de Gcc

2.4 Crear un entorno de desarrollo opcional

2.4.1 Instalar Opencv [puede mostrar imágenes de la cámara]

Iconos relacionados con la instalación de Opencv [puede mostrar imágenes de la cámara]

2.4.2 Instalar Pcl [puede mostrar la nube de puntos]

Iconos relacionados con la instalación de Pcl [puede mostrar la nube de puntos]

Preparar el código de ejemplo

3.1 Ejecutar el script de instalación

  1. Descomprime el archivo Lanxin-MRDVS y entra en la carpeta Lanxin-MRDVS
Ilustraciones relacionadas con la ejecución del script de instalación
  1. Haz clic con el botón derecho para abrir la consola
  2. Ejecuta el script install.sh
Ilustración relacionada con la ejecución del script de instalación 2
  1. Entra en el directorio /opt/ para comprobar si la instalación se realizó correctamente.
Ilustración relacionada con la ejecución del script de instalación 3
  1. Si se encuentra la carpeta, la instalación se realizó correctamente.
  2. Si la instalación falla, debes añadirla manualmente al directorio opt.
  3. Ejecuta el script set_socket_buffer_size.sh
Ilustraciones relacionadas con la ejecución del script de instalación 4
  1. En este punto, el script de instalación se ha ejecutado por completo.

3.2 Introducción al código de ejemplo

Entra en el directorio Sample. El contenido del directorio es el siguiente:
Ilustraciones relacionadas con la introducción al código de ejemplo
  • La carpeta C contiene código relacionado con C y C++
  • La carpeta Java contiene un servidor HTTP para llamar indirectamente al SDK
  • La carpeta Ros contiene un ejemplo de ROS
  • La carpeta Ros2 contiene un ejemplo de ROS 2

3.2.1 Código de ejemplo de C y C++

Entra en el directorio C. El contenido del directorio es el siguiente:
Ilustraciones relacionadas con el código de ejemplo de C y C++
Contiene 9 carpetas y 1 archivo Cmakelist; cada carpeta contiene un archivo cpp. Las funciones implementadas aproximadamente por cada cpp son las siguientes:
  • application_obstacle: obtiene datos del flujo de la cámara, activa el algoritmo de evitación de obstáculos y muestra los resultados del algoritmo
  • application_pallet: obtiene datos del flujo de la cámara, activa el algoritmo de palés y muestra los resultados del algoritmo
  • arm_local_camera: llama al SDK en la cámara [ARM] y obtiene los datos del flujo
  • frame_callback: utiliza el método de callback para obtener datos del flujo de la cámara
  • multi_cameras: abre varias cámaras y obtiene datos del flujo
  • single_camera: abre una sola cámara y obtiene datos del flujo
  • single_camera2: obtiene datos de fotogramas mediante una estructura
Puedes seleccionar distintos códigos de ejemplo para probarlos y modificarlos según tus necesidades.

3.2.2 Código de ejemplo de Java

Entra en el directorio java. El contenido del directorio es el siguiente:
Ilustraciones relacionadas con el código de ejemplo de Java
El directorio contiene 2 carpetas, un archivo postman.json y README.
  • Config: la carpeta almacena las configuraciones relacionadas con el servidor
  • Middleware: tema del servidor
  • LxCamera.postman_collection.json: archivo de configuración de Postman
  • README: tutorial de uso del servidor virtual de Java

3.2.3 Código de ejemplo de ROS

Entra en el directorio ros. El contenido del directorio es el siguiente:
Ilustraciones relacionadas con el código de ejemplo de ROS
  • lx_camera_node_ws: la carpeta contiene un controlador estándar de ROS
  • README.EN: explica en inglés cómo compilar un nodo y crear un nodo nuevo

3.2.4 Código de ejemplo de ROS 2

Entra en el directorio ros2. El contenido del directorio es el siguiente:
Imágenes relacionadas con el código de ejemplo de ROS 2
  • lx_camera_node_ws: la carpeta contiene un controlador estándar de ROS 2
  • README.EN: explica en inglés cómo compilar un nodo y crear un nodo nuevo

3.2.5 Código de ejemplo de ros-v1pro

Entra en el directorio ros-v1pro. El contenido del directorio es el siguiente:
Ilustraciones relacionadas con el código de ejemplo de ros-v1pro
  • src: la carpeta contiene un controlador estándar de ROS
  • README: explica cómo utilizar este nodo
  • README.pdf: explica cómo utilizar este nodo

Compilar y ejecutar los ejemplos

4.1 Compilar y ejecutar el código de ejemplo de C y C++

Ve a la carpeta C del ejemplo:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de C y C++
Abre una terminal en la carpeta C y ejecuta:
Después de una ejecución correcta, entra en la carpeta build; su contenido debería ser el siguiente:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de C y C++ 2
El archivo ejecutable se encuentra en el directorio bin. Al entrar en el directorio bin, debería verse así:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de C y C++ 3
Salvo el ejemplo de arm, se compilarán todos los demás ejemplos. El nombre del archivo ejecutable coincide con el nombre de la carpeta del ejemplo. Puedes ejecutarlo directamente.

4.2 Proceso de ejecución del ejemplo de Java

Java se diferencia de los demás códigos de ejemplo. No proporciona directamente el código fuente, sino un servidor HTTP y un ejemplo de Postman. Si necesitas controlar la cámara indirectamente mediante HTTP, selecciona el ejemplo de Java y entra en la carpeta java. El contenido de la carpeta es el siguiente:
Ilustraciones relacionadas con el proceso de ejecución del ejemplo de Java
El proceso de ejecución es el siguiente:
  • Entra en la carpeta config y modifica los campos http_sever_host y http_sever_port del archivo Configs.json:
  • Entra en la carpeta middleware y ejecuta el script start.sh para activar el servidor de transferencia
Ilustraciones relacionadas con el proceso de ejecución del ejemplo de Java 3
  • Usa Postman para abrir el archivo LxCamera.postman_collection.json y enviar datos al puerto del ejemplo

4.3 Compilar y ejecutar el código de ejemplo de ROS

Entra en la carpeta ROS, abre una consola y ejecuta:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 2
Haz clic con el botón derecho para abrir una consola, entra en la carpeta lx_camera_node_ws y ejecuta:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 3
Después de una ejecución correcta, se mostrará lo siguiente:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 4
En este momento se han compilado y generado devel y build en la carpeta:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 5
Ejecuta los siguientes comandos para cargar el entorno e iniciar un nodo con roslaunch:
De arriba abajo, son: ejecución de nodos normales, ejecución de nodos del algoritmo de evitación de obstáculos 2, ejecución de nodos del algoritmo de evitación de obstáculos y ejecución de nodos del algoritmo de palés. No se puede activar más de un nodo al mismo tiempo.

4.4 Compilar y ejecutar el código de ejemplo de ROS 2

Entra en la carpeta ros2. El contenido de la carpeta es el siguiente:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 2
El nodo de ROS de ejemplo se compila mediante colcon. Primero, instala las herramientas de compilación:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 2 2
Después, instala el paquete de dependencia ros-pcl. Sustituye foxy por la distribución de ROS 2 instalada en tu sistema:
Después de la instalación, entra en el directorio lx_camera_node_ws y compila el proyecto:
Según el rendimiento del equipo, la compilación suele tardar entre 30 y 120 segundos. Tras una compilación correcta, se mostrará lo siguiente:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 2 3
Algunas advertencias se deben a problemas de compatibilidad de versiones y no es necesario procesarlas. Cuando finalice la compilación, el contenido de la carpeta será el siguiente:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ROS 2 4
Ejecuta los siguientes comandos para cargar el entorno e iniciar un nodo con ros2 launch:
De arriba abajo, son: ejecución de nodos normales, ejecución de nodos del algoritmo de evitación de obstáculos 2, ejecución de nodos del algoritmo de evitación de obstáculos y ejecución de nodos del algoritmo de palés. No se puede activar más de un nodo al mismo tiempo.

4.5 Compilar y ejecutar el código de ejemplo de ros-v1pro

ros-v1pro es un controlador de ROS específico para la cámara V1PRO. En la carpeta ros-v1pro hay un README.pdf que describe el controlador en detalle. Este documento solo ofrece una breve introducción: Entra en la carpeta ros-v1pro y compílala:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ros-v1pro 2
Carga el entorno:
Ilustraciones relacionadas con la compilación y ejecución del código de ejemplo de ros-v1pro 3
Por último, ejecuta el nodo:
  • roslaunch lx_camera_ros localization.launch
  • roslaunch lx_camera_ros mapping.launch
  • roslaunch lx_camera_ros sensor_sim.launch
De arriba abajo: ejecutar el nodo de posicionamiento, ejecutar el nodo de mapeo y ejecutar el nodo de datos virtuales. No se puede activar más de un nodo al mismo tiempo.

Referencia del código de ejemplo

En esta sección, todo el código y el pseudocódigo se dividirán en varias partes. En general, todo lo que aparece en una sección pertenece al mismo archivo. Salvo los archivos especiales con explicaciones detalladas, los archivos de código fuente solo explican los módulos generales. Las explicaciones detalladas aparecen como comentarios en el código.

5.1 C y C++

5.1.1 CMakeLists

5.1.2 application_obstacle y application_pallet

5.1.3 arm_local_camera

5.1.4 frame_callback

5.1.5 multi_cameras

5.1.6 single_camera

5.1.7 single_camera2

5.2 java

El ejemplo de Java solo proporciona un servidor HTTP, por lo que la descripción se limita a la interfaz y al formato de los mensajes. Usa Postman para abrir el archivo de ejemplo como se muestra a continuación: Todos los mensajes utilizan el método POST. Antes de enviar datos, recuerda cambiar la IP por la IP del servidor, pero no modifiques la URL. La URL está codificada internamente en el servidor. El formato y el contenido del mensaje de respuesta se encuentran en el cuerpo. La interfaz proporcionada en el ejemplo es la siguiente:
Iconos relacionados con java 2
1.DcGetApiVersion: obtiene el número de versión del SDK; no requiere parámetros de entrada
Iconos relacionados con java 3
2.DcSetInfoOutput: establece la ruta de salida de los registros del SDK. Los parámetros son los siguientes:
  • log_path: ruta de salida de los registros
  • print_level: nivel de impresión de los registros
  • enable_screen_print: indica si los registros se imprimen en la consola
3.DcLog: escribe el registro en el registro del SDK. Todo el contenido introducido se imprimirá en el registro del SDK. 4.DcGetDeviceList: obtiene la lista de dispositivos; no requiere entrada y la entrada es JSON 5.DcOpenDevice: abre el dispositivo e introduce lo siguiente:
Iconos relacionados con java 4
  • open_mode: modo de apertura de la cámara
  • param: parámetros para abrir la cámara
6.DcStartStream: hace que una cámara determinada comience a enviar datos de flujo. Los parámetros de entrada son los siguientes:
Iconos relacionados con java 5
  • handle: identificador de la cámara, que se devuelve en DcOpenDevice
7.DcSetCmd: envía comandos a la cámara; introduce lo siguiente:
Iconos relacionados con java 6
  • handle: identificador de la cámara que se va a configurar
  • cmd: número del comando
8.DcGetPtrValue: obtiene datos de puntero (imágenes, parámetros, etc.); introduce lo siguiente:
  • handle: identificador de la cámara que se va a configurar
  • cmd: número del comando
9.DcSetIntValue: establece los parámetros de tipo int de la cámara; introduce lo siguiente:
Iconos relacionados con java 7
  • handle: identificador de la cámara que se va a configurar
  • cmd: número del comando
  • value: valor que se va a establecer
10.DcGetIntValue: obtiene el parámetro de tipo int del dispositivo; introduce lo siguiente:
  • handle: identificador de la cámara que se va a configurar
  • cmd: número del comando
  1. Consulta la tabla siguiente para ver otras instrucciones relacionadas:

5.3 ROS1 y ROS2

En la descripción de ROS no hablaremos del código fuente del controlador, sino del contenido correspondiente a la configuración del archivo launch, de cómo ajustar la configuración y de cómo enviar y suscribirse a mensajes. El nodo de ROS proporcionado ya contiene la mayoría de las funciones, por lo que no se recomienda modificar directamente el código fuente del controlador. Si tienes necesidades especiales, primero puedes comprender el flujo del código del ejemplo de C++ y después modificar el código fuente del controlador. Al ejecutar el controlador de ROS, debes asegurarte de que las versiones de opencv y pcl en la ruta predeterminada del sistema sean únicas; de lo contrario, se producirá un error al enlazar la biblioteca de ROS, lo que puede provocar un fallo de compilación o un bloqueo durante la ejecución.

5.3.1 Descripción del archivo launch de ROS1

5.3.1.1 Todos los archivos launch
  1. En la carpeta src/launch se encuentran los siguientes archivos:
Iconos relacionados con todos los archivos launch
  • localization.launch: archivo de ejecución de los nodos de posicionamiento visual
  • lx_camera_ros.launch: archivo de ejecución de los nodos normales
  • mapping.launch: archivo de ejecución del mapeo para posicionamiento visual
  • obstacle.launch: archivo de ejecución del algoritmo de evitación de obstáculos
  • obstacleV2.launch: archivo de ejecución de la versión V2 del algoritmo de evitación de obstáculos
  • pallet.launch: archivo de ejecución del algoritmo de palés
  • sensor_sim.launch: archivo de ejecución para simular datos de posicionamiento
  1. Puedes ejecutar distintas funciones del nodo mediante diferentes archivos launch. Salvo localization, mapping y sensor, el contenido de los parámetros es el mismo en todos los nodos, pero la configuración es diferente. Esto se explicará en detalle en las secciones siguientes. Para una introducción detallada a los parámetros de los tres archivos launch de localization, mapping y sensor, consulta la introducción del nodo ros-v1pro.
5.3.1.2 IP de la cámara, configuración del flujo, configuración del modo de trabajo, unidad de la nube de puntos, etc.
  • ip: IP de la cámara que se debe conectar. Si es 0, se conectará la primera de forma predeterminada.
  • log_path: ruta de almacenamiento de los registros del SDK; debes indicar la ruta absoluta
  • is_xyz: indica si se deben enviar datos de la nube de puntos
  • is_depth: indica si se deben enviar datos de profundidad
  • is_amp: indica si se deben enviar datos del mapa de intensidad
  • is_rgb: indica si se deben enviar datos de imagen RGB
  • lx_work_mode: modo de trabajo
  • lx_application: indica si se activa el algoritmo; 0: desactivado, 1: algoritmo de evitación de obstáculos, 2: algoritmo de palés, 3: algoritmo de posicionamiento, 4: algoritmo de evitación de obstáculos V2
  • lx_tof_unit: unidad de la nube de puntos; 1 es metro, 0 es milímetro; debes cambiarlo a 1 al visualizar con rviz
5.3.1.3 Configuración de la pose de la cámara
Se pueden configurar el ángulo de rotación y el vector de traslación de la nube de puntos.
  • X: cantidad de traslación de la cámara desde el centro de la nube de puntos en X
  • Y: cantidad de traslación de la cámara desde el centro de la nube de puntos en Y
  • Z: cantidad de traslación de la cámara desde el centro de la nube de puntos en Z
  • Yaw: ángulo de rotación de la nube de puntos alrededor del eje Z
  • Roll: ángulo de rotación de la nube de puntos alrededor del eje X
  • Pitch: ángulo de rotación de la nube de puntos alrededor del eje Y
5.3.1.4 Indicar si se utiliza la configuración de launch
Puedes elegir si deseas utilizar la configuración de parámetros de la cámara en el archivo launch.
  • raw_param: 0: usa la configuración de la cámara; 1: usa la configuración del archivo launch
Independientemente de que este parámetro se establezca en 0 o 1, se establecerán todos los parámetros anteriores; 0 y 1 solo son válidos para los parámetros posteriores a este parámetro.
5.3.1.5 Configuración de parámetros 2D
  • lx_2d_binning:0:1x1,1:2x2,2:4x4
  • lx_2d_undistort: ​​antidistorsión 2D, 0: desactivada, 1: activada
  • lx_2d_undistort_scale: coeficiente de antidistorsión 2D
  • lx_2d_auto_exposure: exposición automática 2D, 0: desactivada, 1: activada
  • lx_2d_auto_exposure_value: intensidad objetivo de la exposición automática 2D
  • lx_2d_exposure: valor de exposición 2D
  • lx_2d_gain: ganancia 2D
5.3.1.6 Configuración de parámetros 3D
  • lx_rgb_to_tof: alineación RGB
  • lx_3d_binning:0:1x1,1:2x2,2:4x4
  • lx_mulit_mode: modo multicámara, que puede eliminar las interferencias entre cámaras; 0: desactivado, 1: activado
  • lx_3d_undistort: ​​antidistorsión 3D, 0: desactivada, 1: activada
  • lx_3d_undistort_scale: coeficiente de antidistorsión 3D
  • lx_hdr: HDR, 0: desactivado, 1: activado
  • lx_3d_auto_exposure: exposición automática 3D, 0: desactivada, 1: activada
  • lx_3d_auto_exposure_value: intensidad objetivo de la exposición automática 3D
  • lx_3d_first_exposure: puntos altos 3D
  • lx_3d_second_exposure: puntos bajos 3D
  • lx_3d_gain: ganancia 3D
5.3.1.7 Profundidad máxima y mínima
  • lx_min_depth: profundidad mínima
  • lx_max_depth: profundidad máxima

5.3.2 Descripción del archivo launch de ROS 2

5.3.2.1 Todos los archivos launch
En la carpeta src/launch se encuentran los siguientes archivos:
Iconos relacionados con todos los archivos launch
  • localization.launch.py: archivo de ejecución del nodo de posicionamiento visual
  • lx_camera_ros.launch.py: archivo de ejecución del nodo normal
  • mapping.launch.py: archivo de ejecución del mapeo para posicionamiento visual
  • obstacle.launch.py: archivo de ejecución del algoritmo de evitación de obstáculos
  • obstacleV2.launch.py: archivo de ejecución de la versión V2 del algoritmo de evitación de obstáculos
  • pallet.launch.py: archivo de ejecución del algoritmo de palés
  • sensor_sim.launch.py: archivo de ejecución para simular datos de posicionamiento
Puedes ejecutar distintas funciones del nodo mediante diferentes archivos launch. Salvo localization, mapping y sensor, el contenido de los parámetros es el mismo en todos los nodos, pero la configuración es diferente. Esto se explicará en detalle en las secciones siguientes. Para una introducción detallada a los parámetros de los tres archivos launch de localization, mapping y sensor, consulta la introducción del nodo ros-v1pro.
5.3.2.2 IP de la cámara, configuración del flujo, configuración del modo de trabajo, unidad de la nube de puntos, etc.
  • ip: IP de la cámara que se debe conectar. Si es 0, se conectará la primera de forma predeterminada.
  • log_path: ruta de almacenamiento de los registros del SDK; debes indicar la ruta absoluta
  • is_xyz: indica si se deben enviar datos de la nube de puntos
  • is_depth: indica si se deben enviar datos de profundidad
  • is_amp: indica si se deben enviar datos del mapa de intensidad
  • is_rgb: indica si se deben enviar datos de imagen RGB
  • lx_work_mode: modo de trabajo
  • lx_application: indica si se activa el algoritmo; 0: desactivado, 1: algoritmo de evitación de obstáculos, 2: algoritmo de palés, 3: algoritmo de posicionamiento, 4: algoritmo de evitación de obstáculos V2
  • lx_tof_unit: unidad de la nube de puntos; 1 es metro, 0 es milímetro; debes cambiarlo a 1 al visualizar con rviz
5.3.2.3 Configuración de la pose de la cámara
Se pueden configurar el ángulo de rotación y el vector de traslación de la nube de puntos.
  • X: cantidad de traslación de la cámara desde el centro de la nube de puntos en X
  • Y: cantidad de traslación de la cámara desde el centro de la nube de puntos en Y
  • Z: cantidad de traslación de la cámara desde el centro de la nube de puntos en Z
  • Yaw: ángulo de rotación de la nube de puntos alrededor del eje Z
  • Roll: ángulo de rotación de la nube de puntos alrededor del eje X
  • Pitch: ángulo de rotación de la nube de puntos alrededor del eje Y
5.3.2.4 Indicar si se utiliza la configuración de launch
Puedes elegir si deseas utilizar la configuración de parámetros de la cámara en el archivo launch.
  • raw_param: 0: usa la configuración de la cámara; 1: usa la configuración del archivo launch
Independientemente de que este parámetro se establezca en 0 o 1, se establecerán todos los parámetros anteriores; 0 y 1 solo son válidos para los parámetros posteriores a este parámetro.
5.3.2.5 Configuración de parámetros 2D
  • lx_2d_binning:0:1x1,1:2x2,2:4x4
  • lx_2d_undistort: ​​antidistorsión 2D, 0: desactivada, 1: activada
  • lx_2d_undistort_scale: coeficiente de antidistorsión 2D
  • lx_2d_auto_exposure: exposición automática 2D, 0: desactivada, 1: activada
  • lx_2d_auto_exposure_value: intensidad objetivo de la exposición automática 2D
  • lx_2d_exposure: valor de exposición 2D
  • lx_2d_gain: ganancia 2D
5.3.2.6 Configuración de parámetros 3D
  • lx_rgb_to_tof: alineación RGB
  • lx_3d_binning:0:1x1,1:2x2,2:4x4
  • lx_mulit_mode: modo multicámara, que puede eliminar las interferencias entre cámaras; 0: desactivado, 1: activado
  • lx_3d_undistort: ​​antidistorsión 3D, 0: desactivada, 1: activada
  • lx_3d_undistort_scale: coeficiente de antidistorsión 3D
  • lx_hdr: HDR, 0: desactivado, 1: activado
  • lx_3d_auto_exposure: exposición automática 3D, 0: desactivada, 1: activada
  • lx_3d_auto_exposure_value: intensidad objetivo de la exposición automática 3D
  • lx_3d_first_exposure: puntos altos 3D
  • lx_3d_second_exposure: puntos bajos 3D
  • lx_3d_gain: ganancia 3D
5.3.2.7 Profundidad máxima y mínima
  • lx_min_depth: profundidad mínima
  • lx_max_depth: profundidad máxima

5.3.3 Descripción de los temas exclusivos

Como los tipos de tema exclusivos de ROS1 y ROS2 son iguales, aquí se utiliza ROS1 como ejemplo. En la carpeta src/msg se encuentran los siguientes archivos:
Ilustraciones relacionadas con las descripciones de los temas exclusivos
5.3.3.1 FrameRate.msg
Este nodo muestra información sobre la frecuencia de fotogramas. El formato del mensaje es el siguiente:
Iconos relacionados con FrameRate.msg
  • header: información del fotograma y marca de tiempo de los datos actuales
  • depth: cuando el mapa de profundidad está activado, muestra la frecuencia de fotogramas del mapa de profundidad
  • amp: cuando el mapa de intensidad está activado, muestra la frecuencia de fotogramas del mapa de intensidad
  • rgb: cuando RGB está activado, muestra la frecuencia de fotogramas RGB
  • temperature: muestra la temperatura de la cámara
Después de iniciar el nodo (excepto los nodos relacionados con el posicionamiento visual), puedes suscribirte al nodo LxCamera_FrameRate para obtener la información correspondiente. La salida es la siguiente:
Iconos relacionados con FrameRate.msg 2
5.3.3.2 Obstacle.msg
obstacle muestra información relacionada con los resultados del algoritmo de evitación de obstáculos. El formato del mensaje obstacle es el siguiente:
Iconos relacionados con Obstacle.msg
  • header: información del fotograma y marca de tiempo de los datos actuales
  • status: información de estado devuelta por el algoritmo de evitación de obstáculos
0: evitación de obstáculos normal -1: no se ha establecido el suelo -2: entrada no establecida -3: no hay ninguna nube de puntos dentro del intervalo -4: la nube de puntos está vacía después de filtrar el suelo -5: la nube de puntos está vacía después del filtrado por radio -6: no se obtuvo ningún resultado de segmentación -99: error no definido
  • io_output: información de evitación de obstáculos generada por la interfaz io
0: normal 1: advertencia 2: apagado
  • box_number: número de obstáculos
  • box: información de los obstáculos, matriz de longitud variable cuya longitud viene determinada por box_number
Después de iniciar el nodo (debes activar el algoritmo de evitación de obstáculos), puedes suscribirte al nodo LxCamera_Obstacel para obtener la información correspondiente. La salida es la siguiente (los datos de la imagen son datos simulados):
Iconos relacionados con Obstacle.msg 2
5.3.3.3 Obstacle_box.msg
obstacle_box muestra información relacionada con los obstáculos y el formato del mensaje obstacle_box es el siguiente:
Iconos relacionados con Obstacle_box.msg
  • center: centro de masa del obstáculo en la nube de puntos
  • rotation: matriz de rotación de la nube de puntos del obstáculo
  • translation: vector de traslación de la nube de puntos del obstáculo
  • width: ancho del marco del obstáculo
  • height: alto del marco del obstáculo
  • depth: profundidad del marco del obstáculo
Después de iniciar la ejecución (debes activar el algoritmo de evitación de obstáculos), puedes suscribirte al nodo LxCamera_Obstacel para obtener la información correspondiente. La salida es la siguiente:
Icono relacionado con Obstacle_box.msg 2
5.3.3.4 Result.msg
El valor devuelto obtenido después de enviar el mensaje de comando al servicio del nodo se almacena en Result:
Iconos relacionados con Result.msg
  • ret: valor devuelto obtenido al ejecutar el SDK
  • msg: descripción del valor devuelto obtenido al ejecutar el SDK
5.3.3.5 Pallet.msg
pallet muestra información relacionada con los resultados del algoritmo de palés. El formato del mensaje pallet es el siguiente:
Iconos relacionados con Pallet.msg
  • header: información del fotograma y marca de tiempo de los datos actuales
  • status: información de estado devuelta por el reconocimiento de palés:
0: detección correcta -1: no se detectó el suelo -2: no se detectaron las patas del palé -3: la distancia entre los palés es demasiado grande -4: error desconocido
  • x: distancia X entre la bandeja y el centro óptico de la cámara
  • y: distancia Y entre la bandeja y el centro óptico de la cámara
  • yaw: ángulo theta entre el centro de la bandeja y el centro óptico de la cámara
Después de iniciar el nodo (debes activar el algoritmo de palés), puedes suscribirte al nodo LxCamera_Pallet para obtener la información correspondiente. La salida es la siguiente:
Iconos relacionados con Pallet.msg 2

5.3.4 Unique Service Description

Since the unique service types of ROS1 and ROS2 are the same, ROS1 is used as an example here. There are the following files in the src/srv folder:
Illustrations related to unique service descriptions
These messages are used to set or obtain certain parameter values ​​of the camera. Above [---] is the sent data, below [---] is the returned data
5.3.4.1 LxBool.srv
LxBool.srv related icons
  • cmd: the parameter number that needs to be obtained or set
  • val: the value set when setting
  • is_set: Whether to set the parameter. When it is true, the value in val will be set to the camera. When it is false, the value of this parameter will be read from the camera and displayed.
  • val: The value of the camera’s current parameter returned when getting or setting it
  • result: the value and information returned by calling the SDK interface
5.3.4.2 LxCmd.srv
LxCmd.srv related icons
  • cmd: The parameter number that needs to be obtained or set. When it is 0, all parameter numbers will be returned.
  • result: the value and information returned by calling the SDK interface, cmd may have multiple return values
5.3.4.3 LxFloat.srv
LxFloat.srv related icons
  • cmd: the parameter number that needs to be obtained or set
  • val: the value set when setting
  • is_set: Whether to set the parameter. When it is true, the value in val will be set to the camera. When it is false, the value of this parameter will be read from the camera and displayed.
  • max_value: the maximum value that can be set for this parameter
  • min_value: the minimum value that can be set for this parameter
  • cur_value: the current value of this parameter in the camera
  • available: whether this parameter supports setting
  • result: the value and information returned by calling the SDK interface
5.3.4.4 LxInt.srv
LxInt.srv related icons
  • cmd: the parameter number that needs to be obtained or set
  • val: the value set when setting
  • is_set: Whether to set the parameter. When it is true, the value in val will be set to the camera. When it is false, the value of this parameter will be read from the camera and displayed.
  • max_value: the maximum value that can be set for this parameter
  • min_value: the minimum value that can be set for this parameter
  • cur_value: the current value of this parameter in the camera
  • available: whether this parameter supports setting
  • result: the value and information returned by calling the SDK interface
5.3.4.5 LxString.srv
LxString.srv related icons
  • cmd: the parameter number that needs to be obtained or set
  • val: the value set when setting
  • is_set: Whether to set the parameter. When it is true, the value in val will be set to the camera. When it is false, the value of this parameter will be read from the camera and displayed.
  • val: The value of the camera’s current parameter returned when getting or setting it
  • result: the value and information returned by calling the SDK interface

5.3.5 Description of topic subscription methods

5.3.5.1 Subscription frame rate, tray algorithm, obstacle avoidance algorithm output data
Subscribe Frame Rate In the lx_camera_node_ws directory, enter: bash rate.sh
Illustrations related to subscription frame rate, tray algorithm, and obstacle avoidance algorithm output data
After the lx_camera_node node image runs normally and is refreshed, you can see the following information:
Illustrations related to subscription frame rate, pallet algorithm, and obstacle avoidance algorithm output data 2
Subscribe to pallet algorithm output In the lx_camera_node_ws directory, enter: bash pallet.sh
Illustrations related to subscription frame rate, pallet algorithm, and obstacle avoidance algorithm output data 3
After the lx_camera_node node image runs normally and is refreshed, you can see the following information:
Illustrations related to subscription frame rate, pallet algorithm, and obstacle avoidance algorithm output data 4
Subscribe to obstacle avoidance algorithm output In the lx_camera_node_ws directory, enter: bash obstacle.sh
Illustrations related to subscription frame rate, pallet algorithm, and obstacle avoidance algorithm output data 5
After the lx_camera_node node image runs normally and is refreshed, you can see the following information:
Illustrations related to subscription frame rate, tray algorithm, and obstacle avoidance algorithm output data 6
5.3.5.2 Subscribe to image data (ROS1)
You can view the image information output by the node through the image tool that comes with ros: Console input command: rqt_image_view After entering the command, the following window will pop up:
Illustrations related to subscribing image data (ROS1)
The red box can select the images in all nodes. The picture shows the MRDVS camera RGB image. You can also select the depth map or intensity map (provided that the stream has been turned on):
Subscription image data (ROS1) related diagram 2
In the figure, the first red box is the RGB information output by the positioning algorithm node, and the remaining three are image information output by the ordinary nodes. amp is the intensity map, depth is the depth map, and rgb is the rgb map. Select different items to view different images or use rviz to view image data. Enter the command on the console: rviz will pop up the following window:
Subscription image data (ROS1) related diagram 3
After clicking the Add button at the bottom left, a window will pop up:
Subscription image data (ROS1) related diagram 4
Select the desired image topic and select Image and click OK in the lower right corner. You can see the image data on the left side of the main interface, as shown below:
Subscription image data (ROS1) related diagram 5
5.3.5.3 Subscribe to image data (ROS2)
You can view the image information output by the node through the image tool that comes with ros2: Enter the command on the console: rqt After entering the command, the following window will pop up:
Illustrations related to subscribing image data (ROS2)
Select the first Image View of the second option at the bottom of the menu bar. After selection, the following interface will pop up:
Subscription image data (ROS2) related diagram 2
The red box can select the images in all nodes. The picture shows the MRDVS camera RGB image. You can also select the depth map or intensity map (provided that the stream has been turned on):
Subscription image data (ROS2) related diagram 3
In the figure, the first red box is the RGB information output by the positioning algorithm node, and the remaining three are image information output by the ordinary nodes. amp is the intensity map, depth is the depth map, and rgb is the rgb map. Select different items to view different images or use rviz2 to view image data. Enter the command on the console: rviz2 will pop up the following window:
Subscription image data (ROS2) related diagram 4
After clicking the Add button at the bottom left, a window will pop up:
Subscription image data (ROS2) related diagram 5
Select the desired image topic and select Image and click OK in the lower right corner. You can see the image data on the left side of the main interface, as shown below:
Subscription image data (ROS2) related diagram 6
Some systems need to fill in [mrdvs] in the [map] in the above picture to see the image
5.3.5.4 Subscribe to point cloud data
The point cloud information output by the node can be viewed through the point cloud tool provided by ros or ros2: Command: rviz【ROS1】, rviz2【ROS2】 After entering the command, the following window will pop up:
Illustrations related to subscribing to point cloud data
Click the button in the red box below and the following box will pop up:
Illustration related to subscribing to point cloud data 2
Select the second tab, and there will be a node named lx_camera_node. There is a topic named LxCamera_Cloud in the node. There is a message named PointCloud2 in the topic. After selecting, click OK. The interface after completion is as follows:
Illustrations related to subscribing to point cloud data 3
(ROS1 interface)
Illustrations related to subscribing to point cloud data 4
(ROS2 interface) At this time, the point cloud cannot be displayed normally. Fill in mrdvs in the red and green box map above to see the point cloud. The effect is as follows:
Illustrations related to subscribing to point cloud data 5
The default point cloud unit in ROS is meters, so when viewing using rviz, you need to modify lx_tof_unit in the launch file to 1 [the default is 1]

5.3.6 Description of service communication methods

In ROS1, all commands can be completed using the Tab key, but in ROS2, only topics can be completed, and the message part needs to be entered manually. When inputting data in ROS1, you can input it in the completion format. When inputting data in ROS2, you need to input it in the format of the yaml file. After the node is running, open a terminal under the lx_camera_node_ws folder, configure the environment in the terminal, and enter the command: source devel/setup.bash
5.3.6.1 Get the list of all parameter numbers (Lx_Cmd)
ros1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxCmd “cmd: 0”
Get all parameter number list (Lx\_Cmd) related icons
You can see the output:
Get all parameter number list (Lx\_Cmd) related icon 2
ret is the number of the parameter. The msg describes the parameter type and description, for example: 1001. This parameter is of type int. The parameter is used to obtain and modify the first exposure value. ros2 Enter in the terminal: ros2 service call /LxCamera_LxCmd lx_camera_ros/srv/LxCmd ‘cmd: 0’
Get all parameter number list (Lx\_Cmd) related icon 3
You can see the following output:
Get all parameter number list (Lx\_Cmd) related icon 4
Since it is not convenient to view parameter details in ROS2, the numbers, types and descriptions of all parameters are also listed in the following table: Some parameters need to stop the flow before they can be set, or there is a sequence of settings. Please contact the technical support staff for specific needs.
5.3.6.2 Get Int parameter (Lx_Int)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxInt “cmd: 1001 val: 0 is_set: false”
Get related icons of Int parameters (Lx\_Int)
You can see the output:
Get the related icon of Int parameter (Lx\_Int) 2
What is in the red box is the return value. What is obtained in the figure is the high integration time. According to the return result, you can see that the maximum value is 3600, the minimum value is 1, the current value is 1010, whether the setting is supported is supported, the interface call return value is 0, and the return value information is success.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxInt lx_camera_ros/srv/LxInt '{cmd: 1001,val: 0,is_set: false}'
Get the related icon of Int parameter (Lx\_Int) 3
You can see the output:
Get the related icon of Int parameter (Lx\_Int) 4
What is obtained in the figure is the high integration time. According to the returned results, we can see that the maximum value is 3600, the minimum value is 1, the current value is 1010, whether the setting is supported is supported, the return value of the interface call is 0, and the return value information is success.
5.3.6.3 Set Int parameters (Lx_Int)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxInt “cmd: 1001 val: 2000 is_set: true”
Illustrations related to setting Int parameters (Lx\_Int)
You can see the output:
Illustration 2 related to setting Int parameters (Lx\_Int)
What is in the red box is the return value. The high integration time is set in the figure. According to the return result, you can see that the maximum value is 3600, the minimum value is 1, the current value has been modified to 2000, whether the support setting is supported, the interface call return value is 0, and the return value information is success.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxInt lx_camera_ros/srv/LxInt '{cmd: 1001,val: 3000,is_set: true}'
Illustration 3 related to setting Int parameters (Lx\_Int)
You can see the output:
Illustration 4 related to setting Int parameters (Lx\_Int)
What is obtained in the figure is the high integration time. According to the returned results, we can see that the maximum value is 3600, the minimum value is 1, the current value has been modified to 3000, whether the setting is supported is supported, the interface call return value is 0, and the return value information is success.
5.3.6.4 Get Float parameters (Lx_Float)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxFloat “cmd: 2007 val: 0.0 is_set: false”
Get related icons of Float parameters (Lx\_Float)
You can see the output:
Get the related icon of Float parameter (Lx\_Float) 2
What is in the red box is the return value. What is obtained in the picture is the camera temperature. According to the return result, you can see that the maximum value is 120, the minimum value is -40, the current value is 49.6875, whether the setting is supported is not supported, the interface call return value is 0, and the return value information is success.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxFloat lx_camera_ros/srv/LxFloat '{cmd: 2007,val: 0,is_set: false}'
Obtain related icons of Float parameters (Lx\_Float) 3
You can see the output:
Get the related icon of Float parameter (Lx\_Float) 4
What is obtained in the picture is the camera temperature. According to the returned results, you can see that the maximum value is 120, the minimum value is -40, the current value is 50.4375, whether the setting is supported is not supported, the return value of the interface call is 0, and the return value information is success.
5.3.6.5 Set Float parameters (Lx_Float)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxFloat “cmd: 2007 val: 5.0 is_set: true”
Illustrations related to setting Float parameters (Lx\_Float)
You can see the output:
Illustration 2 related to setting Float parameters (Lx\_Float)
The red box is the return value. The camera temperature is set in the picture. According to the return result, you can see that the maximum value is 120, the minimum value is -40, the current value is 50.9375, whether the setting is supported is not supported, the interface call return value is -2, the return value information is not supported, the value set here is 5, the current value and the set value are inconsistent because the parameter does not support setting.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxFloat lx_camera_ros/srv/LxFloat '{cmd: 2007,val: 5.0,is_set: true}'
Illustration 3 related to setting Float parameters (Lx\_Float)
You can see the output:
Illustrations related to setting Float parameters (Lx\_Float) 4
The camera temperature is set in the picture. According to the returned results, you can see that the maximum value is 120, the minimum value is -40, the current value is 51.125, whether the setting is supported is not supported, the return value of the interface call is -2, the return value information is not supported, the value set here is 5, the current value and the set value are inconsistent because the parameter does not support setting.
5.3.6.6 Get Bool parameters (Lx_Bool)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxBool “cmd: 3012 val: false is_set: false”
Get related icons of Bool parameters (Lx\_Bool)
You can see the output:
Get Bool parameter (Lx\_Bool) related icon 2
What is in the red box is the return value. What is obtained in the picture is 2D automatic exposure. According to the return result, we can see that the current value is false, the return value of the interface call is 0, and the return value information is success.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxBool lx_camera_ros/srv/LxBool '{cmd: 3012,val: false,is_set: false}'
Get Bool parameter (Lx\_Bool) related icon 3
You can see the output:
Get Bool parameter (Lx\_Bool) related icon 4
What is obtained in the figure is 2D automatic exposure. According to the return result, we can see that the current value is false, the return value of the interface call is 0, and the return value information is success.
5.3.6.7 Set Bool parameters (Lx_Bool)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxBool “cmd: 3012 val: true is_set: true”
Illustrations related to setting Bool parameters (Lx\_Bool)
You can see the output:
Illustration 2 related to setting Bool parameters (Lx\_Bool)
What is in the red box is the return value. The 2D automatic exposure is set in the picture. According to the return result, we can see that the current value is true, the return value of the interface call is 0, the return value information is success, and the current value is consistent with the set value.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxBool lx_camera_ros/srv/LxBool '{cmd: 3012,val: true,is_set: true}'
Illustration 3 related to setting Bool parameters (Lx\_Bool)
You can see the output:
Illustrations related to setting Bool parameters (Lx\_Bool) 4
The setting in the picture is 2D automatic exposure. According to the return result, we can see that the current value is true, the return value of the interface call is 0, the return value information is success, and the current value is consistent with the set value.
5.3.6.8 Get String parameter (Lx_String)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxString “cmd: 4001 val: ” is_set: false”
Get related icons of String parameters (Lx\_String)
You can see the output:
Obtain String parameter (Lx\_String) related icon 2
What is in the red box is the return value. What is obtained in the figure is the device version number. According to the return result, we can see that the current value is V1.1.33_231201, the return value of the interface call is 0, and the return value information is success.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxString lx_camera_ros/srv/LxString '{cmd: 4001,val: '',is_set: false}'
Obtain String parameter (Lx\_String) related icon 3
You can see the output:
Get the related icon of String parameter (Lx\_String) 4
What is obtained in the figure is the device version number. According to the return result, we can see that the current value is V1.1.33_231201, the return value of the interface call is 0, and the return value information is success.
5.3.6.9 Set String parameters (Lx_String)
ROS1 Enter in the terminal: rosservice call /lx_camera_node/LxCamera_LxString “cmd: 4001 val: ‘put:\“123\”’ is_set: true”
Illustrations related to setting String parameters (Lx\_String)
You can see the output:
Illustration 2 related to setting String parameters (Lx\_String)
The red box is the return value. The device version number is set in the figure. According to the return result, we can see that the current value is V1.1.33_231201, the return value of the interface call is -2, and the return value information is not supported. The current value and the set value are inconsistent because this parameter does not support setting.
ROS2 Enter in the terminal: ros2 service call /LxCamera_LxString lx_camera_ros/srv/LxString '{cmd: 4001,val: "put:\\"123\\"",is_set: true}'
Illustration 3 related to setting String parameters (Lx\_String)
You can see the output:
Illustrations related to setting String parameters (Lx\_String) 4
The device version number is set in the figure. According to the returned result, we can see that the current value is V1.1.33_231201, the return value of the interface call is -2, and the return value information is not supported. The current value is inconsistent with the set value because this parameter does not support setting. When setting a value of String type, escape characters must be added to single quotes and double quotes, except for the initial double quotes in ROS2 and the initial single quotes in ROS1. For example, if you want to input the string [PUT”123”], you must add escape characters to become: [PUT\”123\”].
In the recommended hardware configuration, the analysis is based on CPU core count, CPU usage, and memory size. These are recommended configurations, not minimum requirements. If your hardware is below the recommendation, stable operation may still be possible by reducing stream output, disabling point-cloud computation, or lowering the algorithm load. Running a workload above the available configuration may crash the ROS core or Ubuntu. The second and third sections of this chapter provide detailed usage data. Choose the operating environment and stream configuration that best fits your system. All data here was collected in a VM using an M4 Pro camera. Ubuntu16.04 Ubuntu18.04 Ubuntu20.04 Ubuntu22.04

6.2 CPU details

The CPU details will show the amount of CPU resources occupied by the node under different operating conditions. The test is based on AMD64 [8 cores], 8G memory hardware environment, the test camera is M4 Pro, the test algorithm is tray algorithm, 2D width and height are 1280*960, and 3D width and height are 640*480, 2D anti-distortion is on, 3D anti-distortion is off, and integration 110 - 3000, depth 0 - 8000, ToF frame rate 14, streaming mode, smoothing level 1, noise level 1, time domain level 0, statistics command is TOP. Because the test soft environment is VM virtual machine, it is normal for the data displayed by the physical machine to fluctuate compared with that in the document. For some cameras, such as S2, some algorithms are calculated on the host computer, which results in a large amount of resource usage, which is normal.
1. Some nouns are explained as follows: -Single stream: refers to turning on any stream of RGB, depth, and intensity
  • Dual stream: refers to turning on any two streams of RGB, depth and intensity
-Three streams: refers to RGB, depth, and intensity all three streams are turned on
  • Four streams: means RGB, depth, intensity, and point cloud are all turned on
2. The algorithm has a binding relationship with some streams. The binding relationship is as follows:
  • To enable the pallet algorithm, the depth must be enabled
  • To turn on the obstacle avoidance algorithm, you must turn on depth
  • To turn on the positioning algorithm, you must turn on RGB

The light blue background in the table is the running configuration with point cloud enabled, and the colorless background is the running configuration without point cloud enabled. All the test data below have the algorithm shifted down by default, so for S2 series cameras, all test values ​​may be too small [some algorithms of S2 series cameras are forced to move up]. Ubuntu16.04 Ubuntu18.04 Ubuntu20.04 Ubuntu22.04

6.3 Memory details

The memory details will show the amount of memory resources occupied by the node under different operating conditions. The test is based on AMD64 [8 cores], 8G memory hardware environment, the test camera is M4 Pro, the test algorithm is tray algorithm, 2D width and height are 1280*960, and 3D width and height are 640*480, 2D anti-distortion is on, 3D anti-distortion is off, points 110 - 3000, depth 0 - 8000, ToF frame rate 14, streaming mode, smoothing level 1, noise level 1, time domain level 0, statistics command is TOP. Because the test soft environment is VM virtual machine, it is normal for the data displayed by the physical machine to fluctuate compared with that in the document. For some cameras, such as S2, some algorithms are calculated on the host computer, which results in a large amount of resource usage, which is normal.
1. Some nouns are explained as follows: -Single stream: refers to turning on any stream of RGB, depth, and intensity
  • Dual stream: refers to turning on any two streams of RGB, depth and intensity
-Three streams: refers to RGB, depth, and intensity all three streams are turned on
  • Four streams: means RGB, depth, intensity, and point cloud are all turned on
2. The algorithm has a binding relationship with some streams. The binding relationship is as follows:
  • To enable the pallet algorithm, the depth must be enabled
  • To turn on the obstacle avoidance algorithm, you must turn on depth
  • To turn on the positioning algorithm, you must turn on RGB
  1. The light blue background in the table is the running configuration with point cloud enabled, and the colorless background is the running configuration without point cloud enabled. All the test data below have the algorithm shifted down by default, so for S2 series cameras, all test values ​​may be too small [some algorithms of S2 series cameras are forced to move up].
Ubuntu16.04 Ubuntu18.04 Ubuntu20.04
Ubuntu22.04

Appendix

This appendix provides installation methods for some tools. When using these methods, you need to have at least some basic knowledge of Linux. There is no guarantee that every computer can be successfully installed through the methods shown in the appendix of this document. The environment of each computer is different, and the problems encountered may not be consistent. If you encounter problems not shown in this appendix, please search for solutions yourself.

1. Cmake specified version installation method

Go to https://cmake.org/download/ and download the required CMake version. Extract the downloaded package with tar -zxvf cmake-XXX.tar.gz. Enter the extracted directory, then compile and configure it: ./bootstrap make sudo make install Check the Cmake version to see if the installation is successful: cmake —version

2. Opencv specified version installation method

  1. Download the required version of opencv: Releases-OpenCV
Illustrations related to the installation method of the specified version of Opencv
  1. Environment configuration, execute the following commands in sequence:
sudo apt-get install build-essential sudo apt-getinstallcmake gitlibgtk2.0-devpkg-config libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
  1. Create a new opencv folder and extract the downloaded source code into the opencv folder.
  2. Execute the following commands in sequence:
  3.   cd opencv
  4.   mkdir build && cd build
  5.   sudocmake-DCMAKE_BUILD_TYPE=Release-D
  6.   CMAKE_INSTALL_PREFIX=/usr/local ..
  7.   sudo make -j4
  8. sudo make install and wait for the installation to complete

3. Pcl specified version installation method

  1. Check the supported pcl version:
apt-cache madison libpcl-dev
  1. Install the specified pcl version (where 1.10.0 needs to be replaced with the required version number):
sudo apt-get install libpcl-dev=1.10.0

4. Install ROS

Ubuntu16.04
  1. Add the software source and set the secret key:
sudo sh -c ‘echo “deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main” > /etc/apt/sources.list.d/ros-latest.list’ sudoapt-keyadv—keyserver’hkp://keyserver.ubuntu.com:80’—recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  1. Add secret key:
curl -sSL ‘http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654’ | sudo apt-key add -
  1. Update source:
sudo apt-get update
  1. Install complete ros:
sudo apt-get install ros-kinetic-desktop-full
  1. Configure environment variables:
echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc source ~/.bashrc
  1. Complete ROS-related tools:
sudoaptinstallpython-rosinstallpython-rosinstall-generatorpython-wstool build-essential
  1. Now that the installation of ROS1 is complete, run the example that comes with ROS to check whether the installation is correct:
Open a terminal and enter: roscore Open another terminal and enter: rosrun turtlesim turtlesim_node Open another terminal: rosrun turtlesim turtle_teleop_key In the third terminal, you can control the little turtle through the arrow keys If it can run normally as shown below, it means that ros has been installed correctly: Installation ROS related icons
Ubuntu18.04
  1. Set up the software source:
sudo sh -c ’. /etc/lsb-release && echo “deb http://mirrors.ustc.edu.cn/ros/ubuntu/ `lsb_release -cs` main” > /etc/apt/sources.list.d/ros-latest.list’ 2.Set the public key: sudoapt-keyadv—keyserver’hkp://keyserver.ubuntu.com:80’—recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  1. Update software list:
sudo apt update
  1. Install Ubuntu18.04 version of ROS1:
sudo apt install ros-melodic-desktop-full
  1. Set environment variables:
echo “source /opt/ros/melodic/setup.bash” >> ~/.bashrc source ~/.bashrc if it is zsh: echo “source /opt/ros/melodic/setup.bash” >> ~/.zshrc source ~/.zshrc
  1. Complete ROS-related tools:
sudoaptinstallpython-rosdeppython-rosinstallpython-rosinstall-generator python-wstool build-essential
  1. Now that the installation of ROS1 is complete, run the example that comes with ROS to check whether the installation is correct:
Open a terminal and enter: roscore Open another terminal and enter: rosrun turtlesim turtlesim_node Open another terminal: rosrun turtlesim turtle_teleop_key In the third terminal, you can control the little turtle through the arrow keys If it can run normally as shown below, it means that ros has been installed correctly:
Installation ROS related icons 2
Ubuntu20.04
  1. Configure the public key:
sudoapt-keyadv—keyserver’hkp://keyserver.ubuntu.com:80’—recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  1. If it shows that it cannot connect to the server or times out, please update the software source list first:
sudo apt-get update sudo apt-get upgrade
  1. After configuring the public key, update the software list again:
sudo apt-get update install ros: sudo apt install ros-noetic-desktop-full
  1. Set environment variables:
echo “source /opt/ros/noetic/setup.bash” >> ~/.bashrc source ~/.bashrc
  1. Install ROS tools:
sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
  1. Now that the installation of ROS1 is complete, run the example that comes with ROS to check whether the installation is correct:
Open a terminal and enter: roscore Open another terminal and enter: rosrun turtlesim turtlesim_node Open another terminal: rosrun turtlesim turtle_teleop_key In the third terminal, you can control the little turtle through the arrow keys If it can run normally as shown below, it means that ros has been installed correctly:
Installation ROS related icons 3
Ubuntu22.04 It is not recommended to install ros1 in Ubuntu22.04. It is not officially supported. If you want to install it, you will encounter a lot of dependency problems.

5. How to create a new test package in Ros

  1. Create a new folder ws, create a new src folder in the ws folder, enter the src folder and execute:
catkin_create_pkg example std_msgs rospy roscpp
  1. This creates a new package named example, which depends on std_msgs rospy roscpp
  2. Then compile this new package: catkin_make This is an empty package, there will not be any executable program, it is just a package
  3. Next, we will demonstrate how to create a package that can output ‘Hellow world’
  4. Based on the package just now, we enter the src folder (src in the package) and create a new main.cpp, as shown below (pay attention to the path):
Illustration of how to create a new test package in Ros
  1. In main.cpp, we enter some codes:
Ros How to Create a New Test Package Related Illustration 2
  1. Then we change the outside CMakeLists.txt and add a line at the bottom: add_executable(example src/main.cpp)
Ros How to Create a New Test Package Related Illustration 3
  1. Then return to the ws directory to compile and execute the command: catkin_make
Ros How to Create a New Test Package Related Illustration 4
  1. Seeing these means the compilation is successful.
  2. Next we configure the environment:
source devel/setup.bash
Ros How to Create a New Test Package Related Illustrations 5
  1. Then execute the program and you can see the output:
rosrun example example
Ros How to Create a New Test Package Related Illustrations 6

6. Install ROS2

Ubuntu16.04
  1. Add secret key:
sudo apt-get update && sudo apt-get install curl curl http://repo.ros2.org/repos.key | sudo apt-key add -
  1. Add permissions:
sudo apt update && sudo apt install curl gnupg2 lsb-release curl-shttps://raw.githubusercontent.com/ros/rosdistro/master/ros.asc|sudo apt-key add -
  1. If an error is reported in this step, use VPN to bypass the wall and then open the browser, enter the URL, and copy the content, then create a new ros.asc and copy the content to the file. After the copy is completed, the following is as follows:
  2. Then re-execute step 3: sudo apt-key add ros.asc
  3. Continue execution:
sudo sh -c ‘echo “deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionic main” > /etc/apt/sources.list.d/ros2-latest.list’
  1. Install ROS2:
sudo apt update sudo apt install ros-ardent-desktop
  1. Configure environment variables:
source /opt/ros/ardent/setup.bash
  1. Install the function package:
sudo apt-get update sudo apt-get install ros-ardent-ros1-bridge sudo apt-get install ros-ardent-turtlebot2-*
  1. Try running the example program, open a terminal and run:
source ~/.bashrc ros2 run demo_nodes_cpp talker
  1. Open another interrupt to run:
source~/.bashrc ros2 run demo_nodes_cpp talker
  1. The following terminal output proves that the installation is successful:
Ubuntu18.04:
  1. Add software source
sudo apt update && sudo apt install curl gnupg2 lsb-release curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc sudo apt-key add ros.asc
  1. If this step reports an error as follows:
  2. Use VPN to bypass the wall, then open the browser, enter the URL, and copy the content, then create a new ros.asc and copy the content to the file. After the copy is completed, it is as follows:
  3. Then re-execute step 3: sudo apt-key add ros.asc
  4. Continue execution:
sudo sh -c ‘echo “deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionic main” > /etc/apt/sources.list.d/ros2-latest.list’
  1. After completion, start downloading ros2, in which the red fonts need to be replaced with different versions (see the table above):
sudo apt update sudo apt install ros-eloquent-desktop
  1. Wait for the installation to complete and continue to install the python library. Execute: sudo apt install -y libpython3-dev python3-pip pip3 install -U argcomplete
Then configure the environment variables: echo “source /opt/ros/eloquent/setup.bash” >> ~/.bashrc source ~/.bashrc
  1. Try running the sample program, open a terminal and run:
source ~/.bashrc ros2 run demo_nodes_cpp talker
  1. Open another interrupt to run:
source ~/.bashrc ros2 run demo_nodes_py listener
  1. The following terminal output proves that the installation is successful:
Ubuntu20.04
  1. Add software source
sudo apt update && sudo apt install curl gnupg2 lsb-release sudo curl -sSL [https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o](https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o) /usr/share/keyrings/ros-archive-keyring.gpg
  1. If you encounter the error “ailed to connect to raw.githubusercontent.com port 443 after 13 ms: connection refused”
Installation ROS2 related icons 6
sudo vi /etc/hosts
  1. Add the following analysis
185.199.108.133raw.githubusercontent.com
  1. The added files are as follows:
Installation ROS2 related icons 7
echo”deb[arch=(source/etc/os-release&&echo$UBUNTU_CODENAME) main” | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
  1. Continue execution:
sudo sh -c ‘echo “deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionicmain” > /etc/apt/sources.list.d/ros2-latest.list’
  1. After completion, start downloading ros2:
sudo apt update sudo apt install ros-foxy-desktop
  1. Wait for the installation to complete and continue to install the python library. Execute: sudo apt install -y libpython3-dev python3-pip pip3 install -U argcomplete
  2. Then configure the environment variables:
echo “source /opt/ros/foxy/setup.bash” >> ~/.bashrc source ~/.bashrc
  1. Try running the sample program, open a terminal and run:
source ~/.bashrc ros2 run demo_nodes_cpp talker
  1. Open another interrupt to run:
source ~/.bashrc ros2 run demo_nodes_py listener
  1. The following terminal output proves that the installation is successful:
Ubuntu22.04
  1. Add software source
sudo apt update && sudo apt install curl gnupg lsb-release sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpgecho”deb[arch=(source/etc/os-release&&echo$UBUNTU_CODENAME) main” | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
  1. If you encounter the error “ailed to connect to raw.githubusercontent.com port 443 after 13 ms: connection refused”
Installation ROS2 related icons 9
sudo vi /etc/hosts adds the following analysis 185.199.108.133raw.githubusercontent.com The added files are as follows:
Installation ROS2 related icons 10
  1. After completion, start downloading ros2: sudo apt update
sudo apt install ros-humble-desktop
  1. Wait for the installation to complete and continue to install the python library. Execute: sudo apt install -y libpython3-dev python3-pip pip3 install -U argcomplete
  2. Then configure the environment variables:
echo “source /opt/ros/humble/setup.bash” >> ~/.bashrc source ~/.bashrc
  1. Try running the sample program, open a terminal and run:
source ~/.bashrc ros2 run demo_nodes_cpp talker
  1. Open another interrupt to run:
source ~/.bashrc ros2 run demo_nodes_py listener
  1. The following terminal output proves that the installation is successful:

7. How to create a new test package in Ros2

  1. Execute the command:
mkdir example_ws && cd example_ws ros2 pkg create —build-type ament_cmake —node-name example_n example_p colcon build source install/setup.bash ros2 run example_p example_n
  1. You can create a new package named example_p and a node named example_n. After running, it will output: hello world example_p package