LeoRover / leo_robot-ros2

Experimental Robot ROS2 packages for Leo Rover.
MIT License
3 stars 1 forks source link

QoS: Best effort #10

Open serna01 opened 1 month ago

serna01 commented 1 month ago

With all the difficulties known around DDS and lossy networks such as WiFi, it becomes a hustle trying to properly get live videos from the leo_rover using Rviz. I have tried setting up the QoS from Reliable to Best_effort wihtout success yet and thought maybe you could help me:

I cloned the bringup repository to make my custom version: $ cat src/launch/leo_bringup.launch.xml

       <launch version="0.1.1">

      <arg name="qos_reliability" default="best_effort" />

      <arg name="spawn_state_publisher"
        default="true"
        description="Whether to start the robot_state_publisher node" />

      <arg name="model"
        default="$(find-pkg-share leo_description)/urdf/leo.urdf.xacro"
        description="Absolute path to robot urdf.xacro file" />

      <arg name="mecanum_wheels"
        default="false"
        description="Flag specifying wheel types of the robot" />

      <arg name="tf_frame_prefix"
        default=""
        description="The prefix added to each published TF frame id" />

      <arg name="firmware_override_params_file"
        default=""
        description="Absolute path to the yaml file with firmware parameters to be overrided" />

      <include if="$(var spawn_state_publisher)"
        file="$(find-pkg-share leo_description)/launch/state_publisher.launch.xml">
        <arg name="model" value="$(var model)" />
        <arg name="mecanum_wheels" value="$(var mecanum_wheels)" />
      </include>

      <node pkg="web_video_server"
        exec="web_video_server" />

      <node name="rosbridge_server"
        pkg="rosbridge_server"
        exec="rosbridge_websocket">
        <param name="unregister_timeout" value="86400.0" />
      </node>

      <node pkg="rosapi" exec="rosapi_node">
        <param name="topics_glob" value="[*]" />
        <param name="services_glob" value="[*]" />
        <param name="params_glob" value="[*]" />
      </node>

      <node pkg="leo_fw" exec="firmware_message_converter">
        <param name="tf_frame_prefix" value="$(var tf_frame_prefix)" />
        <param from="$(find-pkg-share leo_bringup)/config/firmware_message_converter.yaml" />
      </node>

      <let if="$(var mecanum_wheels)" name="firmware_default_params_file"
        value="$(find-pkg-share leo_bringup)/config/firmware_mecanum_params.yaml" />
      <let unless="$(var mecanum_wheels)" name="firmware_default_params_file"
        value="$(find-pkg-share leo_bringup)/config/firmware_diff_drive_params.yaml" />

      <node pkg="leo_fw" exec="firmware_parameter_bridge">
        <param name="default_params_file_path" value="$(var firmware_default_params_file)" />
        <param name="override_params_file_path" value="$(var firmware_override_params_file)" />
      </node>

      <node_container namespace=""
        name="image_container"
        pkg="rclcpp_components"
        exec="component_container">
        <composable_node namespace="camera"
          name="v4l2_camera"
          pkg="v4l2_camera"
          plugin="v4l2_camera::V4L2Camera">
          <param from="$(find-pkg-share leo_bringup)/config/v4l2_camera.yaml" />
          <param name="camera_frame_id" value="$(var tf_frame_prefix)camera_optical_frame" />
          <extra_arg name="use_intra_process_comms" value="true" />
          <param name="qos_reliability" value="best_effort" />
        </composable_node>
        <composable_node namespace="camera"
          name="debayer"
          pkg="image_proc"
          plugin="image_proc::DebayerNode">
          <extra_arg name="use_intra_process_comms" value="true" />
        </composable_node>
        <composable_node namespace="camera"
          name="rectify_mono"
          pkg="image_proc"
          plugin="image_proc::RectifyNode">
          <extra_arg name="use_intra_process_comms" value="true" />
          <remap from="image" to="image_mono" />
          <param name="qos_reliability" value="best_effort" />
        </composable_node>
        <composable_node namespace="camera"
          name="rectify_color"
          pkg="image_proc"
          plugin="image_proc::RectifyNode">
          <extra_arg name="use_intra_process_comms" value="true" />
          <remap from="image" to="image_color" />
          <remap from="image_rect" to="image_rect_color" />
          <remap from="image_rect/compressed" to="image_rect_color/compressed" />
          <param name="qos_reliability" value="best_effort" />
        </composable_node>
      </node_container>

  <node pkg="leo_bringup"
    exec="leo_system" />
    </launch>

Modified the camera yaml: cat src/config/v4l2_camera.yaml

  /**:
    ros__parameters:
      video_device: /dev/video0
      pixel_format: YUYV
      output_encoding: rgb8
      image_size: [640, 480]
      time_per_frame: [1, 30]
      camera_info_url: package://leo_bringup/camera_info/leo_camera.yaml
      qos_reliability: best_effort
      qos_history: keep_last
      qos_depth: 10

$ nano /etc/ros/setup.bash

source /opt/ros/humble/setup.bash
#source /home/pi/ros2_ws/install/setup.bash
source /home/pi/leo_bringup/install/setup.bash

# Path to the launch file to start.
LAUNCH_FILE="/etc/ros/robot.launch.xml"

# Arguments passed to ros2 launch command
LAUNCH_ARGS=""

# Arguments passed to Micro-ROS agent
UROS_AGENT_ARGS="serial -D /dev/serial0 -b 460800"

### ROS Environment Variables
#export ROS_DOMAIN_ID=10
#export ROS_NAMESPACE="leo1"
#export ROS_LOCALHOST_ONLY=1
export RCUTILS_COLORIZED_OUTPUT=1

Any suggestions on how to change the QoS for the camera topic on the debayer node?

Thanks

bjsowa commented 1 month ago

There is no option in ROS Humble to override QoS of image_proc nodes. That option seems to be available from ROS Jazzy.

Do you use the compressed topics in Rviz?