Start developing! Visual studio and c#

Post here to get support
Post Reply
joellind
Beginner
Posts: 3
Joined: Sun Dec 28, 2014 8:48 pm

Start developing! Visual studio and c#

Post by joellind »

Hi!
Just got my CF 2.0 for Christmas and want to start programing into it.
Im into the c# programming so i will most definitely stick to that. But as I dont have so much experience about all the other things like setting up templates and the right aplication in visual studio, I need a little help on the way.
As I said i can program c# and ive been doing it in Visual studio 13 as that was what my dad supplied me with.

So, can i use visual studio for programming crazyflie?
If yes, HOW???

Kindly regards / Joel
nimble
Beginner
Posts: 19
Joined: Tue Dec 16, 2014 12:20 am

Re: Start developing! Visual studio and c#

Post by nimble »

Hi Joel,

Firstly... you won't be able to write firmware for the CF using dot-net, but you can write PC software which communicates with it over CrazyRadio.

I had a quick look at this a couple of weeks ago before I lost my CF2. I used CrazyFlieDotNet
https://github.com/ckarcz/CrazyflieDotNet

I managed to get a connection and pings working, but failed to get the motor ramp-up/ramp-down test to do anything on the quad.

The code will work from git-hub as-is, with TWO code-changes...

TransferProtocol/Packet.cs line 112 needs to change from:

Array.Copy(new[] {headerByte}, 0, packetBytesArray, 0, headerByteLength);

To:

Array.Copy(new[] {headerByte.Value}, 0, packetBytesArray, 0, headerByteLength);


Secondly, you need to add a Thread.sleep at CrazyRadioDriver.cs on line 766 - so it looks like this (don't ask me why, its just what I had to do to get it to work)

if (FirmwareVersion.CompareTo(MinimumCrazyradioFastFirmwareChannelScanFirmware) >= 0)
{
StartRadioScanningChannels(channelStart, channelStop);

Thread.Sleep(2000); // fixes USB transfer bug
results.AddRange(GetRadioChannelScanningResults());
}
else // slow pc level channel scan
{
results.AddRange(ManuallyScanForChannels(channelStart, channelStop));
}

Then you're good to go. Keen to hear if you get any further than me... but to be honest I only spent 20 minutes on it.

- Adam
JoVa
Beginner
Posts: 1
Joined: Thu Jan 22, 2015 4:57 pm

Re: Start developing! Visual studio and c#

Post by JoVa »

Hi,
Im using the same lybrary, but im strugling to get the crazyflie to respond as the wiki. ect. To ping the flie i tried:
0xaa;
0xaa;
0xF0;
0x01;
0x01;
0xf2;
Like the example tels me, but the only respone i get is: 01
I have almost the same problem trying to set up a logblock. But then i get some respons but not acording to the examples.
Commands are working thoug.
Any tips or trix that could help me?
shmedium
Beginner
Posts: 2
Joined: Thu Sep 05, 2013 6:36 pm

Re: Start developing! Visual studio and c#

Post by shmedium »

I sorry for the very late reply (i've been away past 6 months on a thru hike).

I have since fixed some bugs and have working commander packets. I can fly the copter via a wired ps3 controller.

It is still only a console view. To use PS3 controller, you must install motion joy driver software.

Here is a small demo video of it flying https://instagram.com/p/7q6sr4ump7/?taken-by=karczilla

Cheers.
Post Reply