36 #ifdef NODELETS_TEST_VERBOSE    37         printf(
"[publisher] Started\n");
    40         for (
int i = 0; i < 5; i++)
    42             std::this_thread::sleep_for(100ms);
    43             dir->getTopic(
"/robot/odom")->publish(
p_tx);
    46 #ifdef NODELETS_TEST_VERBOSE    47         printf(
"[publisher] Finish\n");
    50     catch (
const std::exception& e)
    52         cerr << e.what() << endl;
    56         printf(
"[thread_publisher] Runtime error!\n");
    62 #ifdef NODELETS_TEST_VERBOSE    63     std::cout << 
"sub2: rx TPose3D" << p.
asString() << std::endl;
    69 #ifdef NODELETS_TEST_VERBOSE    70     std::cout << 
"onNewMsg2: idx=" << idx << 
" rx TPose3D" << p.
asString()
    82 #ifdef NODELETS_TEST_VERBOSE    83         printf(
"[subscriber] Connecting\n");
    86 #ifdef NODELETS_TEST_VERBOSE    87         printf(
"[subscriber] Connected. Waiting for a message...\n");
    92             dir->getTopic(
"/robot/odom")
    95 #ifdef NODELETS_TEST_VERBOSE    96                         std::cout << 
"sub1: rx TPose3D" << p_rx.asString()
   104             dir->getTopic(
"/robot/odom")
   106                     std::function<void(const mrpt::math::TPose3D&)>(&
onNewMsg));
   109         auto sub3 = 
dir->getTopic(
"/robot/odom")
   113         using namespace std::placeholders;
   114         auto sub4 = 
dir->getTopic(
"/robot/odom")
   116                             [](
auto&& arg1) { 
return onNewMsg2(123, arg1); });
   120         std::this_thread::sleep_for(1000ms);
   122 #ifdef NODELETS_TEST_VERBOSE   123         printf(
"[subscriber] Finish\n");
   126     catch (
const std::exception& e)
   128         cerr << e.what() << endl;
   132         cerr << 
"[thread_subscriber] Runtime error!" << endl;
   138     using namespace std::chrono_literals;
   142     std::this_thread::sleep_for(1000ms);
 void onNewMsg(const mrpt::math::TPose3D &p)
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y z yaw pitch roll]"...
void onNewMsg2(int idx, const mrpt::math::TPose3D &p)
bool nodelets_test_passed_ok
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates). 
const mrpt::math::TPose3D p_tx(1.0, 2.0, 3.0, 0.2, 0.4, 0.6)
[example-nodelets] 
Serial and networking devices and utilities.