Firefly Eindhoven - Operator Manual

From Control Systems Technology Group
Jump to navigation Jump to search

Simulink Model Generation

1 UWB Positioning System

1.1 Quick Setup

• beacon 0 at position [0, 0]

• beacon 1 at position [0, y1]

• beacon 2 at position [x2, y2]

• Measure distance d01 between beacon 0 and beacon 1

• Measure distance d02 between beacon 0 and beacon 2

• Measure distance d12 between beacon 1 and beacon 2

• Update the measured distances in the Simulink model, in a Matlab function inside Decawave subsystem block

1.2 Remarks

• Current coordinate system convention assumes x-axis to be going NORTH and y-axis going EAST from beacon 0

• beacon 0 and beacon 1 have stickers that indicate their number and switches

• beacon 2 has no indicator sticker and its switch has on and off reversed compared to the other beacons


2 Curiosity Drone Simulink Model Generation

• Using NEW clean model - copy the whole folder control_example_for_man_uwb_fix from Avular’s simulink_lib/examples to a chosen destination

• Using OLD modified model - copy the whole folder with the chosen version of the Simulink model to a chosen destination

• Make sure that the current working folder of Matlab is set to the location where the Simulink model is located

• FIRST TIME BUILD ONLY - Go into Simulink Settings, and update toolchain paths by unchecking three boxes (paths becomes white/active), clicking Update installation path button, and checking the three boxes again (paths becomes gray/inactive) - REMARK: checking/unchecking of the boxes is usually slow

• Start building the model

• FIRST TIME BUILD ONLY - When prompted with Download, Migrate or Cancel select Migrate. Then in the second prompt select Download

• If an Eclipse or Java (error) prompt occurs just click OK

• The build is finished when one of the following Simulink errors occurs: Cannot upload firmware (usual error) or Could not create binary (less common error)

• Import the generated model into System Workbench by selecting File menu and then Import. Under the General folder select Existing project. In the path, point to the current working folder of Matlab and click anywhere in the window to make the path field inactive. Some build folder should appear and be automatically checked. After that just continue by clicking next

• FIRST TIME BUILD ONLY - Go to Debug Configuration, from the list on the left, double click the first option with a blue icon. From newly opened tabs, select the second tab Debugger, scroll down and in the Script section select Use local script. Then click browse and select the .cfg file with longer name. Finalize configuration by selecting Apply and then Close.


- Apply the manual patch - found on Avular’s Gitea under Avular/simulink_lib. In the Issues tab, use search option with "UWB" as a query and select UWB not receiving ranges

Patch.png

- Build the model

- Turn on the drone, first connect the cable to the drone on the right side (side with two ports) to the left port. Only then connect the programmer cable (the larger one) to the PC

- Click the debug icon or right click on the built binary and select Debug as... and pick the first option

- Once available at the debug screen, select Resume icon and then Disconnect icon (both found at the top bar close together near pause and stop icons)

- The drone can be now disconnected, reset the drone by turning it off and on before using the uploaded model

Note: Once the simulink model is uploaded in the Cortex of the drone, the drone must be restarted. This is done by removing and re-installing the battery. Its is significant to note that when re-installing the battery, the drone must be kept straight, as it takes a few seconds for the sensors in the drone to calibrate. Not doing this results in accurate sensor data.

Troubleshooting

3.1 Simulink build: Cannot create .extSettings file error

Replace the current .extSettings file, found in «model_name»_build folder, with a one copied from previously working models. Otherwise, delete «model_name»_build, «model_name»_stm32 and slprj folders to perform a clean build. If the error persists, restart the whole Matlab and perform a clean build again. 2 3.2 Simulink build: Unknown perf_count error

Make sure you are using the Simulink model from control_example_for_man_uwb_fix found in the Avular’s Simulink library examples folder.

3.3 Drone debug: cannot start debug

Just reconnect the cable. Make sure that the programmer cable was first plugged in to a turned on drone and only then to the PC.

3.4 Drone debug: debug starts and fails halfway In the System Workbench console output check if the STlink Debug clock frequency is set to 4000. If it uses the value of 1800, select correct .cfg file in the Debug Configuration (refer to Section 2)

3.5 «model_name»_visualize.slx model misses files Make sure that Avular’s Simulink library simulink_lib with all its subfolders is added to the Matlab path.

3.6 UWB: Poor position measurements If position measurements are poor, first reset the drone by turning it off and on. If the measurements are still poor, turn off all the beacons and only then turn them on again. In case the problem persists, replace the batteries.

Remote Control

The curiosity drone is operated via a remote control. The numbers in the remote control diagram correspond to the following:

1. SwitchB

2. VrA (not used)

3. SwitchA

4. Left stick (throttle/yaw)

5. Power button

6. Switch C

7. VrB (not used)

8. Switch D

9. Right stick (roll/pitch)

10. Neck strap eye

11. Power button

12. Touch screen

Remote.png

Steps to fly the drone

1. The remote controller is turned on by pressing both the power buttons.

2. Before the drone is in flight mode, it must be armed. This is done by moving the left stick (4) towards right. This changes the blue light of the drone to red.

3. Once this is done, flip switchA to downward position. This loads the simulink model and the drone is in offboard mode.

4. Flip SwitchD to take off. This sets the drone in hover mode.

5. During this mode right stick can be used to alter the x-y position of the drone.

6. Once the drone is at correct position, switchB can flipped, this runs the simulink model and the trajectory can be executed.

Note: In case of any emergencies, switchD can flipped back and this will cause the drone to land, during the landing phase, the user can use the right stick to control the position of drone to avoid any collisions while landing.

Once the drone has landed, switchB can be flipped back to its initial position. This is followed by switch off switchA and then disarming the drone by keeping the left stick towards left.

The remote controller can be turned off by pressing both the power buttons simultaneously. This opens up a dialog box on the touch screen where touching yes will switch off the remote controller.