0
$\begingroup$

Rosanswers logo

Platform Details:

Ubuntu 14.04 LTS Linux Kernel 4.4.0-112-generic

ROS Version: Indigo

ROS Package: camera_aravis from here - https://github.com/linknum23/camera_aravis

Aravis LIbrary - aravis-0.4.1 from here - http://ftp.acc.umu.se/pub/GNOME/sources/aravis/0.4/ . I have also tried version 0.5.11 with same results.

Cameras used (Same behavior with all cameras and all are GigE cameras):

  1. IDS GV-527xFA-C
  2. Allied Vision Mako G-319C
  3. Allied Vision GT1930C

Each camera is tested separately and is powered through PoE (Power over Ethernet) and the Ethernet packet size has been set to 9000 MTU.

Command to run after compiling the package: rosrun camera_aravis camera_node

The node then detects the camera and can print the device ID and also can access Vendor name and other camera specific parameters with Aravis API's. However, the call to arv_camera_new() in src/camera_nodelet.cpp returns NULL or doesn't return at all (hangs).

After trying different debugging methods, I narrowed down the issue to Nodelet manager in src/camera_node.cpp. In the modified camera_node.cpp below, the arv_camera_new() function can detect the camera and return a camera object.

#include <ros/ros.h>
#include <nodelet/loader.h>
#include <camera_aravis/camera_nodelet.h>

int main(int argc, char** argv)
{
  ros::init(argc, argv, "camera_node");
  //nodelet::Loader manager(true);
  //nodelet::M_string remappings;
  //nodelet::V_string my_argv;
  arv_update_device_list();
  printf("Devices: %d\n", arv_get_n_devices());
  ArvCamera *pCamera = arv_camera_new(NULL);
  if(pCamera){
    printf("Device Opened: %s\n",arv_camera_get_vendor_name(pCamera));
  }
  else{
     printf("Device couldn't be opened\n");
  }
  //manager.load(ros::this_node::getName(), "camera_aravis/CameraNodelet", remappings, my_argv);
  ros::spin();
}

As you can see, I have commented out the Nodelet Manager and directly calling the Aravis APIs to access the camera. I also wrote a separate non-ROS C++ program to use Aravis API's and can access the camera without any issues.

Further more, the test scripts provided within aravis library (Ex: tools/arvcameratest.c) work fine and can connect and stream data from the cameras.

So, the symptoms can be bolied down to arv_camera_new() and arv_open_device() (may be other similar APIs which I haven't tested) can find the camera directly in the node, but not when called within the nodelet. Another thing to note is that, other API's such as arv_get_n_devices(), arv_get_device_id() work fine in both node and nodelet.

I have reproduced the issue with two machines with same platform and software versions mentioned above. Note that the code is directly taken from the camera_aravis github repo mentioned above and modifications are only done to camera_node.cpp as shown above while debugging.

What might be going wrong? Anyone experienced similar issues with this package? Any help in debugging would be greatly appreciated.

EDIT:

After digging deeper into Aravis library(0.4.1) and glib (v2.0), I found out that the function g_regex_split behaves differently for a node and nodelet implementation. Below is the function call to g_regex_split in arvgvdevice.c

tokens = g_regex_split (arv_gv_device_get_url_regex (), filename, 0);

For the filename string - local:GV-527xFA-C_1_3_120.zip;70000000;3fd0, the tokens after regex splitting when we try to open the camera in a node are shown below and they seem correct.

tokens[0] = ""
tokens[1] = "local:"
tokens[2] = "GV-527xFA-C_1_3_120.zip"
tokens[3] = "70000000"
tokens[4] = "3fd0"

The tokens after regex splitting when we try to open the camera in a nodelet, are

tokens[0] = "l"
tokens[1] = "o"
tokens[2] = "c"
tokens[3] = "a"
tokens[4] = "l"

Because of the wrong splitting in the second case, the xml file for camera is not being read and hence the aravis can't open the camera.

I also noticed that there is a small test program in test/regex_split.c in the github repo of camera_aravis package which originated in this fork - https://github.com/vincentrou/camera_aravis.git (I have now switched my camera_aravis package to this fork). Perhaps the author created this test script to debug a similar issue? Although, there are no commits which talks about this issue. I have contacted the author.

Does this mean glib library when used within nodelets (threads), behaves differently? I am very new to both glib and threading. So, any help to debug this issue is very much appreciated.


Originally posted by Keerthi Raj on ROS Answers with karma: 7 on 2018-02-19

Post score: 0


Original comments

Comment by lucasw on 2018-02-20:
I was going to suggest making an issue on the main repo but it looks like that one isn't getting maintained, and there are many many forks with different variations- some of those may or may not have your issue. Maybe you can get in contact with one of the fork authors that has made recent changes.

Comment by Keerthi Raj on 2018-02-20:
I have reached out to the fork author. Waiting for their response.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Here is a more up to date camera_aravis pkg :

https://github.com/labex-imobs3/camera_aravis

It works fine for us in nodelet.


Originally posted by Vincent R with karma: 365 on 2018-02-22

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Keerthi Raj on 2018-02-22:
Thanks. Even with the updated camera_aravis pkg, the issues exists since the problem is with glib as I have mentioned in the EDIT part of the question details.

Comment by Keerthi Raj on 2018-02-22:
Do you know why the "regex_split.c" test script was created in your package repo? Did you face a similar issue?

Comment by Vincent R on 2018-02-27:
Yes I did this test because I also had this problem. But we use it now without problem on Ubuntu 16.04.

Comment by Keerthi Raj on 2018-02-27:
So, did you have a workaround for this issue in Ubuntu 14.04? What was your solution?

Comment by Vincent R on 2018-02-28:
I did not find any solution for 14.04...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.