LongTermGoals
- Measure Winds aloft, to predict fire spreading, so that firefighting resources are dispatched efficiently.
- Measure Temperatures while in flight to develop an accurate "big picture" of the situation.
- Deliver tactical packages: a) solar powered drone charger package to extend the working range of drones b) combination sensor and communication repeater package putting useful resources in remote places c) fire extinguishing agent delivery package to stop and prevent fires.
The flight course drift angle due to wind can be calculated by the drone controller and reported in the flight telemetry along with the position of the drone and temperatures measured along the path. With multiple drones a map of the situation can be quickly developed. A tactical package release mechanism will be developed for delivering tactical packages reliably.
Two Ways to Measure Wind Conditions During Flight- Hover-mode Hover without the GPS being used to hold the quadcopter's position over the ground, and measure the drift by using GPS telemetry. To save energy this could be combined with a behavior that scans a scene with an IR temp sensor by rotating the quadcopter to build a 360 degree temperature map around the quadcopter's location, PX4 ALTCTL (Altitude Control) mode does this. The GPS position drift while in Altitude control gives an idea of the winds aloft. MavLink commands issued from the ground control computer and calculations done by the ground control computer could perform this wind measurement activity. The long term goal is to have this done in an autonomous fashion without the use of the ground control computer.
- Drift Angle-mode While traveling between mission waypoints allow the flight path to drift by turning off GPS based course corrections. Measure the drift angle from the intended course and do a calculation to infer the wind pattern. This is rather complicated and has several options on whether to do this from the Ground Control computer or a Companion computer mounted in the quadcopter. To save energy this could be combined with a behavior that scans the flight path with the Melexis 90614 IR temp sensor to build a temperature map along the quadcopter flight path,
Mounting the Rapid IoT prototyping kit,PixyCam and Melexis 90614 temp sensor
The PixyCam, Melexis 90614 temperature sensor and the Rapid IoT companion computer are attached to the frame with cable ties. The desire is not to block airflow and to keep the center of gravity as low as possible to improve flight stability. The attachment of the Rapid IoT companion computer allows the board to swing from side to side.
Start with the HelloSky example
Start with the hello sky example to learn the basic information needed to add a command to the drone that can be sent via the MavLink console in the QGroundControl program. If you do this, then the following steps to add the Melexis temp sensor and Pixy Cam 2 will make much more sense, and the whole process of building the drone software will be more enjoyable.
Adding Pixy Cam 2 code tothe PX4firmware
Collect the example code from a GitHub repository for Pixycam2.
I am using MCUXpresso as my code building environment, if you use a different environment to build the PX4 code you will have to do some of these steps in a slightly different way.
Create a pixycam directory, in the src/drivers directory of the firmware project. We need a directory to put the pixy cam code that we just collected from the repository.
Import the pixy cam code into the pixycam directory using File->Import from the File dropdown menu.
Select the directory where the pixy cam files are located.
Select the destination for the files to be imported.
Now select all the files to import them into the pixycam directory and click Finish to import the files
.Add pixycam to the list of commands that are accepted by the MavLink console. The list of commands is found in then file boards/nxp/fmuk66-v3/src/default.cmake
Add the pixycam command under the DRIVERS heading. The list is in alphabetic order, so I placed pixycam into the list in alphabetic order.
Build the project.
You will need to switch your PixyCam 2 to use the I2C interface. Use the PixyMon program and go into settings to select I2C as the communications interface.
If you have a cable for the Pixy Cam 2 to FMU I2C/NFC connector now is the time to plug it in, If you do not have such a cable you will need to fabricate such a cable.
After the firmware is programmed into the flash of the FMU, start QGroundControl and get to the MavLink console. Type help and find the pixycam command that has just been added.
Type pixycam to start the command.
I changed the pixycam command slightly because it had a "forever" while loop. Now it does getBlocks only 100 times and then quits the command.
I followed the directions here to train Pixy Cam 2 to detect fire colors.
The PixyMon program configuration settings that produced this result:
Tested with a fake fireplace.
The process of adding the Melexis demonstration code is so very similar to that of adding the PixyCam code so I am not going to give the same level of detail to the instructions to add the Melexis temperature sensor code.
- Copy the Melexis 90614 demo files from the GitHub repository
- Create a directory in the src/examples directory named hg_mlx90614
- Import the demo codef from the local repository files into the hg_mlx90614 directory you just created,
- add a line with hg_mlx90614, under the EXAMPLES heading, to the default.cmake file. This adds the hg_temp command for the melexis temp sensor to the list of commands. If any part of this is confusing look at the tutorial link.
- build the code and flash program the FMU
- start QGroundControl and get to the MavLink console
- type help and make sure that hg_temp appears in the list of commands
- connect the melexis 90614 sensor to the FMU I2C connector, you may need to build a Y harness if you intend to use the pixy cam and melexis temp sensor at the same time, or use an I2C adapter board, either way some soldering and cable construction is involved to use both systems at the same time.
- type hg_temp and use the command to measure temperatures
I have tested the Melexis 90614 temperature sensor code in PX4. Unfortunately the FMU code repository I picked up only looked for compass #0 on I2C bus 2 when compass #0 is really on I2C bus 1. This caused pre-flight checks to fail because compass #0 is missing, keeping the drone from being armed for flight. To fix the problem of the missing compass #0:
The file is /boards/nxp/fmuk66-v3/init/rc.board_sensors.
instead ofist8310 -C -b 2 start
useist8310 -C -b 1 start
At first, I really thought the Melexis Demo code was the difficulty, but this file problem was the real cause of the missing compass problem.
This data was taken with my hand close to the Melexis temp sensor. The Melexis sensor sees a 27 degrees C average temperature in the field of view (FOV).
In the FMU code, the NuttX operating system making sure that all the tasks, especially the flight control tasks, are getting done. But suppose we wanted to add some special code and we were uncertain how much of a processing burden we were going to create for the FMU. Will it mess up the flight control tasks? We would also like to keep the different application functions operating on separate hardware specifically optimized for that application function. For instance, when a new better FMU comes along, we don't have to change all of our software that contains our special code, because the FMU hardware changed. The Rapid IoT prototyping kit brings us extra computational power in a very compact size and consumes much less power than some other companion computer hardware solutions. It is optimized for IoT and this is great part of the future of this project.
RAPID IoT companion computerI found that the "Hello World!" Rapid IoT example project did not compile in MCUXpresso 11.0 but does compile in MCUXpresso 10.2.1. Into the "Hello World!" demo the MAVLink project is inserted into the Rapid IoT firmware. See this Rapid IoT MavLink demo weblink for the process of building the demo code. The HDIB shown uses a cable to connect to the IR/TLM2 connector of the FMU for the companion computer serial connection.
This picture shows the Rapid IoT prototype receiving MavLink messages. In further development, the Rapid IoT prototype will be used to originate MavLink messages that will be transmitted in the telemetry and visible from the QGroundControl program running on a laptop.
Adding a fire retardant delivery systemA cardboard box is re-purposed to deliver fire retardant. I am testing with Nerf ammo since it is much easier to clean up than a powdered fire retardant.
I am building a wooden lever for opening the box. The chopstick glued across the bottom of the box is used with rubber bands to make sure that the box closes nicely. I am using a very small 9 gram servo to open the box. I want to keep the fire retardant delivery system very light in weight.
Remember to supply power to the BEC position of the FMU. The power to the aux servo positions must be supplied by the BEC position of the servo connectors on the FMU. It took me a little while to figure that out. :)
A Lifting Point for Various Package Delivery SystemsThe battery holder slides to the back of the drone to compensate for the weight added to the front with the Rapid IoT companion computer, Pixy Cam2 and the Melexis 90614 temp sensor. I have one of the supports firmly held in the center by opposing strong cable ties. The battery pack and holder have velcro fasteners, in addition to the belt-like fastener, so that the battery cannot slide in the battery holder. I want to be very sure that the center of gravity of the drone cannot shift during the flight.
A lifting point for various package delivery systems will be tied into the front brace of the battery holder now that it has been prevented from moving.
As the sun set on the final day of the contest I decided to test the fire retardant delivery system. It was windy so the flight conditions were not very good, but I gave it my best try. The drone is not damaged, my pride as a drone pilot will recover. It is best to do this sort of test on a calm day.
Wrapping things upI have shown how to include software for thee subsystems, PixCam2, Melexis 90614 temperature sensor and Rapid IoT as a companion computer. I also did a quick build of a fire retardant delivery subsystem. Now the work really begins to create a well thought out system based on these subsystems.
Additional Stuff you may likeDrone Build TipsI used Velcro and cable ties instead of the double sided sticky tape to secure the FMU, telemetry modem and ESCs. This provides more flexibility as different tests are perfomed on the drone as a system.
Manage the balance of your finished drone carefully. A lower center of gravity may help the flight characteristics of your drone.
Comments