how to call service set_camera_info of gscam package
Hi everybody, I'd like to call set_camera_info (sensor_msgs/SetCameraInfo) of gscam (http://www.ros.org/wiki/gscam). To do this, I've built a simple application:
#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/CameraInfo.h>
#include <sensor_msgs/SetCameraInfo.h>
#include <camera_calibration_parsers/parse_ini.h>
#include <cstdlib>
#include <vector>
using namespace std;
int main(int argc, char **argv)
{
ros::init(argc, argv, "set_camera_info");
if (argc != 2)
{
ROS_INFO("usage: set_camera_info gscam/set_camera_info");
return 1;
}
ros::NodeHandle n;
ros::ServiceClient client = n.serviceClient<sensor_msgs::SetCameraInfo>("gscam/set_camera_info");
sensor_msgs::SetCameraInfo srv;
srv.request.camera_info.width = 1344;
srv.request.camera_info.height =372;
boost::array<double, 9> K1 ={894.1981 ,0.0, 660.1406, 0.0, 892.7151, 261.1004, 0.0, 0.0, 1.0};
srv.request.camera_info.K=K1;
if (client.call(srv))
{
ROS_INFO("service called");
}
else
{
ROS_ERROR("Failed to call service gscam/set_camera_info");
return 1;
}
return 0;
}
But if I try to execute I'll get the following error:
[ERROR] [1347377843.117168101]: Failed to call service gscam/set_camera_info
What's going wrong?