How to write a motor driver like turtlebot dirver?

asked 2017-06-09 03:40:10 -0600

Irin gravatar image

hi, I'm super new with ros, i recently read some textbook, and i tried the slam using fake robot: turtlebot. and i want write a driver that can: 1. subscribe to a twist topic, and get messages like linear.x or something else 2. using the twist to control the robot, for example, if the node received linear.x = 1; it will move forward, and similar to the angular.z and other message

now: 1. the way i control my motor is to send GPIO signal to motor driver. the frequence of GPIO will affect the speed of motor, and i have 8 GPIO ports and can control 8 motor at the same time, and it they way i made the robot turn around 2. according to the method to control GPIO above, how can i write a node that has the functionality described above?

is there any similar project i can reference?

i'm crazy about this, i really appreciate if someone can help me! help!....!

edit retag flag offensive close merge delete


ROS is currently not good at real-time tasks (especially something as fast as PWM for motor control). A very common approach would be to implement your hardware control on a microcontroller or such with a (serial) interface to your (non-real-time) ROS PC node that is part of your larger system.

BrettHemes gravatar image BrettHemes  ( 2017-06-09 08:47:32 -0600 )edit

The ROS "driver" node in this case would provide the abstraction that I assume you are looking for and communicate any messages and/or service/action requests to your hardware controller.

BrettHemes gravatar image BrettHemes  ( 2017-06-09 08:49:33 -0600 )edit