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

Rosserial_mbed issue - wrong checksum for topic id and msg

asked 2019-01-09 09:56:50 -0600

EdCherie gravatar image

updated 2019-01-28 10:59:13 -0600

Hey all,

I have been working on mbed devices for a while and would want to integrate ROS into it for later purposes in the robot. I am using Nucleo F302R8 with MTi DK IMU. The code without ros works fine, no issues but eventually altered to ROS. Now the issue I have is that rosserial always loses sync or brings out different warning, in this case "wrong checksum for topic id and msg". I am publishing both GPS and IMU data through USB to Nucleo and the Nucleo reads using SPI protocol from motion tracker. There is no wiring as Nucleo has Arduino headers, thus the sensor is just stacked on top. I tried following solutions which did not work out:

  • buffer size for publishing message, publisher number limitation;
  • publishing outside interrupt;
  • different baudrate and SPI combination (higher baudrates than 115200kbps do work, but I am interested in this rate specifically);
  • Using different interrupts to read data - DRDY pin in Xsens motion tracker, Ticker interrupts on Nucleo board.
  • I do not run rosserial twice, not overpublishing over the same topic twice or other common mistakes that did bring out this warning message. I do suspect the combination of SPI freq. and baudrate selection, I did bring that to mbed community if it can be an issue but I also suspect that I have something wrong in my code as well. The code is as follows: /

    *XSENS with Nucleo L476RG microcontroller; The code can be used for slight modifications of the device configuration in post version 1.0; User can view specific configured states when in Config mode (available since version 0.4) or can completely remove usage of one (post version 0.9); The ROS integration will be available after version 0.9

    Current version 0.9
    
    */
    #include <ros.h>
    #include <sensor_msgs/Imu.h>
    #include <sensor_msgs/NavSatFix.h>
    #include <std_msgs/String.h>
    #include <std_msgs/Float32.h>
    #include <std_msgs/UInt32.h>
    #include "read_functions.h"
    #include "formating.h"
    #include "message_generation.h"
    
    
    
    ros::NodeHandle nh;
    sensor_msgs::Imu imu_msg;
    sensor_msgs::NavSatFix gps_msg;
    //SPI spi(PB_15, PB_14, PB_13); // For F302R8
    SPI spi(PA_7, PA_6, PA_5); //For L476RG
    DigitalOut cs(PB_6); 
    //Timer t;
    InterruptIn drdy(PB_3);
    MTRead mtr;
    MTFormat mtf;    
    DigitalOut rst(PB_5, 0);
    Ticker flipper;
    
    ros::Publisher imu("imu/data", &imu_msg);
    ros::Publisher gps("gps/fix", &gps_msg);
    //long publisher_timer = 0;
    //std_msgs::Float32 times;
    //std_msgs::UInt32 speed;
    bool flagg=false;
    //ros::Publisher tt("tt", &times);
    //ros::Publisher sp("speed", &speed);
    void rising()
    {
       // t.reset();
       // t.start();
        //mtr.readStatusPipe();
       // speed.data = SystemCoreClock;
       // t.stop();
       // times.data = 10.0 - t.read_ms();
       // sp.publish(&speed);
    
        mtr.readStatusPipe();
        flagg = true;
        //nh.logwarn("Flag true\r\n");
       // tt.publish(&times);
        }
    
    int main() {
        //t.start();
        nh.getHardware()->setBaud(115200);
        nh.initNode();
        //nh.advertise(tt);
        nh.advertise(imu);
        nh.advertise(gps);
        //nh.advertise(sp);
    
        imu_msg.header.frame_id = "/imu";
        gps_msg.header.frame_id = "/gps";
        spi.format(8,3);
        spi.frequency(312600);
        cs=1;
        while(!nh.connected()) nh.spinOnce();
        //mtr.force_reset();
    
        flipper.attach(&rising, 0.01);
        while(1){
             //drdy.rise(&rising);
             //
             //rising();
             if (flagg == true ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-19 15:34:01 -0600

busov gravatar image

You can try adding a delay to your loop, even a few milliseconds could make a difference.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-01-09 09:56:50 -0600

Seen: 1,771 times

Last updated: Aug 19 '22