Problem with serialization.h
Hi,
I've tried to code a simple service between a client node and a proxy node and i have this error :
In file included from /opt/ros/indigo/include/ros/publisher.h:34:0, from /opt/ros/indigo/include/ros/node_handle.h:32, from /opt/ros/indigo/include/ros/ros.h:45, from /home/mamy/ftm_ws/src/pbr/src/proxy/proxy.cpp:1: /opt/ros/indigo/include/ros/serialization.h: In instantiation of ‘static void ros::serialization::Serializer<t>::read(Stream&, typename boost::call_traits<t>::reference) [with Stream = ros::serialization::IStream; T = const client::SrvCltRequest_<std::allocator<void> >; typename boost::call_traits<t>::reference = const client::SrvCltRequest_<std::allocator<void> >&]’: /opt/ros/indigo/include/ros/serialization.h:163:32: required from ‘void ros::serialization::deserialize(Stream&, T&) [with T = const client::SrvCltRequest_<std::allocator<void> >; Stream = ros::serialization::IStream]’ /opt/ros/indigo/include/ros/serialization.h:900:25: required from ‘void ros::serialization::deserializeMessage(const ros::SerializedMessage&, M&) [with M = const client::SrvCltRequest_<std::allocator<void> >]’ /opt/ros/indigo/include/ros/service_callback_helper.h:176:49: required from ‘bool ros::ServiceCallbackHelperT<spec>::call(ros::ServiceCallbackHelperCallParams&) [with Spec = ros::ServiceSpec<const client::srvcltrequest_<std::allocator<void=""> >, client::SrvCltResponse_<std::allocator<void> > >]’ /home/mamy/ftm_ws/src/pbr/src/proxy/proxy.cpp:44:2: required from here /opt/ros/indigo/include/ros/serialization.h:136:5: error: ‘const struct client::SrvCltRequest_<std::allocator<void> >’ has no member named ‘deserialize’ t.deserialize(stream.getData());
here is my code and I don't understand this problem :
#include "ros/ros.h"
#include <iostream>
#include <stdio.h>
#include "std_msgs/String.h"
#include "std_msgs/Header.h"
#include "proxy.h"
#include "communication/MsgPxyPro.h"
#include "communication/MsgProPxy.h"
#include "client/SrvClt.h"
Proxy::Proxy(){
// Initialisation of Publisher on topic "Proxy - Protocol"
//pub_pxy_pro = nh.advertise<communication::MsgPxyPro>("/pxy2pro", 10);
// Initialisation of Subscriber on topic "Client - Proxy"
//sub_pro_pxy = nh.subscribe("/pro2pxy", 10, &Proxy::receiveAnswer,this);
// Init of the Server on service "Client - Proxy"
ser_clt = nh.advertiseService("clt2pxy", &Proxy::addId,this);
};
bool Proxy::addId(const client::SrvClt::Request &req, client::SrvClt::Response &res)
{
/*//msg_pxy_pro.request = req.request;
//msg_pxy_pro.id = req.header.seq; // A retravailler...
pub_pxy_pro.publish(msg_pxy_pro);
while (flag!=true)
{
usleep(100);
}
//for(int i = 0;sizeof(answer);i++){
// res.answer[i] = *(answer+i);
//}
flag = false; */
};
void Proxy::receiveAnswer(const communication::MsgProPxy msg_pro_pxy)
{
/*for(int i = 0;sizeof(msg_pro_pxy.answer);i++){
*(answer+i) = msg_pro_pxy.answer[i];
}
flag = true;*/
};
When I delete the line where I initiate my ser_clt, it compile without any problem, do you have a solution ?
Thx
Ps : Yes I've looked at my .h and everything should be alright
Edit :
For my organization I have 4 packages : - client - communication - pbr - tr - server
I dissociated the client and the server because they're should be independent at the end. I have, in my communication pkg, my proxy, my protocol and every msg and srv that not belong to the client and the server because they should be the same in my pbr pkg and tr pkg and I want to switch ...
yess....could be that you didn't link the library in CmakeLists file?? Please add it too.
and the structure of your project too. I mean folders, files....