ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

arv_camera_new() doesn't open the camera when called within a nodelet

asked 2018-02-19 22:12:19 -0500

Keerthi Raj gravatar image

updated 2018-02-21 13:26:56 -0500

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 ... (more)

edit retag flag offensive close merge delete

Comments

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.

lucasw gravatar image lucasw  ( 2018-02-20 12:27:30 -0500 )edit

I have reached out to the fork author. Waiting for their response.

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-20 12:52:57 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-02-22 05:50:46 -0500

Vincent R gravatar image

Here is a more up to date camera_aravis pkg :

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

It works fine for us in nodelet.

edit flag offensive delete link more

Comments

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.

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-22 18:12:20 -0500 )edit

Do you know why the "regex_split.c" test script was created in your package repo? Did you face a similar issue?

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-22 18:15:31 -0500 )edit

Yes I did this test because I also had this problem. But we use it now without problem on Ubuntu 16.04.

Vincent R gravatar image Vincent R  ( 2018-02-27 02:51:07 -0500 )edit

So, did you have a workaround for this issue in Ubuntu 14.04? What was your solution?

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-27 10:08:33 -0500 )edit

I did not find any solution for 14.04...

Vincent R gravatar image Vincent R  ( 2018-02-28 07:01:57 -0500 )edit
0

answered 2018-02-20 15:42:27 -0500

Link gravatar image

Have you tried using the tools provided with the underlying aravis library? It has been awhile but from what I remember the library provides some basic camera viewer that I initially used to test to make sure the underlying library was working. Looking at their github it seems like you could use the arv-viewer binary to test.

Also I apologize for the state of camera_aravis, in my fork I tried to combine the features all of the useful camera_aravis forks but these has not been well tested. All of the cameras used for testing were from The Image Source.

edit flag offensive delete link more

Comments

Thanks for the response. Yes, as mentioned in the question, the sample programs provided in the aravis library work fine. I am planning to use the nodelet architecture and that's what is causing the issues. Do I need to take care of anything in the nodelet?

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-20 15:49:52 -0500 )edit

I see it now. Sorry for the terrible knee jerk response on this. Lemme look back at how I was using this. I will try to find something that might be useful to ya.

Link gravatar image Link  ( 2018-02-20 16:04:17 -0500 )edit

I saw you tested with aravis 0.4 and 0.5.11. When testing 0.5.11 did you ensure 0.4 was completely removed? My hazy memory says that I added some changes that were specific to newer versions of aravis and I had to ensure aravis 0.4 was removed from my system before camera_aravis would link in 0.5.11

Link gravatar image Link  ( 2018-02-20 16:39:54 -0500 )edit

I first tested with 0.5.11 and it didn't work. So, I switched to 0.4 and I have been using that now for most of my debugging. I did run uninstall script for 0.5.11 to remove it before using 0.4. Is there a way to ensure only one version is present in my system?

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-20 16:54:14 -0500 )edit

find /usr -name 'aravis' will show all of the libraries and other things installed by aravis

Link gravatar image Link  ( 2018-02-20 17:00:50 -0500 )edit

Got this : /usr/local/share/doc/aravis

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-20 17:02:05 -0500 )edit

Actually that folder is empty. Nothing related to aravis is in /usr

Keerthi Raj gravatar image Keerthi Raj  ( 2018-02-20 17:09:56 -0500 )edit

Hmm I guess it could be installed somewhere else. Maybe check what the install paths are set to when the configure script is run?

Link gravatar image Link  ( 2018-02-20 19:39:18 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2018-02-19 22:12:19 -0500

Seen: 998 times

Last updated: Feb 22 '18