Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sometimes the lifecycle cannot be set activate automatically #83

Closed
ahuazuipiaoliang opened this issue Mar 21, 2023 · 13 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@ahuazuipiaoliang
Copy link

Describe the bug
When I launch the ros2 driver, I cannot get pointcloud msgs or IMU msgs, then I have to activate the lifecycle manually by typing ros2 lifecycle set ouster/os_sensor activate.
I've seen the driver executes the command above, but it has no effect.

software version: fd76cc9
hardware: OS-1-32-U2
firmware:
image

Platform (please complete the following information):

  • Ouster Sensor? OS-1-32-U2
  • Ouster Firmware Version? v2.3.1
  • ROS version/distro? humble
  • Operating System? Ubuntu 22.04
  • Machine Architecture? x64
  • git commit hash fd76cc9
@ahuazuipiaoliang ahuazuipiaoliang added the bug Something isn't working label Mar 21, 2023
@Samahu
Copy link
Contributor

Samahu commented Mar 21, 2023 via email

@ahuazuipiaoliang
Copy link
Author

ahuazuipiaoliang commented Mar 21, 2023

launch file below. I have namespaces, so the ns is right.

<group>
      <push-ros-namespace namespace="top"/>
      <arg name="ouster_ns" default="ouster"
      description="Override the default namespace of all ouster nodes"/>
    <arg name="sensor_hostname" default="192.168.1.120"
      description="hostname or IP in dotted decimal form of the sensor"/>
    <arg name="udp_dest" default=""
      description="hostname or IP where the sensor will send data packets"/>
    <arg name="lidar_port" default="0"
      description="port to which the sensor should send lidar data"/>
    <arg name="imu_port" default="0"
      description="port to which the sensor should send imu data"/>
    <arg name="udp_profile_lidar" default=""
      description="lidar packet profile; possible values: {
      LEGACY,
      RNG19_RFL8_SIG16_NIR16_DUAL,
      RNG19_RFL8_SIG16_NIR16,
      RNG15_RFL8_NIR8
      }"/>
    <arg name="lidar_mode" default=""
      description="resolution and rate; possible values: {
      512x10,
      512x20,
      1024x10,
      1024x20,
      2048x10,
      4096x5
      }"/>
    <arg name="timestamp_mode" default="TIME_FROM_ROS_TIME"
      description="method used to timestamp measurements; possible values: {
      TIME_FROM_INTERNAL_OSC,
      TIME_FROM_SYNC_PULSE_IN,
      TIME_FROM_PTP_1588,
      TIME_FROM_ROS_TIME
      }"/>
    <arg name="metadata" default=""
      description="path to write metadata file when receiving sensor data"/>
    <arg name="tf_prefix" default="" description="namespace for tf transforms"/>
  
    <group>
      <push-ros-namespace namespace="$(var ouster_ns)"/>
      <node_container pkg="rclcpp_components" exec="component_container_mt" name="os_container" output="screen" namespace="">
        <composable_node pkg="ouster_ros" plugin="ouster_ros::OusterSensor" name="os_sensor">
          <param name="sensor_hostname" value="$(var sensor_hostname)"/>
          <param name="udp_dest" value="$(var udp_dest)"/>
          <param name="lidar_port" value="$(var lidar_port)"/>
          <param name="imu_port" value="$(var imu_port)"/>
          <param name="udp_profile_lidar" value="$(var udp_profile_lidar)"/>
          <param name="lidar_mode" value="$(var lidar_mode)"/>
          <param name="timestamp_mode" value="$(var timestamp_mode)"/>
          <param name="metadata" value="$(var metadata)"/>
        </composable_node>
        <composable_node pkg="ouster_ros" plugin="ouster_ros::OusterCloud" name="os_cloud">
          <param name="tf_prefix" value="$(var tf_prefix)"/>
          <param name="timestamp_mode" value="$(var timestamp_mode)"/>
        </composable_node>
        <composable_node pkg="ouster_ros" plugin="ouster_ros::OusterImage" name="os_image"/>
      </node_container>
    </group>
  
    <!-- HACK: configure and activate the sensor node via a process execute since state
      transition is currently not availabe through launch.xml format -->
    <executable cmd="$(find-exec ros2) lifecycle set sensing/lidar/top/$(var ouster_ns)/os_sensor configure"
      launch-prefix="bash -c 'sleep 0; $0 $@'" output="screen"/>
    <executable cmd="$(find-exec ros2) lifecycle set sensing/lidar/top/$(var ouster_ns)/os_sensor activate"
      launch-prefix="bash -c 'sleep 1; $0 $@'" output="screen"/>
    </group>

@ahuazuipiaoliang
Copy link
Author

ahuazuipiaoliang commented Mar 21, 2023

Hi Mark, when this happens what does the following command produce? ros2 lifecycle get ouster/os_sensor Thanks Ussama

I got inactive [2]

@ahuazuipiaoliang
Copy link
Author

Sometimes I got active [3].

@Samahu Samahu self-assigned this Mar 21, 2023
@Samahu
Copy link
Contributor

Samahu commented Mar 21, 2023

You could try switching to the python based launch files and see if this works better for you:

ros2 launch ouster_ros sensor.independent.launch.py param_files:=<path-to-your-param-files>

or

ros2 launch ouster_ros sensor.composite.launch.py param_files:=<path-to-your-param-files>

@ahuazuipiaoliang
Copy link
Author

ahuazuipiaoliang commented Mar 21, 2023

You could try switching to the python based launch files and see if this works better for you:

ros2 launch ouster_ros sensor.independent.launch.py param_files:=<path-to-your-param-files>

or

ros2 launch ouster_ros sensor.composite.launch.py param_files:=<path-to-your-param-files>

Thanks, I will try.
BTW, can we activate the lifecycle without setting manually?

@Samahu
Copy link
Contributor

Samahu commented Mar 21, 2023

BTW, can we activate the lifecycle without setting manually?

What do you mean? I am not sure that I quite understood your question? You would have to cycle through the node states till you reach the active(activated) state. That's what all launch files are doing automatically for you. The issue you are facing is that launch.xml files don't have a mechanism to do transition when it is approprite, the py launch files do have this ability, but they are a departure from what our users currently depend on and I haven't tested them thoroughly but they should work. Let me know if these launch files work better for you than the launch.xml files.

@Samahu
Copy link
Contributor

Samahu commented Apr 7, 2023

Thanks, I will try.

Following up on this issue, did you get to out the two launch files?

BTW, can we activate the lifecycle without setting manually?

All the launch files do activate the lifecycle automatically, however, the python based launch are event based while xml ones don't have this feature and the state change is requested after a delay

@Andre-ex9
Copy link

Hi, I think I'm facing the same issue. Sometimes automatic transitions don't work which cause os_sensor to stay in "unconfigured" mode.

I use ROS2 Humble with Ubuntu 22. The issue seems to appear with .py launch files only. I think It occurs about 1 out of 10 launches of the driver. Here is what is shown in the console:

ros2 launch ouster_ros sensor.composite.launch.py 
[INFO] [launch]: All log files can be found below XXXXXXXXXXXX
[INFO] [launch]: Default logging verbosity is set to INFO
XXXX/ros2_ws_2/install/ouster_ros/share/ouster_ros
XXXX/ros2_ws_2/install/ouster_ros/share/ouster_ros/config/viz.rviz
XXXX/ros2_ws_2/install/ouster_ros/share/ouster_ros
XXXX/ros2_ws_2/install/ouster_ros/share/ouster_ros/config/viz.rviz
[INFO] [component_container_mt-1]: process started with pid [32153]
[INFO] [os_sensor configure-2]: process started with pid [32155]
[INFO] [rviz2-3]: process started with pid [32158]
[rviz2-3] Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[component_container_mt-1] [INFO] [1684145415.909968969] [ouster.os_container]: Load Library: XXXX/ros2_ws_2/install/ouster_ros/lib/libos_sensor_component.so
[component_container_mt-1] [INFO] [1684145415.928985192] [ouster.os_container]: Found class: rclcpp_components::NodeFactoryTemplate<ouster_ros::OusterSensor>
[component_container_mt-1] [INFO] [1684145415.929130305] [ouster.os_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<ouster_ros::OusterSensor>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/ouster/os_sensor' in container '/ouster/os_container'
[component_container_mt-1] [INFO] [1684145415.971389428] [ouster.os_container]: Load Library: XXXXX/ros2_ws_2/install/ouster_ros/lib/libos_cloud_component.so
[component_container_mt-1] [INFO] [1684145415.983885531] [ouster.os_container]: Found class: rclcpp_components::NodeFactoryTemplate<ouster_ros::OusterCloud>
[component_container_mt-1] [INFO] [1684145415.985462279] [ouster.os_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<ouster_ros::OusterCloud>
[component_container_mt-1] [INFO] [1684145416.024632674] [ouster.os_cloud]: OusterCloud: node initialized!
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/ouster/os_cloud' in container '/ouster/os_container'
[component_container_mt-1] [INFO] [1684145416.028976457] [ouster.os_container]: Load Library: /home/andre-ex9/Dev/ros2_ws_2/install/ouster_ros/lib/libos_image_component.so
[component_container_mt-1] [INFO] [1684145416.035928723] [ouster.os_container]: Found class: rclcpp_components::NodeFactoryTemplate<ouster_ros::OusterImage>
[component_container_mt-1] [INFO] [1684145416.036191823] [ouster.os_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<ouster_ros::OusterImage>
[component_container_mt-1] [INFO] [1684145416.061128219] [ouster.os_image]: OusterImage: node initialized!
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/ouster/os_image' in container '/ouster/os_container'
[rviz2-3] [INFO] [1684145416.248137259] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-3] [INFO] [1684145416.248287257] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[rviz2-3] [INFO] [1684145416.294126314] [rviz2]: Stereo is NOT SUPPORTED
[INFO] [os_sensor activate-4]: process started with pid [32217]
[rviz2-3] [INFO] [1684145416.777730497] [rviz2]: Stereo is NOT SUPPORTED
[os_sensor configure-2] Node not found
[ERROR] [os_sensor configure-2]: process has died [pid 32155, exit code 1, cmd '/opt/ros/humble/bin/ros2 lifecycle set ouster/os_sensor configure'].
[os_sensor activate-4] Unknown transition requested, available ones are:
[os_sensor activate-4] - configure [1]
[os_sensor activate-4] - shutdown [5]
[ERROR] [os_sensor activate-4]: process has died [pid 32217, exit code 1, cmd '/opt/ros/humble/bin/ros2 lifecycle set ouster/os_sensor activate'].

@Samahu
Copy link
Contributor

Samahu commented May 15, 2023

@Andre-ex9 thanks for reporting your experience we may have a fix soon, so stay tuned.

@Samahu
Copy link
Contributor

Samahu commented Jul 20, 2023

This has been addressed by the #146. If you use the default sensor.launch.xml or driver.launch.py this would utilize the combined node\component os_driver rather than the three components (os_sensor, os_cloud and os_image). This simplifies the initialization of the driver and has other benefits.

sensor.launch.xml however, still relies on the command line invocation to update the node lifecycle. So if this still causing you an issue then you would be better off with driver.launch.py which is event based.

Please try it out and let me know if we can close this issue.

@Samahu
Copy link
Contributor

Samahu commented Jul 24, 2023

@ahuazuipiaoliang or @Andre-ex9 any chance that you have tried the updated driver? If I don't hear back on the issue within this week I am going to mark this this ticket as done. Please let me know of the update described in my previous comment has helped mitigate the problem.

@Samahu
Copy link
Contributor

Samahu commented Jul 25, 2023

Closing the issue due to inactivity, feel free to re-open if the issue is still present.

@Samahu Samahu closed this as completed Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants