linorobot / linorobot2_hardware

Apache License 2.0
104 stars 90 forks source link

Odometry topic is empty #6

Closed crimean7 closed 2 years ago

crimean7 commented 2 years ago

Hey guys,

I really need your assistance to resolve the issue I have experiencing.

Architecture:

The Issue: In calibration process the encoder is working fine. Once firmware is flashed then no data on /odom/unfiltered

Thanks in advance for your help

kajMork commented 2 years ago

I have the same problem. Setup is the same, except that I use a Teensy 4.1 and this Pololu motor. Calibration process for encoder is also working fine for me, and other topics such as "imu/data" and "cmd_vel" works fine.

kajMork commented 2 years ago

I solved the problem by changing rclc_publisher_init_best_effort to rclc_publisher_init_default at where the odometry publisher is created. So from:

    // create odometry publisher
    RCCHECK(rclc_publisher_init_best_effort( 
        &odom_publisher, 
        &node,
        ROSIDL_GET_MSG_TYPE_SUPPORT(nav_msgs, msg, Odometry),
        "odom/unfiltered"
    ));

To

    // create odometry publisher
    RCCHECK(rclc_publisher_init_default( 
        &odom_publisher, 
        &node,
        ROSIDL_GET_MSG_TYPE_SUPPORT(nav_msgs, msg, Odometry),
        "odom/unfiltered"
    ));