roscpp ServiceClient to standalone nodelet
Hi there, I hope my question is easy to answer. I'm trying to software trigger my ifm3d sensor using its service "Trigger" I have built this sample test code but the client always returns FALSE.
#include "ros/ros.h"
#include <cstdlib>
#include </include/ifm3d/camera_nodelet.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "trigger_ifm3d");
if (argc != 1)
{
ROS_INFO("usage: one args required, got %d", argc);
return 1;
}
ros::NodeHandle n;
ros::ServiceClient client = n.serviceClient<ifm3d::Trigger>("Trigger");
ifm3d::Trigger srv;
int res = client.call(srv);
if (res)
{
ROS_INFO("Status: %ld", (long int)srv.response.status);
}
else
{
ROS_ERROR("Failed to call service ifm3d::Trigger");
return 1;
}
return 0;
}
Note: my ifm3d include path is wrong, if I specify the full path from root it compiles, so there is something not quite right with my cmake file. I don't believe this is related to my service problem.
I can trigger camera using "rosservice call /ifm3d/camera/Trigger" command line command. So I know the camera is working and accepting triggers.
I think something is wrong with namespace or nodelet standalone thing. The source code for ifm3d is here on github ifm3d_ros
The code in camera_nodelet.h is way above my head and doesn't match the example shown here
any help appreciated, thanks.
Zonared...
I was just wondering if anybody has ever tried to access a rosservice served by a nodelet? My trigger_test cpp will only compile if i use node 'name' :: 'service name', like ifm3d::Trigger. But the actual service is running on ifm3d/camera/Trigger Is it because it's a nodelet? Thanks.