Author Topic: 2WD Robot with pid  (Read 697 times)

0 Members and 1 Guest are viewing this topic.

Offline VendraTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
2WD Robot with pid
« on: October 26, 2013, 08:54:29 AM »
Hey,
I need some help. I would like to do a new robot, I already did a couple but they were quite simple. Now I built a 2wd platform and bought 2 motors with encoders. I have an arduino board, a dsPIC33FJ128 MC 802 and a Raspberry Pi.
What I would like to do its to learn how to implement a good software. Something that I can improve step by step. I'd like to start with a basic control o the motors and PID and then proceed to elaborate a "map" of the environment. (Adding ultrasonic sensors, webcam and stuff)

The problem is I'm stuck Don't know where to begin. Any suggestions? Link or other stuff to read/learn could be great. Also if u want to contact me send me a pm (I can use skype)

Offline VendraTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Re: 2WD Robot with pid
« Reply #1 on: October 27, 2013, 01:51:06 PM »
Anyone?

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: 2WD Robot with pid
« Reply #2 on: October 27, 2013, 02:36:57 PM »
Do you know how to program at all?

To run PID control of motors, you need a motor controller that allows for proportional control, and a motor encoder that gives you feedback into the microcontroller.

Also note that the quadrature sensors on most motors will be pretty noisy, so you may need clean-up circuitry to actually read them cleanly on the microcontroller (unless you use a microcontroller with built-in quadrature decoder peripherals.)

It would be hard to give more suggestions than this, because your question is so vague.
What have you already started with? Do you have any specific parts? Do you know any particular programming language? Do you have experience with any particular controller -- or are you equally good (or bad?) with the three different architectures you're listing?

Offline VendraTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Re: 2WD Robot with pid
« Reply #3 on: October 27, 2013, 02:59:40 PM »
Alright I'll try to be more clear, giving more details.

I'm a engineering student (second year). I studied electronics and telecom at high school.
My first robot was a simple robot with 2 modded servomotors a pic16f84.
The second one was the one i brought for my final exam at school. It was based  on Arduino, a 4WD rover with L298 driver. I used PWM. Also I used a pan tilt and a Ultrasonic sensor to avoid obstacles.

Now I started a 2WD platform, I got 2 new motors ( http://www.robot-electronics.co.uk/htm/emg30.htm) emg30 they have encoders and they are a little better than what i used to handle.

What I have:
-Prototype platform with 2 motor EMG30 (they have encoders)
-Arduino (Not the latest though)
-Raspberry Pi
-dsPic33F (I choosed this cause of the QEI, quadrature encoder interface)
-A board with various stuff and a L298 with a little cooling wing.

What I know:
-Assembly (Pic 8bit, University-level Arm programming)
-Java (Data structures and stuff like that, stack & piles, linked lists etc..)
-C ( Mainly the one arduino uses. A little practice with PICs)
-Pascal ( alright... :)

Anyway i have quite good experience with Arduino. I programmed a lot the 8 bit Pic series but Im kinda new to the C dsPIC programming. With the raspberry pi i don't know where to start cause i have no experience on implementing software but just embedded firmware.
I'm not afraid of learning new things, clear :)

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: 2WD Robot with pid
« Reply #4 on: October 28, 2013, 09:18:29 AM »
That sounds great!
What is your actual question?

Or, to put another way:
1. Is your robot the way you want it?
2. If yes, you're done!
3. Make some change that makes the robot more like you want it.
4. Goto 1.

Offline VendraTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 0
Re: 2WD Robot with pid
« Reply #5 on: October 28, 2013, 11:34:13 AM »
The question here is How can I make those changes? I don't want to do something that I already did before. I want to learn something new: PID, dead reckoning, AI and so on. My problem is I don't know where to start.

I'd know how to begin with Arduino, the problem is it can't handle PIDs and too much stuff so i needed more "power".

My main question is: How can I write a draft code which let me communicate all those boards toghether and will let me to implements features step by step?
I want to improve my robot without rewrite the code again agai everytime I want to add something. I'd like to add a "block" each time. Beginning from the PID/QEI and then going on with other stuff like sensor and some cool algorithms.


Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,928
  • Helpful? 98
Re: 2WD Robot with pid
« Reply #6 on: October 28, 2013, 06:14:56 PM »
Quote
I'd know how to begin with Arduino, the problem is it can't handle PIDs
Did you google for this? Lots of examples, tutorials and even an arduino PID library out there.

Did you google PID and study to learn how this works?
I've even done a PID controller for two motors using software generated PWM  in a 4MHz PIC16F84 (1990's PIC). So you really do not need a lots of processing power.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,343
  • Helpful? 81
Re: 2WD Robot with pid
« Reply #7 on: October 29, 2013, 08:20:49 PM »
Quote
I'd know how to begin with Arduino, the problem is it can't handle PIDs and too much stuff so i needed more "power".

PID is super easy. An Arduino can do that no problem.

The main problem you're going to have is how to read the signal that comes out of the encoder of the motor, which is more of an electrical-signal-interface problem than a software problem. In fact, if the signal is properly conditioned, you can probably read the quadrature encoder using pin change interrupts, and still keep up.

There are AVR variants with quadrature decoders built-in; there are also various ARM development boards with quadrature decoders (such as the later version of the Tiva (formerly Stellaris) Launchpad.)

 


Get Your Ad Here

data_list