Arduino uno 6dof
Shop › Forum › Everything Else › Arduino uno 6dof
- This topic has 2 voices and 15 replies.
-
AuthorPosts
-
2015-06-01 at 18:41 #6106AnonymousInactive
Hi,
as a Newbie I’m struggeling with a code for Arduino uno and six servos connected to pins 3,5,6,9,10,11.
I’v build Steward platform, but I can’ get servos moving with code bellow
Any Ideas, thank you in advance#include
const float pi = 3.14159,
theta_r = radians(48.0),
theta_p = radians(23.2),
theta_s[] = { -pi / 3, 2 * pi / 3, pi, 0, pi / 3, -2 * pi / 3},
RD = 2.395,
PD = 3.3,
L1 = 1.0,
L2 = 4.72,
z_home = 4.25,
servo_min = 3.5,
servo_max = 5.5,
servo_mult = 6,
p[2][6] = {{PD * cos(pi / 6 + theta_p), PD * cos(pi / 6 - theta_p), PD * cos(-(pi / 2 - theta_p)), -PD * cos(-(pi / 2 - theta_p)), -PD * cos(pi / 6 - theta_p), -PD * cos(pi / 6 + theta_p)},
{PD * sin(pi / 6 + theta_p), PD * sin(pi / 6 - theta_p), PD * sin(-(pi / 2 - theta_p)), PD * sin(-(pi / 2 - theta_p)), PD * sin(pi / 6 - theta_p), PD * sin(pi / 6 + theta_p)}
},
re[2][6] = {{RD * cos(pi / 6 + theta_r), RD * cos(pi / 6 - theta_r), RD * cos(-(pi / 2 - theta_r)), -RD * cos(-(pi / 2 - theta_r)), -RD * cos(pi / 6 - theta_r), -RD * cos(pi / 6 + theta_r)},
{RD * sin(pi / 6 + theta_r), RD * sin(pi / 6 - theta_r), RD * sin(-(pi / 2 - theta_r)), RD * sin(-(pi / 2 - theta_r)), RD * sin(pi / 6 - theta_r), RD * sin(pi / 6 + theta_r)}
};
/*
theta_r = angle between attachment points
theta_p = angle between rotation points
theta_s = orientation of the servos
RD = distance to end effector attachment points
PD = distance to servo rotation points
L1 = servo arm length
L2 = connecting arm length
z_home = default z height with servo arms horizontal
servo_min = lower limit for servo arm angle
servo_max = upper limit for servo arm angle
servo_mult = multiplier to convert to milliseconds
p = location of servo rotation points in base frame [x/y][1-6]
re = location of attachment points in end effector frame [x/y][1-6]
*/
const int servo_pin[] = {9, 3, 5, 11, 6, 10};
const int servo_zero[6] = {1710, 1280, 1700, 1300, 1680, 1300};
/*
servo_pin = servo pin assignments,
servo_zero = zero angles for each servo (horizontal)
*/
Servo servo[6];
/*
Servos 0, 2, 4: reversed (+ = down, - = up)
Servos 1, 3, 5: normal (+ = up, - = down)
*/
void setup()
{
//Serial.begin(9600);
for (int i = 0; i < 6; i++)
{
servo.attach(servo_pin);
servo.writeMicroseconds(servo_zero);
}
delay(1000);
}
void loop()
{
static float pe[6] = {0, 0, 0, radians(0), radians(0), radians(0)}, theta_a[6], servo_pos[6], q[3][6], r[3][6], dl[3][6], dl2[6];
}
/*
pe = location and orientation of end effector frame relative to the base frame [sway, surge, heave, pitch, roll, yaw)
theta_a = angle of the servo arm
servo_pos = value written to each servo
q = position of lower mounting point of connecting link [x,y,x][1-6]
r = position of upper mounting point of connecting link
dl = difference between x,y,z coordinates of q and r
dl2 = distance between q and r
*/
2015-06-04 at 17:12 #7035AnonymousInactiveI prefer to work with vectors and think in dot products, cross products, etc.
I can draw the model and how to build the equations easier that way.2015-06-04 at 18:33 #7036AnonymousInactive@i-make-robots wrote:
I prefer to work with vectors and think in dot products, cross products, etc.
I can draw the model and how to build the equations easier that way.thank you for your response.
Would you be so kind and show me an example, maybe one relating to Stewart Platform 6dofregards
Mario2015-06-04 at 18:42 #7037AnonymousInactive2015-06-05 at 16:14 #7038AnonymousInactivethank you i-make-robots,
I downloaded the files, but there is no other description except,
how to assemble rods and motors, but there is a missing image of wireing
and other description. If you have any information or description Il be gratefull.
@i-make-robots wrote:As I’m a real newbie I looked at the code named rap-center.ino and I would like to know
what i stands for in the code bellow
int i;
for(i=0;i<6;++i) {
arm.attach(7-i);
arm.write( 90 );thank you again
Mario2015-06-05 at 17:11 #7039AnonymousInactiveIt’s connecting servos to pins 1-6 (inclusive) and then moving them to middle position. I used this code to center the servos so then I could attach the servo arms and know they’re *pretty close* to horizontal.
2015-06-08 at 06:31 #7040AnonymousInactivethank you, for replay.
I’v used RSP_Center.ino, to set up the positions of servos to zero position ,parallel to the horizon.
I’v run RSP_Test.ino and I think that the servos have to wide range of motion. I was again unsuccesfull trying
to reduce the range of oscilation in the code bellow. Any tips what to changevoid loop() {
float t=millis()*0.001;int i,j;
for(i=0;i<6;++i) {
j = sin(t+(float)i*PI/3.0)*30;
set_servo(i,j);
Serial.print(j);
Serial.print(‘t’);
}Serial.print(‘n’);
delay(50);2015-06-08 at 15:04 #7041AnonymousInactivechange *30 to *20 or *10… the smaller the number, the smaller the oscillation.
2015-06-15 at 22:18 #7042AnonymousInactiveHi,
thank you again. I managed to succesfully run my first 6DOF experiment.
Next step would probably be Rumba controller.
But right now I would like to do the following procedure:
Use the platform as it is, but servos connected to inputs as
you programmed in RSP_Listen.ino. Than record movements in to
software CoolTerm.
Run RSP_MasterSlave.ino and use recorded data from CoolTerm instead
of the second 6DOF platform functioning as remote.
What do you thinkRegards
MArio2015-06-16 at 02:28 #7043AnonymousInactiveI think it’s a good plan. Post updates as you go, I want to learn more about cool term.
2015-07-07 at 14:09 #7044AnonymousInactiveHi,
my report about CoolTerm.
What I expected did not happen.
When CoolTerm saves received data to a text file, the time stamps tell you when which data was received. Sending the same text file via CoolTerm, however, does not interpret the time stamps as pauses. It treats the timestamps in the file as text, just like any other data in the text file. Thus, CoolTerm will send the timestamps as text to the your servo controller. Any file sent by CoolTerm will be sent all at once.So I decided to replicate your Master Slave Scenario.
I build two Platforms and Arduino Uno. Servos from Platform A connected to outputs, pins 2-7,
Servos from Platform B to inputs A0-A5.
When I run RSP Center Platform A moves in to Zero position. So OK
When I Run RSP Listen Platform B when I move it transfers data, which can be observed
on seriam Monitor. So, probably OK
When I run RSP Master Slave I calibrate MIN MAX positions, but when finished Platform A
starts to move erratically2015-07-07 at 17:17 #7045AnonymousInactiveerratically how? Can you make a video please?
2015-07-07 at 18:09 #7046AnonymousInactiveimmediately after calibration the following behavior
2015-07-07 at 18:47 #7047AnonymousInactiveSomething is sending random PWM signals to your servos. What happens if your arduino sends only (MAX+MIN)/2 to all the servos?
2015-07-07 at 19:10 #7048AnonymousInactiveHow do I do that?
2015-07-07 at 19:35 #7049AnonymousInactiveIt was my mistake.
I made a wiring error. Small Breadboard, so many wires….Thank you for your help
-
AuthorPosts
- You must be logged in to reply to this topic.