- Netduino Forums
- → Brandon G's Content
Brandon G's Content
There have been 92 items by Brandon G (Search limited from 29-June 23)
#7635 NetDuino Quadrocopter
Posted by Brandon G on 14 January 2011 - 04:34 AM in Netduino 2 (and Netduino 1)
#7654 NetDuino Quadrocopter
Posted by Brandon G on 14 January 2011 - 04:38 PM in Netduino 2 (and Netduino 1)
#7535 NetDuino Quadrocopter
Posted by Brandon G on 12 January 2011 - 10:18 PM in Netduino 2 (and Netduino 1)
#7784 NetDuino Quadrocopter
Posted by Brandon G on 16 January 2011 - 11:51 PM in Netduino 2 (and Netduino 1)
#7634 NetDuino Quadrocopter
Posted by Brandon G on 14 January 2011 - 04:30 AM in Netduino 2 (and Netduino 1)
#7633 NetDuino Quadrocopter
Posted by Brandon G on 14 January 2011 - 04:23 AM in Netduino 2 (and Netduino 1)
#7581 NetDuino Quadrocopter
Posted by Brandon G on 13 January 2011 - 05:21 PM in Netduino 2 (and Netduino 1)
#7597 NetDuino Quadrocopter
Posted by Brandon G on 13 January 2011 - 08:43 PM in Netduino 2 (and Netduino 1)
#7600 NetDuino Quadrocopter
Posted by Brandon G on 13 January 2011 - 08:52 PM in Netduino 2 (and Netduino 1)
#9547 Runtime Native Code Interop
Posted by Brandon G on 14 February 2011 - 09:04 PM in General Discussion
Thank you for this. I think this will help a great deal in the cases where near realtime is necessary. I know this requires alot of work to integrate and glad your team are doing it. I would really hope that the NETMF team will take you and GHI's lead as far as providing interops and push it into NETMF. I love managed code and will always write in it when i can, even when knowing i am sacrificing speed for elegance, but given my recent project DotCopter.NET there is no way it can all be done in managed. So in an appeal to the NETMF team, to avoid further fragmentation, they need to pull this into the framework for the cases where its a last resort.
Again, thank you for your efforts Chris.
Brandon
#8951 Anybody interested in a cheap IMU?
Posted by Brandon G on 03 February 2011 - 09:18 PM in General Discussion
#8955 Anybody interested in a cheap IMU?
Posted by Brandon G on 03 February 2011 - 10:48 PM in General Discussion
#8966 Anybody interested in a cheap IMU?
Posted by Brandon G on 04 February 2011 - 01:51 AM in General Discussion
#8924 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 03 February 2011 - 04:10 AM in General Discussion
#8886 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 02 February 2011 - 04:15 PM in General Discussion
#8861 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 02 February 2011 - 05:20 AM in General Discussion
#9468 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 14 February 2011 - 12:07 AM in General Discussion
#7655 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 14 January 2011 - 04:41 PM in General Discussion
#7610 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 13 January 2011 - 10:34 PM in General Discussion
#7609 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 13 January 2011 - 10:28 PM in General Discussion
#7616 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 13 January 2011 - 11:02 PM in General Discussion
#7630 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 14 January 2011 - 03:44 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
#8783 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 01 February 2011 - 01:20 AM 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 + ","; } } }
- Netduino Forums
- → Brandon G's Content
- Privacy Policy