Pages: [1]   Go Down
Author Topic: Robotic Arm Project  (Read 2673 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys, I'm doing a robotic arm project with several other engineering majors in our college, but I am in charge of the software/math division of the project.  I was wondering if anybody has any suggestions on where I should start for the the programming.  We are using servo motors for the base and the joints and we were thinking of using Galago, but ended up with Arduino since Galago doesn't have forums and source like arduino does.  Any help/input will be appreciated, thanks!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49386
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I was wondering if anybody has any suggestions on where I should start for the the programming.
I'd suggest that start by defining some requirements. Unless choosing random angles and flailing the arm around is what you want. If it is, by all means go ahead and do that.
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 206
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Take a look at this

http://www.circuitsathome.com/mcu/robotic-arm-inverse-kinematics-on-arduino
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To PaulS,

We don't know exact angles yet but we do know the dimensions of all the parts of the arm, we are using arduinos for every joint and a raspberry pi linux computer to control these arduinos.  We essentially want the arm to pick up something small, preferably under 5 lbs, like a small mug or something.

To justone,

I've seen that , but it seems a bit complex for someone that hasn't programmed using arduino before.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49386
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I've seen that , but it seems a bit complex for someone that hasn't programmed using arduino before.
But, that is what is needed to determine the path that an open loop kinematic system needs to follow to reach point A (which is presumably where the object to be picked up is) or point B (where to put it).
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know what stage of your studies you're at, but if you're going to be an engineer you need to be able to solve problems- that's what engineering is.

To that end, you need to accept that the problem is to move the 5lb mug from A to B. (Unless you simply want to wave it around, as suggested above.)

Assuming your team's hardware guys-n-gals have figured out their side- and sounds like they have since you say you know the dimensions- yours is to provide the intelligence. Inverse kinematics is that intelligence, and you don't dive into code. You understand what inverse kinematics is, look at different ways of implementing it in various algorithms- and then look at ways of coding the algorithm.

It's a fact of life that inverse kinematics is complicated, but you took that complication on when you accepted the job of math guy. You have to understand the math first.... and if that's complicated, well that's tough on you. Get your mind round how to do the math first, then only flowchart the solution (perhaps with pseudo code) and only then figure out the coding.

And of course before all of that, learn to program your Arduinos! There are loads of tutorials on that....

Edit.... sorry if that came across as a bit of a rant, didn't mean it to
« Last Edit: January 14, 2013, 02:34:55 pm by JimboZA » Logged

Roy from ITCrowd: Have you tried turning it off and on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To JimboZA,

yea that makes sense to get the math down before the programming, I mean I just finished taking my first semester of linear algebra, and through research I came across the fact that i am going to need knowledge of isomorphisms between the joints and their rotations, DH parameters (which seems a bit complicated), and inverse kinematics (which I am still researching and doing my best to learn about).  My main concern was the programming in arduino, and not as much the mathematics, but I guess my logic was reversed and I should start the other way around based on your advice.
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good man....

Have you no calculus though?- my (admittedly limited) knowledge of IK is that it's differential equations. I guess you can get some off-the-shelf algorithms at least, without necessarily having a deep understanding of the calculus? Then implement those in code....

While you're researching the math, also learn to program the Arduino. There are two servo tutorials on this site, here and here, which will get you going. But get something like Blink going first  smiley-cool
Logged

Roy from ITCrowd: Have you tried turning it off and on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9631
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
We are using servo motors for the base and the joints and ... We essentially want the arm to pick up something small, preferably under 5 lbs, like a small mug or something.

Servos are generally limited to moving small weights unless $$$ servos are used. Search on youtube for "robot arm" to see what others are doing.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Shanghai,China
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 I have finished an alike project----a 4-freedom arm, using joystick(made by 4 pots) to control it.
 Servos as driving unit.
 Here is another resourses:http://www.endurance-rc.com/analogreader.php
 Here is the code(just copy and paste):
 #include <Servo.h>
 
Servo myservo1;
Servo myservo2;
Servo myservo3;
Servo myservo4;// create servo object to control a servo
 
int potpin1 = 0;  // analog pin used to connect the potentiometer
int potpin2 = 1;
int potpin3 = 2;
int potpin4 = 3;
int val1;    // variable to read the value from the analog pin
int val2;
int val3;
int val4;
 
void setup()
{
  myservo1.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo2.attach(10);
  myservo3.attach(11);
  myservo4.attach(13);
}
 
void loop()
{
  val1 = analogRead(potpin1);  // reads the value of the potentiometer (value between 0 and 1023)
  val2 = analogRead(potpin2);
  val3 = analogRead(potpin3);
  val4 = analogRead(potpin4);
  val1 = map(val1, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
  val2 = map(val2, 0, 1023, 0, 179);
  val3 = map(val3, 0, 1023, 0, 179);
  val4 = map(val4, 0, 1023, 0, 179);
  myservo1.write(val1);                  // sets the servo position according to the scaled value
  myservo2.write(val2);
  myservo3.write(val3);
  myservo4.write(val4);
  delay(5);                           // waits for the servo to get there
}
Logged

Make it right then turn it on!

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4400
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have finished an alike project----a 4-freedom arm, using joystick(made by 4 pots) to control it.

With all due respect, Stargazer, moving the end of a servo with four pots is not an "alike project". It's simply 4 knob programs in one and is simple in comparison to inverse kinematics in 3D and real time.

But it might be enough for the OP, who went silent after January 14th.

As a compromise though, I recently experimented a bit with using the potentiometer (knob) approach and using a push button on an interrupt to store the current settings of the pots into EEPROM as the servos move.That was a very ( very)basic way of programming the actuator path, by recording waypoints as it was driven by the pot (pot singular, for my testing.) Then I had another program that read the EEPROM values back and moved the actuator on its pre-programmed path. Timing is an issue.....
Logged

Roy from ITCrowd: Have you tried turning it off and on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Shanghai,China
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's simply 4 knob programs in one and is simple in comparison to inverse kinematics in 3D and real time.
Frankly speaking, it is truely simple smiley-draw, but at least it worked. Considering on the scale of the robotic arm, this kind of code would satisfy when the arm is small(You won't feel the difference between using function "map" and using function "PID").
However the problem about response time did exist. So I think if want to make the arm larger like human arm, this problem can't be ignored. In that case negtive feedback and PID algorithm may be indispensable. And the driving unite would probably be switched into DC gear motors. So I wrote down this code below, I call it single-neuroned self-adapting NN PID algorithm(Whatever it is...never mind, It is the simplest NN algorithm). Actually it is only test version and anyone can adapt it to his own device if needed. By the way, the code is not perfect yet...and I will be pretty appreciate if you can find mistakes. smiley-lol
Here is the code(for only one motor),
Code:
const int analogInPin1 = A0;
const int analogInPin2 = A1;
const int analogOutPin = 9;

int y_in = 0;
int r_in = 0;       
int u_k = 0;
int u_k_old = 0;
int e_k;
int e_k_old = 0;
int e_k_old2 = 0;
double xite_i = 0.35;
double xite_p = 0.40;
double xite_d = 0.40;
double wk1 = 0.1;
double wk2 = 0.1;
double wk3 = 0.1;
double wk1_old = 0;
double wk2_old = 0;
double wk3_old = 0;
double wk11;
double wk22;
double wk33;
double w;
double k = 0.12;
double x1;
double x2;
double x3;

void setup() {
  Serial.begin(9600);
}

void loop() {
  y_in = analogRead(analogInPin2);
  r_in = analogRead(analogInPin1);
  e_k = y_in - r_in;
  x1 = e_k;
  x2 = e_k - e_k_old;
  x3 = e_k - 2*e_k_old + e_k_old2;
  w = abs(wk1)+abs(wk2)+abs(wk3);
  wk11 = wk1/w;
  wk22 = wk2/w;
  wk33 = wk3/w;
  u_k = u_k_old + k*(wk11*x1 + wk22*x2 + wk33*x3);
  wk1_old = wk1;
  wk2_old = wk2;
  wk3_old = wk3;
  wk1 = wk1_old + xite_i*e_k*u_k*(2*e_k - e_k_old);
  wk2 = wk2_old + xite_p*e_k*u_k*(2*e_k - e_k_old);
  wk3 = wk3_old + xite_d*e_k*u_k*(2*e_k - e_k_old);
 
  analogWrite(analogOutPin, u_k);
 
  Serial.print("r_in = " );                       
  Serial.print(r_in);     
  Serial.print("\t y_in = ");     
  Serial.println(y_in); 
  Serial.print("\t u_k = ");     
  Serial.println(u_k);
 
  e_k_old2 = e_k_old;
  e_k_old = e_k;
  u_k_old = u_k;
 
  delay(2);
 
}

A0 is attached to controlling pot;
A1 is attached to feed-back pot which shares the same shaft with the arthrosis of the arm.

Logged

Make it right then turn it on!

Pages: [1]   Go Up
Jump to: