Hi All,
I'm currently trying to control my Quadcopter (APM2.5) by emulating PWM Radio signals from my Raspberry GPIO pins.
I want ot use my Raspberry as a decision maker + controller, just telling the arducopter to go up/down front/back, left/right according to informations computed in the raspberry (USB camera + laser as rangefinder to begin)
I have been able to read incoming PWM signals using a simple arduino script that you can find at the following :
http://ghowen.me/build-your-own-quadcopter-autopilot/
Using the Rpi.GPIO library I have been able to generate PWM signals via python (using the following instructions, f=50Hz, T=200000us, burst from 1000 to 2000us)
http://raspi.tv/2013/rpi-gpio-0-5-2a-now-has-software-pwm-how-to-use-it
Next step, send PWM signals to the APM whith Arducopter installed on it.
I've been trying to "arm" it using a simple script (corresponding to low thr, right yaw), based on the values of min/center/max acquired during calibration but no joy...
Is PWM signals scripting via Python a good way to control my Quad?
Any idea why I can't arm my quad?
Many thanks
Replies
I figured it out myself at last - with servoblaster it works *if* the dedicated 2 "HW" PWM pins are used on the RPi between specific ranges - I was able to calibrate the input channels with signals of 10% to 78% on 50Hz. Under 10% and above 78% the ardupilot does not interpret the input correctly. It's not a rocksolid solution as sudden changes are not properly handled - some dampening must be implemented to do a kind of smooth transition between two values. It is important to connect *only* the ground and the PWM signal PINs between ardupilot input and RPi and then start playing around with values on servoblaster. RPio is a more elegant solution but writing the /dev/servoblaster makes sense as well.
Hi All,
I'm new to connecting raspberry to ardupilot and have some difficulties around the PWM so I'd like to ask here instead of open an unnecessary second thread for same topic. I also
understood above it will have some fluctuation but I'd use it for a slow ship so I would not mind.
Till now what i have done is generating PWM signals with servo blasterwith following parameters:
Connect USB or telemetry to APM, and check what values it sees first, also, did you calibrate or set max/min channel values?
Hello Andre,
I dit that at first to calibrate the values but I think I know where the problem is,
The PWM signal sent from Raspbery GPIO is not as stable as it should be, for instance with a 1200us burst, the value in the APM calibrating tool fluctuate from 1190 to 1210... I have tried to change the PWM frequency to 51Hz and it's better, but still fluctuating.
I think that sending PWM signal from the raspberry GPIO is not a good idea...
no, that's too bad, you will not have smooth control.
Consider using something like this: http://www.pololu.com/product/1350
or programming your own microcontroller/arduino that can take input from i2c or serial.
I2C is my second option.
There are many sources about how to generate I2C signals from the raspberry.
Do you where I can find documentations about I2C/Ardupilot?
Will I be able to "control" the APM via I2C protocole?
Many thanks
AFAIK, Raspberry is I2C master only, and APM does not contain I2C Slave code.