subscribe to temperature sensor and humidity sensor messages fails to link [closed]

asked 2016-04-21 16:24:30 -0500

cnanda84 gravatar image

updated 2016-04-21 16:34:17 -0500

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 : sensor_msgs::Temperature and sensor_msgs::RelativeHumidity.

On subscriber I have the following :

define TEMP_SENSOR_MSG_TYPE sensor_msgs::Temperature define RELATIVE_HUM_MSG_TYPE sensor_msgs::RelativeHumidity typedef message_filters::sync_policies::ApproximateTime<temp_sensor_msg_type,relative_hum_msg_type> AppxSyncSensor;

 message_filters::Synchronizer<AppxSyncSensor> *syncApproximateSensor;

 message_filters::Subscriber<TEMP_SENSOR_MSG_TYPE> *tempSubscriber;
 message_filters::Subscriber<RELATIVE_HUM_MSG_TYPE> *humSubscriber;

image_transport::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);

Error: attached log file.C:\fakepath\error_logs_temp_sensor.bmp

-Cheers cn

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by cnanda84
close date 2016-04-21 16:47:57.387600


What is this a duplicate of?

gvdhoorn gravatar image gvdhoorn  ( 2016-04-22 01:46:40 -0500 )edit

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.

cnanda84 gravatar image cnanda84  ( 2016-04-22 16:08:33 -0500 )edit