- Netduino Forums
- → Brandon G's Content
Brandon G's Content
There have been 92 items by Brandon G (Search limited from 23-May 23)
#8364 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 25 January 2011 - 06:22 AM in Project Showcase
#8399 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 25 January 2011 - 03:57 PM in Project Showcase
#8522 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 27 January 2011 - 06:42 AM in Project Showcase
#8524 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 27 January 2011 - 06:47 AM in Project Showcase
#8525 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 27 January 2011 - 06:49 AM in Project Showcase
#8527 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 27 January 2011 - 06:55 AM in Project Showcase
#8535 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 27 January 2011 - 08:10 AM in Project Showcase
Chris thank you for the forum etiquette reminder. The posts were fast given we we had discovered the algo at the exact same time i replied and implemented it in code, i've attached our algo. i think you might be on to something as far as making it a scaling variable that can change as the flight conditions change.
using System; namespace Quad.Net.Commons.Utilities { public class Scale { private readonly double[] _coefficients; private readonly double _offset; public Scale(double offset, params double[] coefficients) { _coefficients = coefficients; _offset = offset; } public double Calculate(double value) { double output = 0; for (int i = 0; i < _coefficients.Length; i++) { output += Math.Pow(value + _offset, i) * _coefficients[_coefficients.Length - i - 1]; } return output; } } } namespace Quad.Net.Tests { [TestFixture] public class ScaleTests { [Test] public void TestQuadratics() { Scale scale = new Scale(-1500, 0.0000008, 0, 0, 0); Assert.AreEqual(scale.Calculate(1000),-100); } } }
#8560 Coding style discussion
Posted by Brandon G on 27 January 2011 - 04:21 PM in General Discussion
#8565 Coding style discussion
Posted by Brandon G on 27 January 2011 - 05:04 PM in General Discussion
#8567 Coding style discussion
Posted by Brandon G on 27 January 2011 - 05:22 PM in General Discussion
#8575 Coding style discussion
Posted by Brandon G on 27 January 2011 - 06:54 PM in General Discussion
#8581 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 27 January 2011 - 07:22 PM in Project Showcase
heres my ideas hardware wise, would like some opinions, you mentioned using a better BEC, so I have taken it off the list open for your suggestions, keeping in mind i am trying to be very modular is the reason for the component shield
Motor 6 $6.00 $36.00 http://www.hobbyking.com/hobbycity/store/uh_viewItem.asp?idProduct=5354&aff=104834 ESC 6 $9.23 $55.38 http://www.hobbyking.com/hobbycity/store/uh_viewItem.asp?idProduct=6458&Product_Name=Hobbyking_SS_Series_25-30A_ESC_%28card_programmable%29&aff=104834 Props 8 $4.00 $32.00 https://www.mikrocontroller.com/index.php?main_page=product_info&cPath=75&products_id=256&zenid=43fb24fa5fbee9bca99cea5ee6462e48 Battery 3 $19.00 $57.00 http://hobbycity.com/hobbyking/store/uh_viewItem.asp?idProduct=7634 Battery Charger 1 $25.00 $25.00 http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=2055 Frame 1 $90.00 $90.00 http://quadframe.com/html/quad002.html RC Transmitter 1 $60.00 $60.00 http://hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=8992 ITG3200/ADXL345 1 $65.00 $65.00 http://www.sparkfun.com/products/10321 Component Shield 1 $22.00 $22.00 http://www.robotshop.ca/ghi-component-shield-v2.html JST Sensor Cable 20 $1.76 $35.20 http://www.robotshop.ca/inex-jst3aa-sensor-cable.html
#8597 Coding style discussion
Posted by Brandon G on 28 January 2011 - 04:04 AM in General Discussion
#8598 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 28 January 2011 - 04:06 AM in Project Showcase
#8775 Reference NETMF libraries in .NET
Posted by Brandon G on 31 January 2011 - 09:53 PM in General Discussion
#8777 Reference NETMF libraries in .NET
Posted by Brandon G on 31 January 2011 - 10:13 PM in General Discussion
#8779 Reference NETMF libraries in .NET
Posted by Brandon G on 31 January 2011 - 10:18 PM in General Discussion
#8783 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 01 February 2011 - 01:20 AM in General Discussion
#8811 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 01 February 2011 - 04:34 PM in General Discussion
#8860 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 02 February 2011 - 05:18 AM in General Discussion
EDIT: didnt like what i posted earlier, here`s a revamp
using Quad.Net.Commons.Serialization; namespace Quad.Net.Commons.Logging { public interface ILogger { void Flush(); void Write(ISerializable obj); } } using System.IO; using Quad.Net.Commons.Serialization; namespace Quad.Net.Commons.Logging { public class PersistenceWriter : ILogger { private readonly IBinaryFormatter _formatter; private readonly string _fileName; private readonly FileStream _fileStream; public PersistenceWriter(string fileName, IBinaryFormatter formatter) { _formatter = formatter; _fileName = fileName; _fileStream = new FileStream(_fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, 512); } public void Flush() { _fileStream.Flush(); } public void Write(ISerializable obj) { _formatter.Serialize(_fileStream, obj); } } } using System.IO; using Quad.Net.Commons.Serialization; namespace Quad.Net.Commons.Logging { public class PersistanceReader { private readonly IBinaryFormatter _binaryFormatter; public PersistanceReader(IBinaryFormatter binaryFormatter) { _binaryFormatter = binaryFormatter; } public ISerializable[] GetMessages(string readPath) { FileStream readFile = new FileStream(readPath, FileMode.Open, FileAccess.Read); return _binaryFormatter.Deserialize(readFile); } } } using System; using System.IO; namespace Quad.Net.Commons.Serialization { public interface IBinaryFormatter { void Serialize(Stream stream, Object graph);//not implemented ISerializable[] Deserialize(Stream stream); void Serialize(Stream stream, ISerializable graph);//optimistic } } namespace Quad.Net.Commons.Serialization { public interface ISerializable //: where T : new() in classic C# this is what i would do force a parameterless contructor, cant do thisin netmf { byte[] Serialize(); object Deserialize(byte[] buffer); } } using System; using System.Collections; using System.IO; namespace Quad.Net.Commons.Serialization { public class TelemetryFormatter:IBinaryFormatter { public void Serialize(Stream stream, object graph) { throw new NotImplementedException(); } public ISerializable[] Deserialize(Stream stream) { ISerializable[] items = new ISerializable[stream.Length/44]; int counter = 0; while (stream.Position < stream.Length) { byte[] buffer = new byte[44]; stream.Read(buffer, 0, 44); ISerializable item = (ISerializable) typeof(TelemetryData).GetConstructor(new Type[0]).Invoke(new object[0]); item.Deserialize(buffer); items[counter] = item; counter++; } return items; } public void Serialize(Stream stream, ISerializable graph) { byte[] buffer = graph.Serialize(); stream.Write(buffer, 0, buffer.Length); } } } using System; using Microsoft.SPOT.Hardware; using Quad.Net.Avionics; using Quad.Net.Commons.Serialization; using Quad.Net.Commons.Utilities; namespace Quad.Net.FlightController { public class TelemetryData : ISerializable { private readonly AircraftPrincipalAxes _gyroAxes; private readonly AircraftPrincipalAxes _radioAxes; private readonly AircraftPrincipalAxes _pidAxes; private long _currentTime; private readonly byte[] _buffer; public TelemetryData() { _gyroAxes= new AircraftPrincipalAxes(0,0,0); _radioAxes = new AircraftPrincipalAxes(0, 0, 0); _pidAxes = new AircraftPrincipalAxes(0, 0, 0); _currentTime = DateTime.Now.Ticks; _buffer = new byte[44]; } public void Update(AircraftPrincipalAxes gyroAxes, AircraftPrincipalAxes radioAxes, AircraftPrincipalAxes pidAxes, long currentTime) { _gyroAxes.Update(gyroAxes.Pitch,gyroAxes.Roll,gyroAxes.Yaw); _radioAxes.Update(radioAxes.Pitch, radioAxes.Roll, radioAxes.Yaw); _pidAxes.Update(pidAxes.Pitch, pidAxes.Roll, pidAxes.Yaw); } public byte[] Serialize() { Utility.InsertValueIntoArray(_buffer, 0, 4, (uint)(_currentTime >> 32)); Utility.InsertValueIntoArray(_buffer, 4, 4, (uint)_currentTime); Utility.InsertValueIntoArray(_buffer, 8, 4, (uint)_gyroAxes.Pitch); Utility.InsertValueIntoArray(_buffer, 12, 4, (uint)_gyroAxes.Roll); Utility.InsertValueIntoArray(_buffer, 16, 4, (uint)_gyroAxes.Yaw); Utility.InsertValueIntoArray(_buffer, 20, 4, (uint)_radioAxes.Pitch); Utility.InsertValueIntoArray(_buffer, 24, 4, (uint)_radioAxes.Roll); Utility.InsertValueIntoArray(_buffer, 28, 4, (uint)_radioAxes.Yaw); Utility.InsertValueIntoArray(_buffer, 32, 4, (uint)_pidAxes.Pitch); Utility.InsertValueIntoArray(_buffer, 36, 4, (uint)_pidAxes.Roll); Utility.InsertValueIntoArray(_buffer, 40, 4, (uint)_pidAxes.Yaw); return _buffer; } public object Deserialize(byte[] buffer) { _currentTime = BitConverter.ToLong(buffer, 0); _gyroAxes.Update( Utility.ExtractValueFromArray(buffer, 8, 4), Utility.ExtractValueFromArray(buffer, 12, 4), Utility.ExtractValueFromArray(buffer, 16, 4) ); _radioAxes.Update( Utility.ExtractValueFromArray(buffer, 20, 4), Utility.ExtractValueFromArray(buffer, 24, 4), Utility.ExtractValueFromArray(buffer, 28, 4) ); _pidAxes.Update( Utility.ExtractValueFromArray(buffer, 32, 4), Utility.ExtractValueFromArray(buffer, 36, 4), Utility.ExtractValueFromArray(buffer, 40, 4) ); return this; } public override string ToString() { //csv format return _currentTime + "," + _gyroAxes.Pitch + "," + _gyroAxes.Roll + "," + _gyroAxes.Yaw + "," + _radioAxes.Pitch + "," + _radioAxes.Roll + "," + _radioAxes.Yaw + "," + _pidAxes.Pitch + "," + _pidAxes.Roll + "," + _pidAxes.Yaw + ","; } } }
#8861 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 02 February 2011 - 05:20 AM in General Discussion
#8862 Reference NETMF libraries in .NET
Posted by Brandon G on 02 February 2011 - 05:34 AM in General Discussion
#8867 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 05:55 AM in Project Showcase
#8886 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 02 February 2011 - 04:15 PM in General Discussion
#8900 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 07:58 PM in Project Showcase
- Netduino Forums
- → Brandon G's Content
- Privacy Policy