0
$\begingroup$

Rosanswers logo

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.


Originally posted by DreamHigh on ROS Answers with karma: 23 on 2017-04-15

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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)


Originally posted by rreignier with karma: 544 on 2017-04-16

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by DreamHigh on 2017-04-17:
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?

Comment by rreignier on 2017-04-17:
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/robot2017/tree/master/firmware/common/ros_lib).

Comment by DreamHigh on 2017-04-19:
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.

Comment by DreamHigh on 2017-04-19:
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.

Comment by rreignier on 2017-04-19:
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?

Comment by DreamHigh on 2017-04-21:
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.

Comment by rreignier on 2017-04-22:
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).

Comment by DreamHigh on 2017-04-24:
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 。

Comment by rreignier on 2017-04-24:
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?title=Boards_Manager_package). I have never worked with the SPL but if you can communicate with serial and a ring buffer, you can use rosserial.

Comment by DreamHigh on 2017-04-24:
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.

Comment by rreignier on 2017-04-24:
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

Comment by rreignier on 2017-04-24:
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.

Comment by DreamHigh on 2017-05-11:
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.

Comment by DreamHigh on 2017-05-11:
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.

Comment by DreamHigh on 2017-05-11:
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 protected].

Comment by rreignier on 2017-05-11:
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.

Comment by DreamHigh on 2017-05-11:
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.

Comment by rreignier on 2017-05-11:
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.

Comment by DreamHigh on 2017-05-12:
OK,I will clone it.I hope that you can give me some help during my debugging. can you give me you Email,I think it is more convenient to communicate.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.