-----Original Message-----
From: William Premerlani [mailto:wprem...@gmail.com]
Sent: Sunday, February 27, 2011 04:57 PM
To: 'Gert Lundgren', uavde...@googlegroups.com
Subject: Re: 4th output channel on UDB v2
Hi Gert,You can use any version of MatrixPilot with any version of the board. You just have to be careful to read the options.h file to select the board type. The naming of the boards has changed once or twice as new boards came out.If you let me know which version of MatrixPilot you are using, and describe you board a little, I can tell you which option to select.There are 3 board types produced by SparkFun.V1 : green boardV2 : red board with 1 horizontal gyro board and 2 vertically mounted gyrosV3 : red board with 1 horizontal gyro board.Best regards,Bill
On Sun, Feb 27, 2011 at 7:39 PM, Gert Lundgren <ge...@lapcad.com> wrote:
Bill,Thank you kindly for responding.Can I use MatrixPilot for V2 of the board, or is it strictly for V3?Thank you again.Best regards,
GertHi Gert,The software side of things is handled transparently through logical channel assignments. Take a look at the options.h file in either the released version of MatrixPilot, or better yet, in the latest working version in the repository. There are instructions in the options.h file for using the extra channels.Basically, if you are using MatrixPilot and you are adding some of your own features to it, you should not access PDC1, PDC2, or PDC3 directly. You should use the logical input and output channels instead. If you look through the source code, you will see how to use them in your code.PDC4 does not exist. Ben Levitt has written software to accomplish the same thing.For example, Ben has introduced the use of an array of pw input and output signals.For example, udb_pwOut[4] is the signal for output channel 4. Ben has written software to make the signal come out on the pin for channel 4.If you are not writing your own code, and all you want to do is use MatrixPilot, then all you need to do is specify the number of input and output channels, and assign the channels to various functions in the options.h file. The input and output channels will be logically connected to the hardware input and output pins.Best regards,Bill
On Sun, Feb 27, 2011 at 2:35 PM, Gert Lundgren <ge...@lapcad.com> wrote:
Dear Dr. Premerlani,
Please accept my apology if this causes you inconvenience.
I understand how to do the physical connection from RE0 to the servo, however when I try to compile the PRY code using PDC4 for output, it is said to be undefined, yet I do not find definitions for PDC1, PDC2, or PDC3.
What code do I need to add to make the fourths output channel work?
I will appreciate any advise you might have the time to provide.
Best regards,
Gert Lundgren, President
LAPCAD LAPCAD Engineering, Inc.
8305 Vickers Street, Suite 202
San Diego, CA 92111
//Left Motor Output
// temp = pwIn[THROTTLE_INPUT_CHANNEL] + aileron + YawIn + roll_control ;
temp =Throttle + aileron +
REVERSE_IF_NEEDED(RUDDER_CHANNEL_REVERSED,YawIn) +
REVERSE_IF_NEEDED(AILERON_CHANNEL_REVERSED,roll_control) ;
pwOut[LEFT_MOTOR_OUTPUT_CHANNEL] = pulsesat( temp ) ;
//Front Motor Output// temp = pwIn[THROTTLE_INPUT_CHANNEL] + elevator - YawIn + pitch_control ;
temp =Throttle + elevator -
REVERSE_IF_NEEDED(RUDDER_CHANNEL_REVERSED,YawIn) +
REVERSE_IF_NEEDED(ELEVATOR_CHANNEL_REVERSED,pitch_control) ;
pwOut[FRONT_MOTOR_OUTPUT_CHANNEL] = pulsesat( temp ) ;
//Rear Motor Output// temp = pwIn[THROTTLE_INPUT_CHANNEL] - elevator - YawIn - pitch_control ;
temp =Throttle - elevator -
REVERSE_IF_NEEDED(RUDDER_CHANNEL_REVERSED,YawIn) -
REVERSE_IF_NEEDED(ELEVATOR_CHANNEL_REVERSED,pitch_control) ;
pwOut[REAR_MOTOR_OUTPUT_CHANNEL] = pulsesat( temp ) ;
//Right Motor Output// temp = pwIn[THROTTLE_INPUT_CHANNEL] - aileron + YawIn - roll_control ;
temp =Throttle - aileron +
REVERSE_IF_NEEDED(RUDDER_CHANNEL_REVERSED,YawIn) -
REVERSE_IF_NEEDED(AILERON_CHANNEL_REVERSED,roll_control) ;
pwOut[RIGHT_MOTOR_OUTPUT_CHANNEL] = pulsesat( temp ) ;
It will be a little different because we have made some changes to support altitutude control...but the logic is the same...load up the pwOut's.
If you look in the options.h file in the download you will see how each channel is define for input and output.
This code will run on any UDB, just get the option.h board types set properly.
Hope this helps
John