Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the synchronizer and the callback? (The two commented lines)

using namespace message_filters;
typedef control_sys::IntWithHeader mymsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const mymsg &in1, const mymsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<mymsg> sub1;
    message_filters::Subscriber<mymsg> sub2;
    typedef sync_policies::ApproximateTime<mymsg, mymsg> MySyncPolicy;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the synchronizer and the callback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader mymsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const mymsg &in1, const mymsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<mymsg> sub1;
    message_filters::Subscriber<mymsg> sub2;
    typedef sync_policies::ApproximateTime<mymsg, mymsg> MySyncPolicy;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the synchronizer and the callback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader mymsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const mymsg &in1, const mymsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<mymsg> sub1;
    message_filters::Subscriber<mymsg> sub2;
    typedef sync_policies::ApproximateTime<mymsg, mymsg> MySyncPolicy;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the synchronizer synchronizer and the callback? callback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader mymsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const mymsg &in1, const mymsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<mymsg> sub1;
    message_filters::Subscriber<mymsg> sub2;
    typedef sync_policies::ApproximateTime<mymsg, mymsg> MySyncPolicy;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the synchronizerSynchronizer and the callbackregisterCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader mymsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const mymsg &in1, const mymsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<mymsg> sub1;
    message_filters::Subscriber<mymsg> sub2;
    typedef sync_policies::ApproximateTime<mymsg, mymsg> MySyncPolicy;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader mymsg;
myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const mymsg myMsg &in1, const mymsg myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<mymsg> message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<mymsg> message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<mymsg, mymsg> sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h

"

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h
"control_sys/IntWithHeader.h"

"

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"
"myPackage/IntWithHeader.h"

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "myPackage/IntWithHeader.h"
"control_sys/IntWithHeader.h"

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update:Update 1: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

Update 2: Terminal output of catkin_make

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update 1: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

Update 2: Terminal Error output of catkin_make (in terminal)

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update 1: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

Update 2: Error output of catkin_make (in terminal)

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update 1: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

Update 2: Error output of catkin_make (in terminal)terminal)
Update 3: A copy and paste of the source file:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);
    sync.reset(new Sync(MySyncPolicy(10), sub1, sub2));   
    sync->registerCallback(boost::bind(&Node::callback, this, _1, _2));  

}

    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}  

private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    typedef Synchronizer<MySyncPolicy> Sync;
    boost::shared_ptr<Sync> sync;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);

};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");

    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update 1: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

Update 2: Error output of catkin_make (in terminal)
Update 3: A copy and paste of the source file:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);
    sync.reset(new Sync(MySyncPolicy(10), sub1, sub2));   
    sync->registerCallback(boost::bind(&Node::callback, this, _1, _2));  

}

    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}  

private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    typedef Synchronizer<MySyncPolicy> Sync;
    boost::shared_ptr<Sync> sync;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);

};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");

    Node synchronizer;

    ros::spin();

}

Synchronizer with approximate time policy in a class [C++]

I have been trying to implement a synchronizer with approximate time policy in a class. The following code compiles with no problem. But how should I define the Synchronizer and the registerCallback? (The two commented lines)

#include "header.h"
using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);

}
    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}   


private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    // This is how I would define them inside main()
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);
};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");
    Node synchronizer;

    ros::spin();

}

Update 1: Headers included:

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

Update 2: Error output of catkin_make (in terminal)
Update 3: A copy of the source file:
terminal)

#include <ros/ros.h>
#include <std_msgs/Int32.h>
#include <iostream>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include "control_sys/IntWithHeader.h"

using namespace message_filters;
typedef control_sys::IntWithHeader myMsg;

class Node
{

public:

    Node()
{
    sub1.subscribe(node, "in1", 1);
    sub2.subscribe(node, "in2", 1);
    sync.reset(new Sync(MySyncPolicy(10), sub1, sub2));   
    sync->registerCallback(boost::bind(&Node::callback, this, _1, _2));  

}

    void callback(const myMsg &in1, const myMsg &in2)
{
        std::cout << "Synchronization successful" << std::endl;
}  

private:

    ros::NodeHandle node;
    ros::Publisher pub;
    std_msgs::Int32 out;
    message_filters::Subscriber<myMsg> sub1;
    message_filters::Subscriber<myMsg> sub2;
    typedef sync_policies::ApproximateTime<myMsg, myMsg> MySyncPolicy;
    typedef Synchronizer<MySyncPolicy> Sync;
    boost::shared_ptr<Sync> sync;
    //Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), sub1, sub2);
    //sync.registerCallback(&callback);

};

int main(int argc, char **argv)
{

    ros::init(argc, argv, "synchronizer");

    Node synchronizer;

    ros::spin();

}