Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Spinner {
- ros::NodeHandle n_;
- ros::Publisher spin_pub;
- ros::Subscriber sub;
- public:
- Spinner(ros::NodeHandle n) :
- n_(n)
- {
- spin_pub = n.advertise<geometry_msgs::Twist> ("/turtlebot_node/cmd_vel", 1000);
- sub = n.subscribe("/robot_pose_ekf/odom_combined", 1000, spin_cb); //Does not work!
- }
- void spin_cb(const geometry_msgs::PoseWithCovarianceStamped msg)
- {
- //do stuff
- }
- };
- int main(int argc, char** argv)
- {
- ros::init(argc, argv, "spin");
- ros::NodeHandle n;
- Spinner spin_object = Spinner(n);
- ros::spin();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement