Tag Archives: c#

Programming drones in C#

You are a software engineer and wanna learn some drone programming? Check the ArduPilot/APM development site. There you can find Mission Planner.

The future (in my opinion) are the autonomous drones. I would invest my programming energy in learning how those work. In fact a few promising projects go in this direction.
E.g. HEXO+, AirDog (main purpose, attach a GoPro and use them to film). I read somewhere that they may be based on the ArduCopter project.

Costs for various drones

Parrot AR.Drone 2.0, 200-400 US$
HEXO+ (pre-order) 1,150 US$.
AirDog (pre-order) 1,300 US$.
ArduCopter DIY kit 550 – 615 US$.
ArduCopter ready to fly kit 1,350 US$.

So the cheapest option seems to be the AR.drone 2.0, which is also very popular and you may even find used models on amazon, for even 190 US$!

Which one should you choose?

Parrot AR.Drone 2.0 SDK in C#/.NET

Ruslan-B/AR.Drone on GitHubThe AR.Drone 2.0 controlling library for C#/.NET and Mono, with video support. Built over the original AR.Drone SDK 2.0.1 – using lastest drone firmware.

If the cost is an issue, you may wanna buy the cheapest option and begin learning from there. Go for AR.Drone 2.0 and try the AR.Drone library by Ruslan-B. It may be even easier to learn (just my opinion – need to test). If you already own an AR.Drone 2.0 or can borrow one from a friend it makes sense to give this a try.

To consider: the last commit on Ruslan-B code was on August, 26th 2014. Maybe the community and support for this may not be that big. But the project looks mature and stable (to check) so it may not be a big issue. Eventually, questions and support can be found on stackoverflow.

MissionPlanner SDK in C#/.NET

diydrones/MissionPlanner on GitHub – the most commonly used ground station written in C# for windows but also runs on Linux and MacOS via mono.

If you wanna learn the cool and advanced stuff directly, check the ArduPilot/APM project. The drone will cost more money, but on the other hand the projects look more active, and there is a big community.

To consider: The main flight code for ArduPilot/APM is written in C++. Support tools are written in a variety of languages, most commonly in python. So far only the MissionPlanner is available in C#. Check what each project does, and see if it’s ok for you.

C# send a mail using razor views as template

If you are looking for a way to send an e-mail via C#, you may find some code examples such as Send e-mail via SMTP using C#. I used such a solution in many projects, by creating an HTML file in a separate folder, reading its contents, do text replacements and then send the message. That solution always worked fine. I liked my old school solution also because I could edit the HTML file and preview it by clicking it or pointing the browser to its location.

Lately I found a more elegant solution for my MVC projects with a library called Postal. You can install it via NuGet, create a view containing your email template, then, in your controller, you can send a mail just with a few lines of code, as explained in the Getting Started example.

At work I coded a few mailers (to send a reminder, or an occasional newsletter) and they worked quite fast with my old school system. Also with Postal, results have been quite good.

If you are interested in performance, I can code a few tests to see how much each solution can scale. Updates will come, stay tuned.

By the way, if you are interested in creating responsive emails, you may have a look at Bootstrap Template for HTML Email and if you want to convert an existing HTML into a mail friendly HTML (all CSS styles inline), check Premailer.

C# convert HTML to Word

In C#, if you want to create a Word document you can use the OpenXML SDK from Microsoft. With that library you have full control of what you do, however, if you are new to the library, you may not like it. To generate a simple document you may want something more practical, like the HTML to OpenXML library.

I created an example Visual Studio 2012 Project (OpenXML SDK 2.5 dependency downloaded automatically via NuGet) in ASP.NET 4.0 that demonstrates how easy it is, thanks to this library, to generate a document. You can save a file on the server or stream it to the user. My example includes both cases.

Download WordGenerator.zip

Enjoy.