subscribe to temperature sensor and humidity sensor messages fails to link
Hi All,
I am using ros indigo on Ubuntu 14.04 on an intel i7 platform. I am trying to subscribe to a sensor that is publishing two messages , temperature and humidity. On my subscriber I am using approximate time sync feature to get both messages. I am having trouble linking the code. I guess a fresh pair of eyes could help.
publisher is publishing messages of type : sensormsgs::Temperature and sensormsgs::RelativeHumidity.
On subscriber I have the following :
define TEMPSENSORMSGTYPE sensormsgs::Temperature
define RELATIVEHUMMSGTYPE sensormsgs::RelativeHumidity
typedef messagefilters::syncpolicies::ApproximateTime
message_filters::Synchronizer<AppxSyncSensor> *syncApproximateSensor;
message_filters::Subscriber<TEMP_SENSOR_MSG_TYPE> *tempSubscriber;
message_filters::Subscriber<RELATIVE_HUM_MSG_TYPE> *humSubscriber;
imagetransport::TransportHints hints(useCompressed ? "compressed" : "raw"); hintsM = hints;
tempSubscriber = new message_filters::Subscriber<TEMP_SENSOR_MSG_TYPE>(nh, tempTopicName, queueSize);
humSubscriber = new message_filters::Subscriber<RELATIVE_HUM_MSG_TYPE>(nh, humTopicName, queueSize);
syncApproximateSensor = new message_filters::Synchronizer<AppxSyncSensor>(AppxSyncSensor(queueSize), *tempSubscriber, *humSubscriber);
syncApproximateSensor->registerCallback(boost::bind(&Receiver::sensorDataCallback,this,_1,_2));
Error: attached log file.C:\fakepath\errorlogstemp_sensor.bmp
-Cheers cn
Asked by cnanda84 on 2016-04-21 16:24:30 UTC
Comments
What is this a duplicate of?
Asked by gvdhoorn on 2016-04-22 01:46:40 UTC
Hi, Just that the callback signature needs to be of the type sensor_msgs::TemperatureConsPtr, instead of just sensor_msgs::Temperature. Saw that in some of the questions posted adjacent to this thread.
Asked by cnanda84 on 2016-04-22 16:08:33 UTC