PC Client Software: Difference between revisions

From Distributed Autonomous and Networked Control Lab
Jump to navigation Jump to search
Jnoronha (talk | contribs)
→‎Swarm Client: Added Keyboard Input figure and finished 'Using the Platform Section'
Jnoronha (talk | contribs)
m added spacing between major sections
 
(7 intermediate revisions by the same user not shown)
Line 11: Line 11:


===Crazyflie Client GUI===
===Crazyflie Client GUI===
On the VM you can find the Crazyflie Client Graphical User Interface (GUI). To run the Client you want to open a terminal and navigate to <code>projects/''''FIND PATH''''</code> and then run the command <code>sudo ./bin/cfclient</code>  
On the VM you can find the Crazyflie Client Graphical User Interface (GUI). To run the Client you want to open a terminal and navigate to <code>/home/bitcraze/Desktop/projects/crazyflie-clients-python/</code> and then run the command <code>sudo ./bin/cfclient</code>  


(Alternatively, you can use the desktop to navigate to the folder and open a terminal there)  
(Alternatively, you can use the desktop to navigate to the folder and open a terminal there)  
Line 35: Line 35:
We get a return that says <code>radio://0/45/2M</code>, this line is the identifier string of the Crazyflie we are trying to connect to.  
We get a return that says <code>radio://0/45/2M</code>, this line is the identifier string of the Crazyflie we are trying to connect to.  


What this is saying is that we got a return from a Radio (Radio 0 specifically), from a Crazyflie on Channel 45 using a data rate of 2Mbps.
What this is saying is that we got a return from:
#Radio 0 (the first radio)
#Crazyflie on Channel 45  
#Using a data rate of 2Mbps


====Bootloader====
====Bootloader====
Line 81: Line 84:


('''Note:''' Any parameter changes made on this screen are NOT preserved when you turn OFF the Crazyflie.)
('''Note:''' Any parameter changes made on this screen are NOT preserved when you turn OFF the Crazyflie.)


==Swarm Client==
==Swarm Client==
Line 93: Line 97:
===Using the Swarm Client===
===Using the Swarm Client===
The Swarm Client uses the terminal interface for User Input.  
The Swarm Client uses the terminal interface for User Input.  
[[Image:CrazyflieTerminalInitial.png|400px]]
Here we see what the initial Terminal looks like before we do anything.


:1. The first thing you want to do before any testing is to run the <code>sudo make</code> command in the Swarm Client directory. (Yes, the 'sudo' is necessary)
:1. The first thing you want to do before any testing is to run the <code>sudo make</code> command in the Swarm Client directory. (Yes, the 'sudo' is necessary)
Line 103: Line 112:
:2. Pre-Test Checklist
:2. Pre-Test Checklist
::*Camera System is Turned on and Crazyflie Trackables are opened and visible.
::*Camera System is Turned on and Crazyflie Trackables are opened and visible.
:::[[Image:TrackingToolsOpenTrackables.PNG|400px]]  [[Image:TrackingToolsCrazyflieConstellationZeroing.png|400px]]
::*Radios are plugged into the USB Ports on the Client computer.
::*Radios are plugged into the USB Ports on the Client computer.
::*Crazyflies are ON and NOT in an Error State.
::*Crazyflies are ON and NOT in an Error State.
::**'''IMPORTANT!!!''' Face Crazyflie 'Nose' (Red Dot in picture) towards the East wall when powering ON! (to synch yaw correctly)
:::[[Image:CrazyflieLocationLayoutAnnotatedSmall.png|500px]]




Line 136: Line 148:
:5. End Program when finished (ctrl+c)
:5. End Program when finished (ctrl+c)
::This will end the program loop, print the current battery levels, and Delete the Radio pointers (shown at the end of the previous figure)
::This will end the program loop, print the current battery levels, and Delete the Radio pointers (shown at the end of the previous figure)
===Makefile===
The Swarm Client is compiled by a simple makefile. So when you call ''sudo make'' this makefile converts the C++ code files into an executable (.exe) for us.
<blockquote>
<code>
<pre>
g++ = g++ -Wall
all: eris_vrpn
eris_vrpn: eris_vrpn.h eris_vrpn.cpp vrpn.h vrpn.cpp CCrazyflie.h CCrazyflie.cpp
            CCrazyRadio.h CCrazyRadio.cpp CCRTPPacket.h CCRTPPacket.cpp CTOC.h CTOC.cpp
              simple.cpp simple.h pid.h pid.c controller.h controller.c multicast.c
$(g++) -g -O0 -o eris_vrpn eris_vrpn.cpp vrpn.cpp CCrazyflie.cpp
            CCrazyRadio.cpp CCRTPPacket.cpp CTOC.cpp simple.cpp pid.c controller.c
              multicast.c -lquat -lvrpn -lpthread -lusb-1.0
clean:
rm -f *.o eris_vrpn
</pre>
</code>
</blockquote>
----
----
<center> '''Main Directory''' </center>
<center> [[Crazyflie Swarm|Crazyflie Swarm Home]]  |  [[PC Client Software]]  |  [[USB Radio]]  |  [[Firmware]]  |  [[FAQ]] </center>


<center> [[Crazyflie Swarm]] | [[PC Client Software]] | [[USB Radio]] | [[Firmware]] </center>
<center> '''Modifications Directory''' </center>
<center> [[Controller]]  |  [[Logging]] | [[Keyboard Commands]] | [[USB Radio#Changing Radio Channel|Changing Radio Channel]]  |  [[Flight Modes]]  |  [[Callbacks]]  |  [[Adding a Crazyflie]] | [[Firmware]] </center>

Latest revision as of 16:58, 3 August 2016

The PC Client software comes in many forms. The out-of-the-box Client is written in Python and has a Graphical User Interface (GUI). The GUI is well suited for beginners, but can only support a single Radio and a single Crazyflie at a time. The easiest way to start out is with the Bitcraze Virtual Machine (VM), which comes with all the files and dependencies pre-installed and can run on any computer (Windows, Mac, Linux, etc.).

For more advanced users who want to use the swarm capabilities of our platform will have to use the Swarm Client we developed in C and C++.

Bitcraze VM

(Note: The VM is updated frequently so the information below may be different than the current VM)

The Bitcraze wiki has a tutorial on installing the VM. Along with another tutorial on how to get started using the VM.

These are both very simple starting guides that will help you become familiar with the VM.

Crazyflie Client GUI

On the VM you can find the Crazyflie Client Graphical User Interface (GUI). To run the Client you want to open a terminal and navigate to /home/bitcraze/Desktop/projects/crazyflie-clients-python/ and then run the command sudo ./bin/cfclient

(Alternatively, you can use the desktop to navigate to the folder and open a terminal there)

Once you do that you should see something similar to this:

This is the main screen of the Client GUI and there are many tabs and features that you can access directly from this screen.

The most important parts of this screen are the following:

  1. Connect Button
  2. Bootloader (Crazyflie Drop Down -> Bootloader)
  3. Plotter Tab
  4. Log Blocks Tab
  5. Parameters Tab

Connect Button

This is where you will scan for Crazyflies that are powered ON. All Crazyflies not already connected will show up in the popup

We get a return that says radio://0/45/2M, this line is the identifier string of the Crazyflie we are trying to connect to.

What this is saying is that we got a return from:

  1. Radio 0 (the first radio)
  2. Crazyflie on Channel 45
  3. Using a data rate of 2Mbps

Bootloader

This where you can install new Firmware to the Crazyflie.

The first thing you'll need to update is to build the Firmware version you want into a .bin file. You can do this by just running the make command in terminal while located inside the Firmware directory you have modified.

Once you have that .bin file built you:

  1. Open the bootloader shown
  2. Hold down the power button on the Crazyflie 2.0 for around 3 seconds until the 2 blue LED's flash and alternate. This puts the Crazyflie in bootloader mode. (NOTE: Recommend having ALL other Crazyflies OFF or else it could accidentally flash both Crazyflies.)
  3. Then hit Initiate bootloader cold boot (it should connect to the Crazyflie in bootloader mode after a few seconds, Status will change from 'Not Connected' to 'Connected')
  4. Hit Browse and find the .bin file you built earlier.
  5. Then click Program and wait for the progress bar to complete.
  6. Restart the Crazyflie in Firmware mode and make sure it starts up normally, if something seems wrong just repeat steps 2 through 6 again.

Logging Tab

Once you connect to a Crazyflie you can monitor certain log variables that have been set up. You will see a plot of the data similar to this:

On this screen we can do the following things:

  • Dropdown Menu at the top of the screen
    • Select which log block you want to plot on screen.
  • Scale the X-axis of the plot by:
    • Range
    • Number of Samples
    • Time in Seconds
    • Manually
  • Scale the Y-axis by:
    • Automatically
    • Manual Range


Parameters Tab

This tab displays all the parameters currently set up on the Crazyflie Firmware. Once you connect to a Crazyflie it lists these parameters in a table format similar to below:

For each parameter we get its Name, Variable Type, Access Type (Read/Write), and its Current Value.

We can also modify the parameter values on this screen in real-time and the changes will be sent to the Crazyflie automatically.

(Note: Any parameter changes made on this screen are NOT preserved when you turn OFF the Crazyflie.)


Swarm Client

The swarm Client is a re-creation of the Original Client but programmed in C and C++.

The benefit of this is that

  • We use a unified language between Client and Firmware
  • Easily migrate this platform to any linux distribution that can install the Crazyflie dependencies.
    • Our platform code itself requires only the VRPN libraries and a generic C compiler.

Using the Swarm Client

The Swarm Client uses the terminal interface for User Input.

Here we see what the initial Terminal looks like before we do anything.


1. The first thing you want to do before any testing is to run the sudo make command in the Swarm Client directory. (Yes, the 'sudo' is necessary)
This will make sure you have all the necessary dependencies, that the code is error free, and then it will build an executable (.exe) file of the Swarm Client code. An error free make will look something like this:
There will be warnings, but those don't cause any issues right now.
2. Pre-Test Checklist
  • Camera System is Turned on and Crazyflie Trackables are opened and visible.
  • Radios are plugged into the USB Ports on the Client computer.
  • Crazyflies are ON and NOT in an Error State.
    • IMPORTANT!!! Face Crazyflie 'Nose' (Red Dot in picture) towards the East wall when powering ON! (to synch yaw correctly)


3. Run the executable file using the command sudo ./eris_vrpn in the same directory (Yes, the 'sudo' is necessary). This will start the program initialization and a bunch of status info will flood the screen. You will know the program is ready for input when you see the following:
This means that the Crazyflie yaw has been synchronized with the Camera system and they are ready to fly.
4. Input a Keyboard Command
This will depend on what you have programmed as the keyboard input commands. As of 7/19/16 we have the following Keyboard Commands active:
  • '1' - Rotates Yaw of Crazyflie1 +45 degrees
  • '2' - Rotates Yaw of Crazyflie1 -45 degrees
  • 'q' - Ends Main Loop (OBSOLETE - Replaced with ctrl + c)
  • 'e' - Landing Mode (for ALL Crazyflies)
  • 't' - Crazyflie1 Take-Off
  • 'y' - Crazyflie2 Take-Off
  • 'u' - Crazyflie3 Take-Off
  • 'i' - Crazyflie4 Take-Off
  • 'h' - Hand Gesture Mode (for ALL Crazyflies)
  • 'm' - Mirror Mode (for ALL Crazyflies)
  • ctrl+c - Quits Program, performs all cleanup.
An example of what this would look like in the Terminal is shown here:
So you can see we commanded all 4 Crazyflies to take off (t,y,u,i), then activated Landing Mode (e), then activated Hand Mode (h), and then Ended the Program (ctrl+c).
5. End Program when finished (ctrl+c)
This will end the program loop, print the current battery levels, and Delete the Radio pointers (shown at the end of the previous figure)


Makefile

The Swarm Client is compiled by a simple makefile. So when you call sudo make this makefile converts the C++ code files into an executable (.exe) for us.


g++ = g++ -Wall

all: eris_vrpn

eris_vrpn: eris_vrpn.h eris_vrpn.cpp vrpn.h vrpn.cpp CCrazyflie.h CCrazyflie.cpp 
             CCrazyRadio.h CCrazyRadio.cpp CCRTPPacket.h CCRTPPacket.cpp CTOC.h CTOC.cpp 
               simple.cpp simple.h pid.h pid.c controller.h controller.c multicast.c
	$(g++) -g -O0 -o eris_vrpn eris_vrpn.cpp vrpn.cpp CCrazyflie.cpp 
             CCrazyRadio.cpp CCRTPPacket.cpp CTOC.cpp simple.cpp pid.c controller.c 
               multicast.c -lquat -lvrpn -lpthread -lusb-1.0
 
clean: 
	rm -f *.o eris_vrpn



Main Directory
Crazyflie Swarm Home | PC Client Software | USB Radio | Firmware | FAQ
Modifications Directory
Controller | Logging | Keyboard Commands | Changing Radio Channel | Flight Modes | Callbacks | Adding a Crazyflie | Firmware