ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I'm not sure what is wrong with your code, but you might want to take a look at the Pronto LCM<->ROS translators. I have used those and know they work, so you should be able to find out the issue by comparing them with your code.

I'm not sure what is wrong with your code, but you might want to take a look at the Pronto LCM<->ROS translators. I have used those and know they work, so you should be able to find out the issue by comparing them with your code.

/edit: Update as per your comment below. I'm not sure why things don't work as is, but what you could try is alternating ros::spin and lcm's handle in your run loop so their callbacks are always triggered:

void MyClass::lcm_cb(const lcm::ReceiveBuffer *rbuf,
        const string &chan,
        const mav::pose_t *msg) {
     // SAVE LCM DATA TO CLASS MEMBER SO IT'S ACCESSIBLE IN ROS CALLBACK
}

MyClass::run() {

  LOOP_WITH_RATE
  {
    mylcm.handle();
    ros::spinOnce();
  }
}