ros-drivers / openni2_camera

ROS wrapper for openni 2.0
http://wiki.ros.org/openni2_camera
BSD 3-Clause "New" or "Revised" License
56 stars 95 forks source link

Add a simple roswtf plugin that checks the number of connected devices #80

Closed 130s closed 6 years ago

130s commented 6 years ago

In some applications specific number of sensors are required to run as expected. This PR adds roswtf plugin to check the number of the sensors plugged in to the computer your application runs on.

Example: by plugging 2 sensors, the check fail if openni2_num_sensors is not changed (default=1).

$ lsusb
:
Bus 005 Device 002: ID 1d27:0601 ASUS 
Bus 003 Device 002: ID 1d27:0601 ASUS 

term-1$ roscore

term-2$ roswtf

Loaded plugin tf.tfwtf
Loaded plugin openni2_launch.wtf_plugin
No package or stack in context
================================================================================
Static checks summary:

Found 1 error(s).

ERROR One or more openni2 sensors not found.
 * 2 openni2 sensors found while 1 expected.

================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules

Online checks summary:

Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /rosout:
   * /rosout

After setting openni2_num_sensors param with 2, no error occurs.

term-2$ rosparam set openni2_num_sensors 2

$ roswtf                                                                                                                                                                    
Loaded plugin tf.tfwtf
Loaded plugin openni2_launch.wtf_plugin
No package or stack in context
================================================================================
Static checks summary:

No errors or warnings
================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules

Online checks summary:

Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /rosout:
   * /rosout
130s commented 6 years ago

https://github.com/ros-drivers/openni2_camera/pull/80#discussion_r193302887

I'm tempted to create kinetic-devel and re-open this PR against that

I scratch that. Because I need to have this working on Indigo as well, I just replaced the code with what works on Trusty without depending on a special library. Just tested on Trusty with 2 Xtions plugged in.

$ rosparam get openni2_num_sensors_expected
ERROR: Parameter [/openni2_num_sensors_expected] is not set

$ roswtf
Loaded plugin tf.tfwtf
Loaded plugin openni2_launch.wtf_plugin
No package or stack in context
================================================================================
Static checks summary:

Found 1 error(s).

ERROR Different number of openni2 sensors found.
 * 2 openni2 sensors found (expected: 1).

================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules

Online checks summary:

Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /rosout:
   * /rosout

$ rosparam set openni2_num_sensors_expected 2
$ roswtf                                                                                                                                                             
Loaded plugin tf.tfwtf
Loaded plugin openni2_launch.wtf_plugin
No package or stack in context
================================================================================
Static checks summary:

No errors or warnings
================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules

Online checks summary:

Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /rosout:
   * /rosout

$ rosparam set openni2_num_sensors_expected 3
$ roswtf
Loaded plugin tf.tfwtf
Loaded plugin openni2_launch.wtf_plugin
No package or stack in context
================================================================================
Static checks summary:

Found 1 error(s).

ERROR Different number of openni2 sensors found.
 * 2 openni2 sensors found (expected: 3).

================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules

Online checks summary:

Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /rosout:
   * /rosout

ROS buildfarm CI fails same as https://github.com/ros-drivers/openni2_camera/pull/57#issuecomment-341867534, which is ignorable (we'll have to disable it on the next release to rosdistro).

130s commented 6 years ago

@mikeferguson Since you left a comment, which was very helpful, can you give another look? I summarized the result in https://github.com/ros-drivers/openni2_camera/pull/80#issuecomment-395544574

mikeferguson commented 6 years ago

Packaging aspects LGTM -- I know nothing about the roswtf stuff.

130s commented 6 years ago

ROS buildfarm CI fails but can be ignored same as #55. On the next release I'll disable it.

This has been tested on our weekly test and works fine. Merging once Travis CI passes but please open tickets for any issues.

130s commented 6 years ago

ABI check failed only for Melodic https://travis-ci.org/ros-drivers/openni2_camera/jobs/405168671#L1587

Preparing, please wait ...
ERROR: no symbols info in the ABI dump
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Function abi_check_libopenni2_camera_nodelet returned with code '7' after 0 min 0 sec 

Not sure what's the error in the output.

Merging, but this needs a closer look before making a new release to Melodic.