- Netduino Forums
- → Brandon G's Content
Brandon G's Content
There have been 92 items by Brandon G (Search limited from 14-May 23)
#16328 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 04 August 2011 - 03:52 PM in Project Showcase
#10645 Quadcopter Early Flight
Posted by Brandon G on 07 March 2011 - 06:53 PM in Project Showcase
#9590 Automated Build and Deploy
Posted by Brandon G on 15 February 2011 - 06:45 PM in General Discussion
#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
#9468 Microsoft.SPOT.Reflection.Serialize() / Deserialize() throws System.NotImplem...
Posted by Brandon G on 14 February 2011 - 12:07 AM in General Discussion
#9146 NetDuino Quadrocopter
Posted by Brandon G on 08 February 2011 - 05:35 AM in Netduino 2 (and Netduino 1)
#9129 Interesting news Pyxis
Posted by Brandon G on 07 February 2011 - 07:32 PM in General Discussion
#9121 NetDuino Quadrocopter
Posted by Brandon G on 07 February 2011 - 04:34 PM in Netduino 2 (and Netduino 1)
#9009 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 04 February 2011 - 08:52 PM in Project Showcase
#8966 Anybody interested in a cheap IMU?
Posted by Brandon G on 04 February 2011 - 01:51 AM in General Discussion
#8955 Anybody interested in a cheap IMU?
Posted by Brandon G on 03 February 2011 - 10:48 PM in General Discussion
#8951 Anybody interested in a cheap IMU?
Posted by Brandon G on 03 February 2011 - 09:18 PM 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
#8911 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 09:39 PM in Project Showcase
#8909 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 09:21 PM in Project Showcase
#8904 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 08:51 PM in Project Showcase
#8901 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 07:58 PM in Project Showcase
#8900 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 07:58 PM 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
#8867 Quad.Net Quadrocopter for .NETMF
Posted by Brandon G on 02 February 2011 - 05:55 AM in Project Showcase
#8862 Reference NETMF libraries in .NET
Posted by Brandon G on 02 February 2011 - 05:34 AM 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
#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 + ","; } } }
#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
- Netduino Forums
- → Brandon G's Content
- Privacy Policy