Fwd: 4th output channel on UDB v2

1 view
Skip to first unread message

William Premerlani

unread,
Mar 3, 2011, 9:17:15 PM3/3/11
to UAVHeliBoard, JERRY CHAPMAN, mcclell...@gmail.com, Gert Lundgren
Hi Gert,

I am forwarding your note to the heli group, and to John McClelland and Gerry Chapman. John has stabilized a heli using the UDB and some code that he wrote. Similarly, Gerry has stabilized a quad. I think they can help you better than I can. (John and Gerry: read the attachments to see what is going on.)

I looked at your code, and have the following comments and suggestions:

1. Your code is based on the roll-pitch-yaw demo in the download section of the UDB website. That demo is rather old. It does not support the UDBV3, only V1 and V2. For the most up to date firmware, it would be good to use the Tortoise repository. What you have is ok for V2, but it will not work for V3, it was written before V3 came out.

2. I notice that you include acceleration in the roll control. I am rather sure that John and Gerry were able to stabilize without an acceleration term. They used rmat and gyro signals only.

3. I notice that you are mixing floats and integers. That is ok in general, but the casting rules of the C language may produce unexpected results in some places.

Best regards,
Bill Premerlani

---------- Forwarded message ----------
From: <ge...@lapcad.com>
Date: Mon, Feb 28, 2011 at 9:39 AM
Subject: Re: 4th output channel on UDB v2
To: William Premerlani <wprem...@gmail.com>


Bill,
 
Thank you very much for helping me with this.
 
Will I owe some funds for the assistance?
 
A brief description, and the rmat file are attached.
 
Thank you again.
 
Best regards,
 
Gert Lundgren
-----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 board
V2 : red board with 1 horizontal gyro board and 2 vertically mounted gyros
V3 : 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,

Gert

On Feb 27, 2011, at 4:22 PM, William Premerlani <wprem...@gmail.com> wrote:

Hi 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



LAPCAD_VTOL_20110228.pdf
rmat.c

John McClelland

unread,
Mar 3, 2011, 9:39:06 PM3/3/11
to William Premerlani, UAVHeliBoard, JERRY CHAPMAN, Gert Lundgren, John McClelland
HI Gert
 
Just a quick look at what you are trying to do....
 
I think your issue is how to control 4 servos for your VTOL and having trouble.
 
Rather than try to go through all your code, I suggest you take a look at our Quad code.  It is controling 4 ESC/motors using the extra channel approach.
 
As Bill says, you don't want to use PDCX, you want to use pwOut[XXX]... where XXX is defined in options.h.
 
You can pick up the Quad code at:
 
 
and download the Quad firmware.   Take a look at servoMix.c  and you will find some code that looks like:
 

//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

jlchapman

unread,
Mar 3, 2011, 11:52:56 PM3/3/11
to UAVHeliBoard
Gert,

Here is the link for the extra channel you need:
http://code.google.com/p/gentlenav/wiki/ConnectingExtraChannels

Jerry

On Mar 3, 7:39 pm, "John McClelland" <mcclelland.j...@gmail.com>
wrote:
>     On Sun, Feb 27, 2011 at 7:39 PM, Gert Lundgren <g...@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,
>
>       Gert
>
>       On Feb 27, 2011, at 4:22 PM, William Premerlani <wpremerl...@gmail.com> wrote:
>
>         Hi 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 <g...@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- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages