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

How to use ros and stm32 communication

asked 2017-04-15 07:04:14 -0500

DreamHigh gravatar image

I would like to use stm32 to write the motor driver, use ROS to control, but I do not know how to use rosserial and stm32 communication.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-04-16 11:18:24 -0500

rreignier gravatar image

updated 2017-04-24 07:01:09 -0500

Hello,

It will depend on which framework you use to program your microcontroller.

For example there is already rossserial-mbed that works with boards supported by mbed. If you are not using mbed, you have to create the interface in the hardware file. Basically, you have to provide a method to write a byte on a buffered serial port, a method to read a byte from a buffered serial port and a method to give the time elapsed since the beginning of the program in milliseconds.

For example :

Everything is explained in the wiki.

(Edited for better formatting)

edit flag offensive delete link more

Comments

Thanks very much,I have found rosserial_stm32f1 package(https://github.com/spiralray/stm32f1_rosserial.git),but this project has some error when i run it .So i want to move roslib in this project to stm32 stlibrary,then using topic communicate with ros,What do you think about it?

DreamHigh gravatar image DreamHigh  ( 2017-04-17 06:39:03 -0500 )edit

I have never used stm32plus so I cannot help you with this library. In the meantime, I have fixed the issue with the one using ChibiOS. And I am using it successfully right now ( https://github.com/romainreignier/rob... ).

rreignier gravatar image rreignier  ( 2017-04-17 11:03:59 -0500 )edit

Congratulatios!But,I have never used ChibiOS.Though I had a simple look at it, i am no idea how to use it.If you can ,i hope you can give me a tutorial of ChibiOS. thx again.

DreamHigh gravatar image DreamHigh  ( 2017-04-19 01:36:10 -0500 )edit

Congratulatios!But,I have never used ChibiOS.Though I had a simple look at it, i am no idea how to use it.If you can ,i hope you can give me a tutorial of ChibiOS. thx again.

DreamHigh gravatar image DreamHigh  ( 2017-04-19 01:38:11 -0500 )edit

I can give you a simple example on how to run rosserial with ChibiOS but the difficulty is to use the several stm32 peripherals. No, I think, the best for you is to create a rosserial hardware file for the stm32 environnement you are used to. Maybe I can help you. Whick frameworks it is?

rreignier gravatar image rreignier  ( 2017-04-19 02:08:48 -0500 )edit

I‘m so appreciated for your help. As for the hardware,I use the develop kit with STM32f103RCT6 MCU. And I puzzled about the communication between ros and the STM32f103.

DreamHigh gravatar image DreamHigh  ( 2017-04-21 21:18:29 -0500 )edit

Ok but which library do you use to program it? The easiest way is to use the Arduino port for STM32F1 from stm32duino. I have just added support for it in rosserial, I hope it will be merged soon (PR).

rreignier gravatar image rreignier  ( 2017-04-22 09:44:54 -0500 )edit

I use the STLIB 3.5 version with function. but i have never used stm32duino.According to the information online ,I think the usage of this library is the same as arduino 。

DreamHigh gravatar image DreamHigh  ( 2017-04-24 02:55:40 -0500 )edit

Yes exactly, you add a link in the Arduino IDE and optionally a USB Bootloader and then you code like with an Arduino ( http://wiki.stm32duino.com/index.php?... ). I have never worked with the SPL but if you can communicate with serial and a ring buffer, you can use rosserial.

rreignier gravatar image rreignier  ( 2017-04-24 03:20:22 -0500 )edit

I usually use keil MDK to design my project.If you tell me how to use rosserial in keil ,(transplant rosserial to STlib 3.5 version).I can use roslib to design my project in keil.Meanwhile, i am trying use stm32duino.

DreamHigh gravatar image DreamHigh  ( 2017-04-24 06:52:43 -0500 )edit

Ok, I have definitely never use these tools so I cannot help you precisely. But you only have to implement the 4 methods (init, read, write, time) in a Hardware.cpp file and instantiate the class in the ros.h (see my 1st comment for an example). 1/2

rreignier gravatar image rreignier  ( 2017-04-24 07:07:54 -0500 )edit

2/2 Then put these 2 files in a ros_lib folder in your Keil project. Then in the parent directory, run rosrun rosserial_client make_libraries.py . that will generate all the files. Now you are able to use rosserial like in the rosserial_arduino examples.

rreignier gravatar image rreignier  ( 2017-04-24 07:10:10 -0500 )edit

OK,but I have had buy a board-STM32F429ZI nucleo. This board support mbed. So ,I will use rosserial_mbed. Thank you again. Can you give me some data which can help me finish my project about ROS communicate with this board control motor.

DreamHigh gravatar image DreamHigh  ( 2017-05-11 03:40:56 -0500 )edit

ROS sent the information is the line speed and angular speed, but I do not have any ideas to imagine through the speed control robot. Although I know the use of PWM, but still particularly at a loss. I hope you can give me some ROS bottom control motor help. thank you.

DreamHigh gravatar image DreamHigh  ( 2017-05-11 03:41:09 -0500 )edit

If you have slam tutorial(It is best to video tutorial.),I hope that you can give me .thank you .It would be nice if could follow you.My Email-892153623@qq.com .

DreamHigh gravatar image DreamHigh  ( 2017-05-11 03:53:39 -0500 )edit

Hi, your latest questions are far from the topic of this one. To keep ros.answers consistent, you should look for other already existing questions and wiki pages (see GMapping / Cartographer and diff_drive_controller for example). Don't forget to mark this one as answered.

rreignier gravatar image rreignier  ( 2017-05-11 04:15:27 -0500 )edit

I'm so sorry,this is my fault. I hope you can give me some ROS bottom control motor help.thank you.I don't konw why this forum remind me.

DreamHigh gravatar image DreamHigh  ( 2017-05-11 07:35:38 -0500 )edit

About motor control, it is a large question, you should precise your need in another topic. Do you need to control the speed of the motor and send the command through rosserial? Because it is exactly what I am doing in my my project I gave you the link in my second comment.

rreignier gravatar image rreignier  ( 2017-05-11 07:56:29 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-04-15 07:04:14 -0500

Seen: 9,521 times

Last updated: Apr 24 '17