Hello there,
I am trying to write a little C++ package to apply custom made calibration files to my indigo system using the following code (inspired by [this](http://answers.ros.org/question/43623/how-to-call-service-set_camera_info-of-gscam-package/) thread):
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main(int argc, char **argv)
{
ros::init(argc, argv, "apply_camera_info");
if (argc != 3)
{
ROS_INFO("usage: apply_camera_info ");
return 1;
}
ros::NodeHandle n;
std::ostringstream oss;
oss << argv[1] << "set_camera_info";
std::string s = oss.str();
ros::ServiceClient client = n.serviceClient(s);
std::string camera_name = argv[1];
std::string filename = argv[2];
sensor_msgs::CameraInfo camera_info;
camera_calibration_parsers::readCalibration(filename, camera_name, camera_info);
sensor_msgs::SetCameraInfo srv;
srv.request.camera_info = camera_info;
if (client.call(srv))
{
std::ostringstream sss;
sss << srv.request.camera_info;
ROS_INFO("%s", sss.str().c_str());
ROS_INFO("Calibration successfully applied.");
}
else
{
ROS_ERROR("Failed to call service /set_camera_info");
return 1;
}
return 0;
}
Actually the code seems to work fine. ROS_INFO returns the correct camera_info values after running the command.
However, when I run `rostopic echo /camera_info` in another tab, I still get the old values. So no update is actually taking place.
Would you have any suggestions for me?
Btw: I am using a ueye camera.
Thanks
Ben
↧