Ask Your Question
0

DC MOTOR + ENCODER + PYTHON

asked 2016-10-12 01:53:30 -0500

Tvlad gravatar image

updated 2016-10-12 01:53:57 -0500

Hello, everyone. I have the next equipment: https://www.pololu.com/product/2598 , https://www.pololu.com/product/2208 and raspberry pi.

I want to control the dc motors via ROS and Python. Is it possible? I can't find some good example or tutorials. I will be so appreciated if you will help me. Thank you.

edit retag flag offensive close merge delete

Comments

did you solve your problem?

Mekateng gravatar image Mekateng  ( 2017-10-21 16:31:06 -0500 )edit

did you solve the problem @Tvlad

Mekateng gravatar image Mekateng  ( 2017-11-21 10:23:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-10-13 01:08:38 -0500

Mark Rose gravatar image

I have a small robot that uses similar Pololu motors with ROS. A few considerations:

  • You might want motors with a lower gear ratio. Depending on the size of your robot, and how fast you want to move, you might want to consider the 210:1 or 150:1 motors. Also depends on your wheel size, of course.
  • You'll want wheel encoders, such as these Hall-effect encoders from Pololu.

For my robot I use the ROS package ros_arduino_bridge for both the Arduino code and the Python ROS controller node. It's unclear whether you intent to have a microcontroller for the motors. I'm using a Pololu A-Star connected to a Raspberry Pi running ROS. If you were to use an A-Star, Marco Werther's fork has support for the A-Star motor controller.

If you provide some more details about the rest of your hardware, I could provide more suggestions for a controller or ROS nodes you might want.

edit flag offensive delete link more

Comments

Dear Mark.Thank you for your feedback. The hardware is easy: Raspberry PI3 + 2 DC motor and encoders + Line follower. Line follower link is : https://www.sparkfun.com/products/135... I will be so appreciated if you will help me. Thank you very much. Best Regards

Tvlad gravatar image Tvlad  ( 2016-10-13 08:56:56 -0500 )edit

You may find it useful to have an Arduino-class microcontroller for doing low-level PID control, etc., rather than doing it on the Pi. Also, the line follower array you've chosen is a 5V device, so you'll have to either talk to it from an Arduino to use level shifters.

Mark Rose gravatar image Mark Rose  ( 2016-10-13 11:31:56 -0500 )edit

The Pololu A-Star ( https://www.pololu.com/product/3117 ) plugs in to the Pi GPIO bus, and has a voltage regulator that can take a variety of battery voltages, and will power the Pi, too. It has on-board H-bridges to run the motors off the battery power.

Mark Rose gravatar image Mark Rose  ( 2016-10-13 11:33:52 -0500 )edit

You can, instead, control everything from the RPi, but you will need a voltage regulator and level shifters. Since you don't have any distance sensors, you won't be able to use the ROS navigation stack. Instead, write your own node to do line following.

Mark Rose gravatar image Mark Rose  ( 2016-10-13 11:35:13 -0500 )edit

Thanks for your answer. So, in this case, I can't create few nodes and just tell to dc motors the distance(use Python...rospy)?

Tvlad gravatar image Tvlad  ( 2016-10-13 22:40:53 -0500 )edit

Dear Mark, You was right. I use the motor driver for system, but I can't understand how to work with encoder. Can you help me with these?

Tvlad gravatar image Tvlad  ( 2016-10-17 06:10:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-10-12 01:53:30 -0500

Seen: 2,483 times

Last updated: Oct 13 '16