Posted by Chris Anderson on February 25, 2009 at 11:00pm
ArduPilot 2.0 uses the same hardware as ArduPilot 1.0 but new software to do both the navigation and stabilization functions itself, with no need for a FMA Co-Pilot (although we still use the FMA XY sensor). Here's how to directly connect the FMA sensor to ArduPilot.
[Note if you're buying the FMA XY sensor by itself, you'll need to order a cable, too. Also, note that the sensors come from FMA with a thin film (usually red) over the thermopile lenses. You have to remove the film before using them.]
Cut one of the cables that comes with the FMA sensor in half and pull the four wires apart for about two inches. Strip their ends by about a quarter of an inch. Slip on heat shrink tubing. If you have some red tubing, put it on the second wire in from the side of the cable with the red strip, to mark the positive power cable (yes, that's confusing. V+ isn't the wire with the red strip--it's the wire next to it!). Now solder each pair of wires to a two-pin male machine pin header, and shrink the tubing around them. (See photo above).
Now, solder on one two-hole female machine pin header to the ArduPilot board in the VCC and GND holes, and another one in holes Analog 0 and 1, as shown in the diagram below. You can see the FMA sensor pin-out details here.
Finally, solder a regular two-pin header on the ArduPilot's D6 and D7 holes. This is to place a jumper on when you're doing IR calibration the first time on the ground.
Note that in this version of ArduPilot, we do altitude control with the elevator, not the throttle, so plug in your servos as shown in the diagram below:
You can test your sensor by downloading and running this simple test program. Just load it on ArduPilot (make sure the board is powered and the GPS is not connected). With the FTDI cable connected, click on the serial monitor icon in Arduino and make sure the speed is set for 9600. The program will prompt you to tilt the sensor in certain directions and then strike any key and hit return when you're ready to take the X and Y sensor readings. Remember that sensor readings inside and near heat sources (like your hand) are nothing like the real thing outside. But it's still a good way to confirm that your sensor is working right.
Note that when you mount the sensor on your aircraft, the wire should be coming out towards the tail, as shown in the picture of an EasyStar configuration below (you don't need to put it on a pod like that--any position that has a relatively unubstructed view of all four sides is fine). The "P"s on the sensor should be facing forwards and towards the rear, with the one next to the FMA logo in front.
Ah, so you're not using the ArduPilot code, either. That stabilization code was pre-alpha, which we shared only so people could see what direction we were taking; it's too early to support that. We'll be posting a release version in a week or so. To support you I'll need you to be using the current ArduPilot board and released ArduPilot code. It's too hard if you're using home-built hardware and buggy demo code.
Woah--you're not using the commercial ArduPilot board? I have no idea what pins we've changed since that early board, which we never released. It's really hard to support people who aren't using our current hardware.
In your code, where is the pulse_servos subroutine? We don't have one called that.
I am using servo1.attach(9) and servo2.attach(10) but the problem may be wiring as the response is quite irregular. I tried the register code that you all wrote as well but the effect on my board is the same. In fact at the moment with the segment below and the code that sets up the servo registers I still cannot get the servos to respond though the light blinks and Done is printed. My wiring involves attaching servos to out1 and out2 on the board layout shown.
int max16_roll = 2100;
int min16_roll = 1000;
int max16_pitch = 2100;
int min16_pitch = 1000;
int roll = 0;
int pitch = 0;
int ledPin = 13;
I am new to ardupilot and just wanted to ask a quick question about servo control. I have tried as a start using software control for servos via the code below with the mux pin set high for testing. However the servos do not seem to respond regularly or reliably. Is there any reason someone can tell me why this does not work?
Telmo: Reading the current servo positions at autopilot start is the way we record the trim positions of the plane. If you use constant positions, the plane will be out of trim and it will be harder to stabilize. Why do you want the fixed values?
Hi, Im very interested in the v.2. Im just in test of v.1. In this version its posible that the Ardupilot takes the neutral servo position from a fixed value? I think is beter solution and more than the actual (neutral at activation stik position). Thans a lot
We use matrix
| +1 +1 |
| -1 +1 |
we could use constant cos(45) instead of +-1 for 45 degrees rotation, which is 0.707, but this doesn't affect result if it's 45 degrees.
Comments
regards
Sirk
void pulse_servos(int roll, int pitch) {
pulse_servo_1(90 - (pitch + roll));
pulse_servo_2(90 + (pitch + roll));
}
In your code, where is the pulse_servos subroutine? We don't have one called that.
I am using servo1.attach(9) and servo2.attach(10) but the problem may be wiring as the response is quite irregular. I tried the register code that you all wrote as well but the effect on my board is the same. In fact at the moment with the segment below and the code that sets up the servo registers I still cannot get the servos to respond though the light blinks and Done is printed. My wiring involves attaching servos to out1 and out2 on the board layout shown.
int max16_roll = 2100;
int min16_roll = 1000;
int max16_pitch = 2100;
int min16_pitch = 1000;
int roll = 0;
int pitch = 0;
int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
Init_servo();
}
void loop() {
flashLights();
testServos();
Serial.print("Done");
delay(1000);
}
void testServos() {
for(int i = 0; i <= 45; i++) {
roll = i; pitch = i;
pulse_servos(roll, pitch);
}
}
void flashLights() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
Do you have any idea what I am missing.
Thanks
Sirk
In the ArduPilot code we don't use servo.write. Too inefficient. We use registers instead,
I am new to ardupilot and just wanted to ask a quick question about servo control. I have tried as a start using software control for servos via the code below with the mux pin set high for testing. However the servos do not seem to respond regularly or reliably. Is there any reason someone can tell me why this does not work?
if(input_servo == 0) {
for(int i = 0; i <= 180; i++) {
servo.write(i);
delay(50);
servoVal1 = servo.read();
Serial.print(servoVal1);
Serial.print(" ");
}
}
Thanks
Sirk
| +1 +1 |
| -1 +1 |
we could use constant cos(45) instead of +-1 for 45 degrees rotation, which is 0.707, but this doesn't affect result if it's 45 degrees.
-
1
-
2
-
3
-
4
-
5
of 6 Next