AP_HAL_ChibiOS: added NxtPX4v2
[ardupilot.git] / AntennaTracker / AntennaTracker.txt
blob8ced3605b224659434d365ac4508fdfd69f9a93b
1 AntennaTracker
3 Mike McCauley
4 2014-03-05
6 This is the ardupilot AntennaTracker
8 This software, combined with appropriate hardware, can be used to cause a
9 high-gain antenna to track a mavlink equipped air or ground vehicle in real
10 time, providing higher quality radio links over longer distances than a
11 stationary or omnidirectional antenna.
13 AntennaTracker can be a stationary installation on the ground or can be
14 mobile, mounted on a vehicle, and moving at the same time as the vehicle it is
15 tracking, such as on a pursuit vehicle, etc.
17 Antenna Tracker Hardware
19 The software works with:
21 - Alt-Azimuth mounted antenna tracker, equipped with 2 servos: one for Azimuth
22 (also called bearing or yaw) -180 to 180 degrees and one for Altitude (also
23 called elevation, or pitch) -90 degrees (straight down) to 90 degrees
24 (straight up). I used an Eagle Tree Antenna Pan-Tilt.
26 - Ardupilot compatible processor such as 
27 -- Flymaple
28 -- others tested?
29 and with a radio or wired link to a source of mavlink messages with the
30 tracked vehicle's position data. 
32 A suitable power supply is also needed, possibly battery powered. In the case
33 of Flymaple, the onboard 5V regulator is not able to drive large servos
34 without causing large amounts of electrical noise in the processor, so you
35 would probably need an external 5V regulated supply
37 Theory of Operation
39 AntennaTracker receives real-time GPS position reports from the vehicle being
40 tracked (in the form of GLOBAL_POSITION_INT messages sent by mavlink radio
41 connection or possibly by hardwired serial connection). AntennaTracker also
42 knows its own current position. Based on these 2 sets of coordinates, it
43 calculates the magnetic bearing and elevation to the vehicle. It then moves
44 the tracker servos until the antenna (and the AntennaTracker processor) are
45 aligned with the desired bearing and elevation. At this stage, the antenna is
46 pointed straight at the tracked vehicle. As the vehicle (and possibly the
47 antenna mount itself) move around, the servos are continually moved to track
48 the vehicle.
50 AntennaTracker currently only supports closed loop feedback to position the
51 antenna. This requires that the AntennaTracker processor (including
52 accelerometers and compass) be mounted on the moving part of the antenna
53 tracker hardware. The servos are moved until the yaw and pitch of the processor
54 (and therefore of the antenna itself) matches the bearing and elevation to the
55 tracked vehicle.
57 How does AntennaTracker know where it is on the earth?
59 - If the tracker is equipped with a GPS and it has had a good 3D fix, the most
60 recent good GPS fix is used.
62 - If the tracker is equipped with a GPS and it has lost its fix, the most
63 recent good GPS fix is used.
65 - If there is no good GPS fix since startup (either because there is no GPS
66 equipped or because the GPS has not yet got a fix), the most recently set HOME
67 location is used.
69 - If no HOME location has ever been set in the tracker, 0.0 Latitude, 0.0
70 Longitude, 0 Altitude are used (which is probably not very helpful)
72 How does AntennaTracker get GLOBAL_POSITION_INT messages from the tracked
73 vehicle?
75 mavproxy, when it runs the tracker module, intercepts all GLOBAL_POSITION_INT
76 messages received from its master vehicle, and sends them to the tracker. It
77 knows how to connect to the tracker with the set port and set baudrate
78 commands, for example to connect by a USB-Serial  radio, such as the 3DR Radio
79 on port /dev/ttyUSB0:
81 (after starting mavproxy)
82 module load tracker
83 tracker set port /dev/ttyUSB0
84 tracker set baudrate 57600
85 tracker start
87 Mounting
89 The AntennaTracker processor must be mounted on the moving (ie the rotating,
90 tilting) part of the antenna tracker hardware. Just how you do this will
91 depend on your exact hardware, but if the processor is mounted in anything
92 other than the default orientation (ie with the processor default 'forward'
93 direction pointing in the direction the antenna points, you will have to
94 configure AHRS_ORIENTATION in the AntennaTracker configuration to suit your
95 mechanical mounting arrangements.
97 In my case, I used a Flymaple with AHRS_ORIENTATION set to 1 (Yaw45). The
98 Flymaple was mounted on the antenna tracker with component side up and the
99 green pin headers horizontal and perpendicular to the antenna beam (See
100 pictures???).
102 Configuration
104 It is vitally important that your AntennaTracker be properly configured for the
105 mounting, servos and other hardware in your tracker. Unless you do this IT
106 WILL PROBABLY NOT WORK AS EXPECTED. CAUTION: It might even oscillate or flap
107 around. It might even damage itself.
109 AntennaTracker (like other ardupilot software such as ArduPlane, ArduRover
110 etc) has configuration values that control and tailor its operation, and which
111 are stored in EEPROM on the processor. The configuration is restored from
112 EEPROM every time the processor starts.
114 You can use MissionPlanner, mavproxy or apm_planner or other mavlink compatible
115 software to check and change the configuration of your AntennaTracker.
117 You will almost certainly have to change the following configuration items to
118 suit, and possibly others besides:
120 AHRS_ORIENTATION
121 RC1_MIN
122 RC1_MAX
123 RC1_REV
124 RC2_MIN
125 RC2_MAX
126 RC2_REV
127 PITCH2SRV_P
128 PITCH2SRV_I
129 PITCH2SRV_D
130 YAW2SRV_P
131 YAW2SRV_I
132 YAW2SRV_D
134 (more info here about how to find the right values when the setup commands are
135 available)
137 You can find the complete set of configuration items I used for my Flymaple
138 tracker mounted on an Eagle Tree tracker WHERE?????
140 Compass Calibration
142 AntennaTracker uses its internal magnetic compass to determine where North is
143 and therefore where to point for each bearing to the target vehicle. (On other
144 ardupilot vehicles, the yaw is also calibrated by the current GPS track. This
145 is not possible for AntennaTracker, so the compass is the only possible source
146 for absolute bearing)
148 The compass magnetometer is exquisitely sensitive to nearby magnetic fields from
149 wires, metal fittings, servos, radios etc. Therefore is it VITALLY ESSENTIAL that you
150 calibrate the compass. Further, it must be calibrated outdoors, while installed
151 in situ in the tracker, with all other equipment installed, fastened down and
152 ready to operate.
154 Failure to calibrate correctly will result in the tracker pointing in the
155 wrong direction, or the azimuth/yaw and elevation/pitch drifting.
157 Use Mission Planner to calibrate the tracker:
158 - Assemble the completed tracker, complete and ready to operate.
159 - Power up the tracker
160 - Connect to it with Mission Planner
161 - On Mission Planner->INITIAL SETUP->Compass, click on Live Calibration
162 - click on OK
163 - rotate the complete antenna tracker assembly around, in 3 dimensions, making sure to
164 rotate the tracker to every possible orientation in the 1 minute you have
165 available. DON'T just move the yaw and pitch motors around. You will probably have to
166 pick the whole thing up.
167 - At the end of the minute, Mission Planner will update AntennaTrackers compass offsets.
169 Leveling
171 Since AntennaTracker uses its internal accelerometers (amongst other things)
172 to determine the current elevation/pitch of the antenna, it is also important
173 to 'level' the AntennaTracker before use so the accelerometers are
174 calibrated. Failure to do this will result in the antenna constantly pointing
175 a bit high or a bit low compared to the tracked vehicle.
177 You can do this by connecting to the AntennaTracker with mavproxy and issuing
178 these commands:
180 disarm
181   - manually move the antenna so the antenna is level and pointing at 0 degrees elevation
182     i.e. at the horizon
183 level
184   - wait a minute without disturbing the antenna position
185 arm throttle
186   - this rearms the servos, allowing the antenna to move
188 Operation
190 <more here>
192 After powering up AntennaTracker, it may take up to 1 minute while it
193 automatically calibrates the compass before it points in the expected
194 direction. Moving the tracker around will speed up this process.
196 How to set the HOME location
198 If your AntennaTracker is not equipped with a GPS, you can still use it to
199 track vehicles. First you will have to tell AntennaTracker where it is on the
200 ground by setting its HOME position.
202 Connect to AntennaTracker with mavproxy
204 module load map
205  - the map will appear.
206  - Zoom and drag the map until you can see the location where
207    your AntennaTracker is located
208  - Click the mouse on the location of the antenna
209 wp sethome
211 AntennaTracker will now remember this as its HOME location whenever it is
212 started.
214 Simulating an antenna tracker
215 -----------------------------
217 To run a full antenna tracker simulation with a simulated APM:Plane as
218 the vehicle, cd to the ArduPlane directory and run this:
220   ../Tools/autotest/sim_arduplane.sh -T --aircraft test
222 The -T flag tells sim_arduplane.sh to start an antenna tracker
223 simulator and also start a virtual antenna tracker in a window.
225 To start the antenna tracker running run "tracker start" in the
226 mavproxy window.
228 To then connect to your antenna tracker with mavproxy you would run:
230   mavproxy.py --master tcp:127.0.0.1:5770
232 then you can configure it as needed.