Copter Simulator

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
I am not sure, whether I should post in english or german. If anyone needs an english translation, please add a comment, and I will provide a translation.

Ich hab jetzt geschafft, einen Quadrocopter Simulator zu entwickeln:

Benötigt wird Blender (von www.blender.org installieren) und dann
http://www2.futureware.at/~philipp/KanuPolo/Copter6.blend
entweder mit dem blenderplayer starten oder in Blender öffnen und dann im Hauptfenster "P" drücken.

Steuerung:
+ oder W: Mehr Schub auf alle 4 Motoren
- oder S: Weniger Schub auf alle 4 Motoren
Cursor Tasten:
Cursor Links: Weniger Schub auf die linken Motoren, mehr Schub auf die rechten Motoren damit er Copter nach links fliegt
Cursor Rechts: Weniger Schub auf die rechten Motoren, mehr Schub auf die linken Motoren
Cursor Oben: Weniger Schub auf die hinteren Motoren, mehr Schub auf die vorderen Motoren
Cursor Unten: Weniger Schub auf die vorderen Motoren, mehr Schub auf die hinteren Motoren
A: Drehung nach Links
😧 Drehung nach Rechts

Die Steuerung ist relativ schwierig, da man direkt die Motoren steuert, ohne einer intelligenten Steuerung, die den Copter stabil hält.
Aber ich denke daß es ein erstes gutes Beispiel, um zu lernen, was eine gute Steuerung-Software zu leisten hat um den Copter stabil zu halten, und über die physikalischen Flugdynamik.

Als nächstes will ich die Widefield Software an den Simulator anbinden, um die Widefield Software im Simulator testen zu können:
Als ersten Schritt habe ich von Blender die aktuelle Höhe des Copters aus der 3D Simulation ausgelesen und in das Height Feld geschrieben,
und dann daraus mit einer linearen Annäherung den zu simulierenden Luftdruck berechnet (pressure).
Dann will ich noch die Lage von Blender auslesen und damit den Lagesensor und Luftdurcksensor in der Widefield Software simulieren, und die Motor-Ansteuerung die die Widefield Software berechnet an die 3D Simulation im Blender übertragen.
0 Likes
5 Replies
Not applicable
Ich habe jetzt eine neue Version vom Quadrocopter Simulator entwickelt:
http://www2.futureware.at/~philipp/KanuPolo/Copter9.blend

Als Umgebung habe ich jetzt das Roboter-Challenge Szenario nachgebaut (2 Stangen, Schleife am Boden).
Dann habe ich noch ein paar Kameras eingebaut, mit den Tasten 1,2,3,4 kann man während der Simulation
zwischen den verschiedenen Kameras wechseln.
Eine der Kameras ist unten am Quadrocopter befestigt und schaut direkt nach unten, um die Kanupolo Boote zu beobachten
oder der RoboChallenge Schleife zu folgen.
Am hinteren Rand des Feldes habe ich 2 Bildschirme aufgestellt, die die Kamerabilder von 2 der Kameras anzeigen.
Über den Namen der Bildschirme wird gesteuert, welche Kamera dargestellt wird, wenn ihr eine andere Kamera darstellen wollt, einfach den Bildschirm umbenennen.

Zum Trainieren der Bildverarbeitung kann die Simulation die Bilder einer Kamera per HTTP POST an die Bildverarbeitungs-Software schicken.
(Server-seitig habe ich zur Zeit Code, der das Bild speichert und in PNG konvertiert, falls jemand Beispielcode braucht)
Um das schicken zu aktivieren und deaktivieren, bitte die Taste 'I' drücken.

Blender hat zur Zeit eine Einschränkung: Wenn man Kamerabilder speichern will, müssen sie auf eine Textur projeziert werden (also auf einem Bildschirm dargestellt werden)

Die Copter Physik habe ich um die Rotation um die Z Achse erweitert, und für die Copter Steuerung
die Tasten WASD zusätzlich zu den Cursortasten definiert, damit man mit 2 Händen gut steuern kann.
W: Nach oben, S: Nach Unten, A: Drehung nach links, 😧 Drehung nach Rechts
0 Likes
Not applicable
I have ported the Widefield software to Linux now and prepared it for simulation.
The last missing piece is the communication interface between the Blender copter simulation and the Widefield software.
I would have liked to use ZeroMQ, but it's really hard to get it running inside Blender, since there are no native Python implementations yet.
I think I will use UDP, if nobody has any better ideas.
0 Likes
Not applicable
Hi Philipp,

I´ve seen your status-update at the last Tele-Hase Event a few weeks ago. In the Video I´ve seen one of you using the Spectrum DX6i to control your Simulator.
I´d like to ask one question:

How did you manage to read the data coming from the DX6i? - I´m currently struggling with the analysation of the DSMX-data received from the DX6i.
In this context I´ve come up with this code (Link), which reads the information coming from the DX6i.

Current Status:
Reading the serial Interface (UART) @ 115200 BAUD with 8N1 seems to be correct. Interpreting the data however is out of my know-how.
We are using C/C++ and my python skills are unfortunatly not that good to understand what the different functions do...especially unpack()

Thanks in advance for your help and have a nice day!
Daniel




EDIT:
Unfortunatly had to reverse-engineer this on my own, but finaly got it. If someone needs Help in reading the Spectrum DSMX-Receiver don´t hesitate asking or sending me a PM or email.
0 Likes
Not applicable
Sorry for replying late.
At first I took an Arduino and used a Arduino PPM library, and then parsed the output over USB-serial. But the problem there was that sometimes it gave completely wrong values, which resulted in spikes and random erratic behaviour of the copter.
Perhaps it was some timing problem of the Arduino
Then I bought a Spectrum Trainerport->USB converter for about 10 EUR, which provides the values as joystick over USB.
I havent implemented the Joystick interface in my simulator yet, though, but I want to do that.
The interface is not a serial / UART interface, it is a analog PPM signal, so you cannot decode it with a serial/UART decoder, I would say.
My suggestion is to buy a PPM->USB converter.
0 Likes
Not applicable
The DSMX-Receiver (Sattelite) we were handed comes with a AR6210. Sat. and AR6210 comunicate with eachother over a serial Interface with 115200 BAUD 8N1.
In order to decode the Information sent it is necessary to read 16 byte and then do some shifting with the bytes. This aproach does not offer any failures for us.
We ported this python script to C/C++ and it works fine without any failures.
http://api.ning.com/files/kMyzkPYXBOF-sKuYWJXrKJd5YEup95t9mA-tCfsmai2lj*rlM5g5BGK8scoNV8HaWsXNjR9bU2...

FYI: We first had to bind Sender and Receiver as usual, then we detached the AR6210 from the Sat. Afterwards its pretty easy to pin the 3 wires of the Sat.
Red = 3.3V
Black = GND
Gray = Serial-Data (115200 8N1)

2329.attach
(image from: http://www.horizonhobby.co.uk/aeroonline/e6spektrum/e6receivers/e6-receivers/e6-remote-receivers/e6-...)

Decoding works with standard C-Libraries such as fcntl and termios.


int n = read(handle, &input, sizeof(input));

if(n>0)
{
ReadBufRC = input;
s++;
if(s==16)
{
for(i=0;i<16; i+=2)
{
chanID = ReadBufRC >> 3;
data[chanID] = (ReadBufRC & 0b111) << 8 | ReadBufRC[i+1];
}

// asigning the gathered values to the corresponding variables
QuadCopter.SET_throttle (data[0]);
QuadCopter.SET_aileron (data[1]);
QuadCopter.SET_elevator(data[2]);
QuadCopter.SET_rudder (data[3]);
QuadCopter.SET_Gear (data[4]);

s=0;
}


Up to know we just read one Character at the time, since we have not managed to read the 16 Characters on one time. read() just returns a max. of 8 Characters on one run. Nevertheless this snippet should visualize how we decoded the stream coming from the DMSX-Sat.
The data array now contains int-Values between 0 and 2000 for each joystick. Selecting the right model on the Spectrum Sender, enables getting some of the switches on the Sender into some channels transmitted. In our case, we use the GEAR-Switch to change between autonomous flight mode and manual flight mode
0 Likes