Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

nickatredbox

Member Since 14 Feb 2012
Offline Last Active Apr 08 2013 07:03 PM
-----

Posts I've Made

In Topic: A Tiny TinyCLR web server

08 April 2013 - 07:05 PM

https://docs.google....dit?usp=sharing


In Topic: Noisy Netduino Plus Analogue inputs

04 July 2012 - 12:53 PM

Depends on viewpoints: if you mean "cool" as "nice", then I guess so.
Instead, if you mean "cool" as "fresh climate", unfortunately not: currently the climate is worse than a sauna.
Cheers


LOL :) Cool as in fantastic global city

In Topic: Noisy Netduino Plus Analogue inputs

04 July 2012 - 12:03 PM

This could help:http://highfieldtale...se-of-netduino/
Cheers


Thank you Mario,

Venezia still cool? haven't been there for years

In Topic: Noisy Netduino Plus Analogue inputs

04 July 2012 - 09:50 AM

Ok so 1023 bits is nominally 3.3 volts? Opps :rolleyes: don't think its damaged the duino Actually thinking about it the pot does top out a long way before the end of its track. I need an oscilloscope are any of those USB scopes any good do you know?

In Topic: Quad.Net Quadrocopter for .NETMF

15 June 2012 - 01:15 AM

I too have a tricopter hovering with TinyCLR

Hover Test 1

public void DoStability()
        {


            do
            {
              
                TimeSpan elapsedSpan = new TimeSpan((DateTime.Now.Ticks - LastTicks));
                LastTicks = DateTime.Now.Ticks;
                

                Analog.SyncScanInputs();

                int[] ServerValue = Telemetery.ServerValues;

                //Datums
                TricopterSettings.LeftPivotDatum = ServerValue[1];
                TricopterSettings.RightPivotDatum = ServerValue[2];

                //Some debug stuff
                PitchPID.Pgain = ServerValue[4];
                RollPID.Pgain = ServerValue[5];
                YawPID.Pgain = ServerValue[6];

                X_PID.Pgain = ServerValue[9];
                Y_PID.Pgain = ServerValue[10];
                Z_PID.Pgain = ServerValue[11];

                int StationHold = ServerValue[12];


                //Set demands
                Throttle.ThrottleDemand = ((double)ServerValue[3] / 10.0);

                Throttle.PitchRate_degSec = 0;// (double)Telemetery.ServerValue(0);
                Throttle.RollRate_degSec = 0;
                Throttle.YawRate_degSec = 0;

                //X Y Z Rotate in yaw command rates
                int X_Transalate = 0;
                int Y_Transalate = 0;
                int Z_Transalate = 0;




                //Get the throttle demand in % and pitch,roll,yaw rates in deg/Sec
                int throttle = (int)(Throttle.ThrottleDemand * ((double)TricopterSettings.ThrottleScaler / 1000.0));

                //Get pich,roll,yaw rates requested
                int pitchrate = (int)(Throttle.PitchRate_degSec * ((double)TricopterSettings.PitchRateScaler / 1000.0));
                int rollrate = (int)(Throttle.RollRate_degSec * ((double)TricopterSettings.RollRateScaler / 1000.0));
                int yawrate = (int)(Throttle.YawRate_degSec * ((double)TricopterSettings.YawRateScaler / 1000.0));




                //Control PID enables
                if (Throttle.ThrottleDemand < (double)TricopterSettings.ThrottleMin)
                {
                    WOZ();

                    Pitch_PID.Enable = false;
                    Roll_PID.Enable = false;
                    Yaw_PID.Enable = false;

                    X_PID.Enable = false;
                    Y_PID.Enable = false;
                    Z_PID.Enable = false;
                }
                else
                {
                    Pitch_PID.Enable = true;
                    Roll_PID.Enable = true;
                    Yaw_PID.Enable = true;

                    X_PID.Enable = true;
                    Y_PID.Enable = true;
                    Z_PID.Enable = true;
                }





                //X Y Z Accel sensors
                int X_Input = (Analog.AnIn(Analog.AN_IN.Accel_X) - m_X_AccelWOZ);
                int Y_Input = (Analog.AnIn(Analog.AN_IN.Accel_Y) - m_Y_AccelWOZ);
                int Z_Input = (Analog.AnIn(Analog.AN_IN.Accel_Z) - m_Z_AccelWOZ);


                //Do rolling average
                X_AccelAccumulator[c] = (Int16)X_Input;
                Y_AccelAccumulator[c] = (Int16)Y_Input;
                Z_AccelAccumulator[c] = (Int16)Z_Input;


                X_AccelMean = 0;
                Y_AccelMean = 0;
                Z_AccelMean = 0;

                /* 
                const int NumPoints = 10;

                for (int i = 0; i < NumPoints; i++)
                {
                    X_AccelMean += (int)X_AccelAccumulator[i];
                    Y_AccelMean += (int)Y_AccelAccumulator[i];
                    Z_AccelMean += (int)Z_AccelAccumulator[i];
                }

                X_AccelMean /= NumPoints;
                Y_AccelMean /= NumPoints;
                Z_AccelMean /= NumPoints;
                */

                if ((++c) > 50)
                    c = 0;

                
                //Get the Gyro inputs
                int Pitch_Input = (Analog.AnIn(Analog.AN_IN.Gyro_X) - m_PitchGyroWOZ);
                int Roll_Input = (Analog.AnIn(Analog.AN_IN.Gyro_Y) - m_RollGyroWOZ);
                int Yaw_Input = (Analog.AnIn(Analog.AN_IN.Gyro_Z) - m_YawGyroWOZ);

                //Calculate X Y Z rate PID inputs
                X_PID.Input = (X_Input - X_Transalate);// + X_AccelMean;
                Y_PID.Input = (Y_Input + Y_Transalate);// + Y_AccelMean;
                Z_PID.Input = (Z_Input + Z_Transalate);// + Z_AccelMean; 

                //Debug.Print("inputs X:" + X_Input.ToString() + " Y:" + Y_Input.ToString() + " Z:" + Z_Input.ToString());

                //Sync update the Accel PID's
                X_PID.SyncUpdate();
                Y_PID.SyncUpdate();
                Z_PID.SyncUpdate();

                int x_AccelTrim = X_PID.Output;
                int y_AccelTrim = Y_PID.Output;
                int z_AccelTrim = Z_PID.Output;//Note Z not used currently

                //Debug.Print("Trims X:" + x_trim.ToString() + " Y:" + y_trim.ToString() + " Z:" + z_trim.ToString());

                //Calculate inputs for Rotation PID's
                Pitch_PID.Input = (Pitch_Input - pitchrate);
                Roll_PID.Input = (Roll_Input - rollrate);
                Yaw_PID.Input = (Yaw_Input - yawrate);

                //Sync update the Gyro PID's
                Pitch_PID.SyncUpdate();
                Roll_PID.SyncUpdate();
                Yaw_PID.SyncUpdate();


                //Get the PID Outputs
                int pitch_trim = Pitch_PID.Output;
                int roll_trim = Roll_PID.Output;
                int yaw_trim = Yaw_PID.Output;

                //Debug.Print("P:" + pitch_trim.ToString() + " R:" + roll_trim.ToString() + " Y:" + yaw_trim.ToString());
                //Debug.Print("Trims X:" + x_trim.ToString() + " Y:" + y_trim.ToString() + " Z:" + z_trim.ToString());


#if DEBUG
                if ((c % 50) == 0)
                {
                    Debug.Print("Tick " + elapsedSpan.Milliseconds.ToString());
                    Debug.Print("StationHold " + StationHold.ToString());
                    //Debug.Print("woz\t" + m_X_AccelWOZ.ToString() + "\t" + m_Y_AccelWOZ.ToString() + "\t" + m_Z_AccelWOZ.ToString());
                    Debug.Print("Gyro\t" + pitch_trim.ToString() + "\t" + roll_trim.ToString() + "\t" + yaw_trim.ToString());
                    Debug.Print("Accel\t" + x_AccelTrim.ToString() + "\t" + y_AccelTrim.ToString() + "\t" + z_AccelTrim.ToString());
                    //Debug.Print("Mean\t" + X_AccelMean.ToString() + "\t" + Y_AccelMean.ToString() + "\t" + Z_AccelMean.ToString());
                }
#endif

                int RollBias = ServerValue[7];//Left Right Bias
                int PitchBias = ServerValue[0];//Pitch Bias                
                int YawBias = ServerValue[8];//Yaw Bias


                //Calculate the target speeds for the rotorsx_trim
                //Goes - then +
                int LeftRPM = throttle - roll_trim - RollBias + y_AccelTrim;
                int RightRPM = throttle + roll_trim + RollBias - y_AccelTrim;

                //Pitch acts on the tail rotor only
                int TailRPM = throttle + pitch_trim + PitchBias - x_AccelTrim; 

                //Calculate pivot positions for yaw 
                //remember the servos face away from each other hense - on left and right
                int LeftPivot = TricopterSettings.LeftPivotDatum + yaw_trim + YawBias;// -x_AccelTrim;
                int RightPivot = TricopterSettings.RightPivotDatum + yaw_trim + YawBias;// +x_AccelTrim;

                if (LeftPivot < 650) LeftPivot = 650; else if (LeftPivot > 980) LeftPivot = 980;
                if (RightPivot < 650) RightPivot = 650; else if (RightPivot > 980) RightPivot = 980;
                
                //Set the pivot targets
                Servos.SetServo(Servos.eServo.LeftPivot, LeftPivot);
                Servos.SetServo(Servos.eServo.RightPivot, RightPivot);

                //Set the ESC targets
                Servos.SetServo(Servos.eServo.LeftRPM, LeftRPM);
                Servos.SetServo(Servos.eServo.RightRPM, RightRPM);
                Servos.SetServo(Servos.eServo.TailRPM, TailRPM);
                                                
            }
            while (m_Threaded);
        }

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.