[Solved] Rosbot-stm32-firmware build failed

Hello. I am a student studying ROS using rosbot 2.0.

I am following the page below.

If I proceed with the PlatformIO: build, it fails because there is no ImuDriver.h file.

But ImuDriver.h does exist.

How can I fix it?

Thanks for reading.

Hi Chokings,
adding new mbed_lib.json file will solve your problem.

obraz

Just imput there this lines:

{
    "name":"imu-driver",
    "macros":[],
    "config":{}
}

obraz

Best regards,
Paweł

1 Like

Thank you very much for your reply.

Build completed successfully.

However, when I start upload using PlatformIO: Upload, an error occurs and the upload fails.

How can I solve it?

Thank you!

Hi,
I have a better solution for you. You can use stm32loader, which should be ready to run on your rosbot.
All you need is firmware.bin file you can find there:
<dir/to/pio/workspace>/.pio/build/core2_diff/firmware.bin

You just need to :

  1. Use PlatformIO: Build

  2. Replace the firmware.bin file with the one that already exist on the robot (e.g. using sftp). In my case, this is what the robot home directory looks like:

obraz

  1. Type ./flash_firmware.sh - using this command you will run a script which will flash the firmware with stm32loader.

After a little while:
obraz

I hope this solution suits you. If you have any questions/troubles, do not hesitate to ask.

Best regards,
Paweł

1 Like

Thanks for the easy way.

./flash_firmware.sh can flash the firmware.

However, when roslaunch rosbot_ekf all.launch is executed, the same error message is repeated.

I modified the code to publish pwm.

https://github.com/pkowalsk1/rosbot-stm32-firmware/commit/928b7299a0f90a3c260a1074dcc8eca84a148c2e

How can I solve this?

thank you.

Hi,
can you tell me about which ROS and Ubuntu image version you are using? Are you sure you have the latest version of rosbot_ekf and rosbot_description packages?

Best regards,
Paweł

1 Like

Hi,

I downloaded it from the link below.

Thank you.

Hi chokings,

There is few different images on page Husarion Downloads. May I ask you to specify which one did you used :slight_smile:

Best regards,
Hubert

1 Like

I used * Ubuntu 18.04 + ROS Melodic + Docker + Husarnet client

Thank you.

Hi,

You said that:

Does this mean you checked if my version (without modification) works on your device?

If that works, please check your serial_baudrate in this rosbot_ekf package launch file. It should be 525000.

Please, check it and let me know about it. If you have any questions/troubles, do not hesitate to ask.

Best regards,
Paweł

1 Like

Hi,

After editing the rosserial_bridge.launch file, I was confirmed that the pwm signal was published normally.

But I wonder why I get a value of 1.0 when the wheel is not moving?

Thank you so much for your help in solving the problem.

Hi,
It is becouse:

Best regards,
Paweł

1 Like

Hi.

In the previous code, I modified the code to get the PWM values of each of the 4 motors.

I changed std_msgs/Float32.h - > std_msgs/Float32MultiArray.h.

And also, i changed pwm publish part.

// PWM
float pwm[] = {0, 0, 0, 0};

if (pwm_publish_flag)
        {   
            // Get duty cycle 
            // '(RosbotMotNum)1' corresponds to Motor1 
            pwm[0] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)1, SpeedMode::DUTY_CYCLE);
            pwm[1] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)2, SpeedMode::DUTY_CYCLE);
            pwm[2] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)3, SpeedMode::DUTY_CYCLE);
            pwm[3] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)4, SpeedMode::DUTY_CYCLE);

            pwm_msg.data = pwm;
            if (nh.connected())
                pwm_pub->publish(&pwm_msg);
        }

After flashing my rosbot, I launched “roslaunch rosbot_ekf all.launch”

Then, the following error occurs.

image

How can I fix it?

Thank you!

Hi,
the buffer seems to be over filled ( see q/a ). Try increasing the buffer size or reducing the message size.

Best regards,
Paweł

Hi,

I checked the 3 links below.

https://answers.ros.org/question/214256/fake-laserscan-on-arduino-2560-the-laserscan-data-seems-to-transfer-correctly-except-the-program-hangs-up-after-11-18-successful-data-transfers/

http://wiki.ros.org/rosserial/Overview/Limitations

https://answers.ros.org/question/73627/how-to-increase-rosserial-buffer-size/

Now I know there is a limit in the message.

I modified it like the code below, but the same error as before occurred.

// PWM
float pwm[4] = {0, 0, 0, 0};

if (pwm_publish_flag)
        {   
            // Get duty cycle 
            // '(RosbotMotNum)1' corresponds to Motor1 
            pwm[0] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)1, SpeedMode::DUTY_CYCLE);
            pwm[1] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)2, SpeedMode::DUTY_CYCLE);
            pwm[2] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)3, SpeedMode::DUTY_CYCLE);
            pwm[3] = RosbotDrive::getInstance().getSpeed((RosbotMotNum)4, SpeedMode::DUTY_CYCLE);

            pwm_msg.data = pwm;
            if (nh.connected())
                pwm_pub->publish(&pwm_msg);
        }

and I changed buffer size in ros_lib/ros/node_handle.h.
increased from default 512 to 1024.

But the problem was not solved.

The same error message is repeated.

How can I solve it?

Thank you!

Hi,
I’m afraid your question is not related to the Husarion products. You can ask a question on the official ROS website.

Best regards,
Paweł