Message filter errors

asked 2017-02-02 09:08:30 -0500

ashwath1993 gravatar image

I have tried to to solve the error in my code by going through the suggestions on previous answers on the message_filter topic but it hasn't solved the error. This is my first time trying to run a message_filter based code, which i took from an example on ros answers. The code is as follows

#include <ros/ros.h>
#include "std_msgs/String.h"
#include <message_filters/subscriber.h>
#include <message_filters/time_synchronizer.h>

using namespace message_filters;
void callback(const std_msgs::String::ConstPtr& msg,const std_msgs::String::ConstPtr& msg2)
{
ROS_INFO("IT WORKS");
}

int main(int argc, char** argv)
{
ros::init(argc, argv, "db_creator_node");
ros::NodeHandle nh;

message_filters::Subscriber<std_msgs::String> rgb_sub(nh,"/camera/rgb/image_rect",1);
message_filters::Subscriber<std_msgs::String> dpt_sub(nh,"/camera/depth/image_rect_raw",1);
TimeSynchronizer<std_msgs::String,std_msgs::String> sync(rgb_sub,dpt_sub,10);
sync.registerCallback(boost::bind(&callback, _1, _2));
ros::spin();
return 0;
}

My CMakeLists.txt is as follows

cmake_minimum_required(VERSION 2.8.3)
project(functionblocks)
find_package(catkin REQUIRED COMPONENTS
pluginlib
roscpp
std_msgs
message_generation
message_filters
)

## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system)
 generate_messages(
 DEPENDENCIES
std_msgs
)
include_directories(
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_LIBRARIES})
add_executable(testing_filter src/testing_filter.cpp)
target_link_libraries(testing_filter ${catkin_LIBRARIES} ${Boost_LIBRARIES})  
add_dependencies(testing_filter functionblocks_generate_messages_cpp)

Catkin_make does gives a lot of errors and also states that cc1plus: warning: /usr/lib/i386-linux-gnu/libboost_system.so: not a directory
I do not what should be added to the CMakeLists.txt or the error in the code. Thanks!

edit retag flag offensive close merge delete

Comments

try without colons "::"

void callback(const std_msgs::StringConstPtr& msg,const std_msgs::StringConstPtr& msg2)
Abdulbaki gravatar imageAbdulbaki ( 2018-03-20 11:09:58 -0500 )edit