Introduction and Prerequisites
This article covers a basic and practical way to implement the precision of RTK GPS into your data gathering workflow. The GNSS modules used as examples in this guide are the Emlid Reach M2 and M+.
Though the Emlid Reach is featured, it should be noted that other RTK systems are compatible with our sensors and the larger take away from this article should be the general way in which our sensors can be used with an RTK GPS system. However, it is important to note that not all RTK systems are created equal, and thus not all RTK systems are compatible with MicaSense sensors at this time.
NOTE: If you are looking to achieve RTK with DJI drones, please see this article instead: How to set up RTK with M300 and MicaSense cameras
- Enabling the Top of Frame output
- Connecting to the Emlid Reach
- Data Collection
- Post Processing
Please familiarize yourself with the Emlid Reach RTK GPS if you have not done so already. Documentation can be found at Emlid’s knowledge base. Additionally, basic familiarity with the command line and/or python is helpful for the post-processing workflow.
Top of Frame Output
MicaSense cameras are capable of precisely communicating capture time to an external device through the use of the 'Top of Frame' pulse at the time a capture is taken. When connected this way, the Reach module will save each top of frame output in its log files for later use in associating its precise coordinate positions with each capture.
To enable Top of Frame, connect to the camera's web interface, and navigate to the Advanced Configuration page. Scroll down until you see the Pin Configuration section. The Top of Frame setting on the camera should be set to “Pulse low, rest high”. Our cameras provide several options as to which pin can be configured to a Top of Frame output. Below is an example of the settings page on a RedEdge-MX, with the default pin settings:
Pin settings may differ between camera models
Connecting to the Emlid Reach
Which pin you decide to use for Top of Frame depends on your camera and integration requirements. For example: If you have a RedEdge-MX, and are using our automatic triggering modes, then you are best suited to assign Pin 1 in the PWR/TRG connector port. This will make things easier because no cable modifications will be required to the 6-pin DLS cable where the other configurable pins (GPS Pin 4 + 5) are found.
Whatever your chosen pin for Top of Frame, this must be connected directly to the Emlid Reach's "Time Mark" pin (Pin 2), found on the Emlid Reach's connectors labeled C1 or C2. These connectors are interchangeable, so you can use whichever one you prefer. See pinout below.
You can either provide a 5V line to the same connector's 5V pin (Pin 5), OR power the module via the USB port. NOTE: Do not plug two power supplies at the same time as it may damage the device.
Below is a screenshot of the Emlid Reach M2's connector pinout (Reach M+ has the same pinout):
NOTE: If you are using an Altum, there is an additional consideration: Pin 8 on the Altum's host connector is an isolated ground (ISO GND) pin. We recommend connecting this directly to the Emlid Reach's GND pin (Pin 1), on the same connector that is receiving the Altum's Top of Frame output. For more information on the Altum's host connector, please see the Altum Integration Guide.
Example Integration
Powering the Emlid Unit
The Emlid requires 3.0 -5.5 VDC provided to pin 5 of either C1 or C2, with pin 1 being the GND, as shown above. The Emlid documentation cautions against connecting more than power source at a time, including USB connections.
https://docs.emlid.com/reach/reference/specifications/power-supply
While the Emlid can be powered via USB cable, the USB ports on MicaSense cameras should not be used for this purpose as these ports are specifically configured only for WiFi or Storage. One option is to power the Emlid from an external battery on the aircraft, such as a USB battery pack. The Emlid can also be powered from the MicaSense camera by sharing the 5V supplied to the DLS2.
DLS2 Pinout from camera Integration Guides
Pin # | Signal | Direction |
1 | 5.0 V DC Output | Output From Camera |
2 | DLS 2/GPS RX | Output From Camera |
3 | DLS 2/GPS TX | Input To Camera |
4 | GPS IO 0 (Configurable) | Input To Camera/Output from Camera |
5 | GPS IO 1 (Configurable) | Input To Camera/Output from Camera |
6 | Ground | Ground |
This second option does not add the weight of an additional battery and conveniently allows the Top of Frame signal to be connected to the Emlid. However, this option does require the construction of a custom y-harness, as described below.
External GPS Antenna:
The Emlid unit does not have an internal GPS antenna and requires an external antenna. The Emlid includes an MCX port for the external GPS antenna but adapters are available to support other types of connectors. More information about compatible antennas can be found in this forum:
https://community.emlid.com/t/antennas-for-reach-m2/20729
Building a Custom Emlid Y-Harness:
The Emlid C1 and C2 connectors require a 5-pin JST-GH connector, referred to as GHR-05V-S or GHR-05V-S. A kit like the one below provides multiple of these JST-GH connector housings as well as wire leads with pre--crimped JST-GH contacts which can be used to create the power and ground branches:
https://www.amazon.com/dp/B087N4GY8Z?psc=1&ref=ppx_yo2ov_dt_b_product_details
The y-harness also requires a standard 6-wire DLS cable that is appropriate for the camera system:
- For Altum, Altum-PT, RedEdge-P, and any camera with a QuickMount or Skyport
- For RedEdge-M/MX without QuickMount or Skyport (Standalone)
The y-harness should be constructed as follows:
- Plan the mounting of the Emlid on the aircraft. The Emlid does not have an internal GPS receiver but instead relies on an external antenna. Therefore, the placement of the Emlid unit does not require consideration of GPS. Measure the wire routing distance from the DLS2 connector to the location of the Emlid.
- Locate the 5V wire in the DLS2 cable. This will be the only red wire, pin 1. Near the DLS2 end of the cable, cut the 5V wire and solder on a new wire (with a pre-crimped contact) to create a second branch that is long enough to reach the Emlid unit. After soldering, be sure top properly cover the joint with heat shrink tubing. Connect the new branch of the 5V line to pin 5 of a 5-pin JST-GH connector housing by using a pair of tweezers to press the contact into the connector housing until it clicks. To check the connection, gently pull on the wire to ensure that it does not slip out of the housing.
- Locate the GNS wire in the DLS2 cable. This will be the wire furthest from the red wire, pin 6. Near the DLS2 end of the cable, cut the GNS wire and solder on a new wire (with a pre-crimped contact) to create a second branch that is long enough to reach the Emlid unit. After soldering, be sure top properly cover the joint with heat shrink tubing. Connect the new branch of the GND line to pin 1 of the 5-pin JST-GH connector housing by using a pair of tweezers to press the contact into the connector housing until it clicks. To check the connection, gently pull on the wire to ensure that it does not slip out of the housing.
- Locate either the GPIO 4 or GPIO 5 wire on the DLS2 cable. These will be the two pins closest to the GND wire. Either GPIO will work but take note of which is being used. On the DLS2 end connector, use a pair of fine tipped tweezers to gently pry up the plastic retainer tab of the wire. At the same time, gently pull the wire out of the housing. Do not use excessive force. If the wire does not come out easily then the plastic retainer tab is still catching. Connect the loose GPIO wire to pin 2 of the 5-pin JST-GH connector housing. This is the position next to the red 5V wire. Use a pair of tweezers to press the contact into the connector housing until it clicks. To check the connection, gently pull on the wire to ensure that it does not slip out of the housing. The 6-pin DLS2 connector and 5-pin Emlid connector should now look like those shown below.
- Connect the new y-harness to the camera and DLS2 and power on as usual. Check that the camera and DLS2 boot properly. Before attempting to connect the new y-harness to the Emlid, use a multimeter to double check the voltage and polarity of the 5V and GND pins of the 5-pin Emlid connector.
- In the camera's web UI, on the Settings page, be sure to set the appropriate GPIO pin to Top of Frame Output. After any change is made, it is necessary press the Save button on the bottom of the page.
Gathering the Data
The Emlid Reach modules do not output Ublox GPS packets at this time, so GPS coordinates will not be written to the image metadata directly. A python script is provided below to assist in creating a geolocation file to use with Pix4Dmapper, to associate image number with GPS coordinates.
Ensure that your base station is set up correctly with the selected coordinate gathering mode set up to use the method most suitable for you (see Emlid's Quick Start setup), and allow the base station to achieve a position fix.
Afterwards, proceed to fly your mission using the Emlid module attached to your drone and your MicaSense camera with proper Top of Frame output set (as discussed in the previous section of this guide).
Post Processing
Once the flight is done, download both sets of raw logs (the .ubx files) and proceed to process them in Emlid Studio by following the steps in Emlid's GPS Post-Processing tutorial. Refer to the required file types for the Rover, Base, and Navigation slots.
Note: Before processing, it is very important to make sure that the processing settings are correct. In order for the timestamps from the Emlid unit to match with those in the image metadata, the Time Format must be set to the hh:mm:ss UTC option, as shown below.
Once this is complete, you should end up with a .pos file including the name “_event” at the end, which you can view with a text editor such as Notepad++; this will contain GPS locations from each time the camera took a capture.
The last step is to parse this file into a format suitable to upload to Pix4D as a geolocation file.
This can be done with the python script below, which will take in the “_events” file as an input, and create an output file at the provided location, containing each capture and its proper GPS coordinates in Pix4D’s LLH (Latitude, Longitude, Height) format. You may need to alter the script slightly depending on your use case.
gps_image_insert2.py:
import click
import re
import csv
@click.group()
def main():
pass
@main.command()
@click.option('--input_path', default=None, help='Path of file to have flight image numbers inserted (original file is kept unmodified')
@click.option('--output_path', default=None, help='Path to save new file output with image numbers inserted')
def create_image_location_file(input_path, output_path):
img_counter = 0
# with open(input_path, 'rb') as f:
with open(input_path, 'r') as f:
text_reader = csv.reader(f, delimiter=' ')
for row in text_reader:
date_to_img = re.match('\d{4}.\d{2}.\d{2}', row[0])
if date_to_img:
# g = open(output_path, 'ab')
g = open(output_path, 'a')
# text_writer = csv.writer(g, delimiter=' ')
text_writer = csv.writer(g, delimiter=',')
for n in range(1, 6):
text_writer.writerow([('IMG_%04d_%d.tif' % (img_counter, n))]
+ [row[4]]
+ [row[5]]
+ [row[9]])
g.close()
img_counter += 1
if __name__ == "__main__":
main()
You must have python and the click library installed. A typical usage of this script involves opening up the command line, navigating to the directory the script is saved to, and typing the following:
python gps_image_insert2.py create_image_location_file --input_path C:\\Users\\Username\\raw_201712052221_events.pos --output_path C:\\Users\\Username\\pix4d_geolocation_format.csv
Input and output file paths should be tailored to your specific file locations. (Double slashes are needed on Windows to properly input the file path). You may need to modify this script depending on your use case (e.g. multiple flights).
CAUTION: The script is blind to which captures you are intending to stitch, so it is highly recommended that the GPS log files used to create the final "_events" file contain only camera time marks from the actual flight (i.e, not including panel images). Also, unless an additional uBlox compatible GPS is used, since the Reach is unable to send messages in a format that the camera is compatible with, this restricts flying to less precise modes (such as Timer Mode).
However, using an additional GPS (such as the one you received with your camera kit), will allow you to fly with the camera in Overlap Mode to avoid excessive captures. This may require some cable modification depending on your integration requirements.
More information about Pix4D’s geolocation file format can be found here: Image Geolocation File
You will now be ready to process your imagery with RTK GPS precision. More information about using Pix4D to process your MicaSense data can be found in our How to Process MicaSense Sensor Data in Pix4D guide.
Agisoft MetaShape
- Import photos as normal.
- Select File >Import > Import Reference.
- In the Open pop-up, browse to and select the Pix4D geolocation .csv file and then press the Open button.
- In the Import CSV pop-up:
- Select Comma for Delimeter.
- In the Columns section, adjust the Longitude, Latitude, and Altitude column numbers so that the values correctly match with the headings shown in the preview field below.
- Press the OK button.
- Check that reference values have been applied correctly to all images.
- Proceed with processing as normal: Process MicaSense sensor data in Agisoft Metashape.