Not many people know but we have an piece of open source software for controlling an Antenna Tracker. It's been built by Tridge (Arduplane lead developer) for use in the outback challenge.
Sadly we have no documentation and, as far as I know, nobody except Tridge has used it. Still given Tridge's track record on building great software I suspect it works well and if it doesn't, I'm sure we can fix it. So to not let this piece of code go to waste, I'd like some help from people who are interested to give it a try and help me figure out how it works.
Here's the little that I know:
- It runs on any of our supported board (APM1, APM2, PX4, Pixhawk, Flymaple and perhaps VRBrain)
- For APM1/APM2 users building the code is as easy as opening our hacked ArduinoIDE and selecting File > SketchBook > Tools > AntennaTracker and then building in the normal way. For PX4/Pixhawk, our autobuilder doesn't automatically build a binary but I can provide one if people are interested.
- It can control a Pan and Tilt gimbal like this or this found on servocity.com.
- It may or may not require a GPS
- It must somehow receive vehicle position updates from the ground station which has the telemetry radio that is connected to the vehicle. Maybe through a USB cable. Tridge probably uses the python ground station, MAVProxy, to passthrough the vehicle position data to the AT but perhaps we can get MichaelO to build out a similar feature in Mission Planner.
- I imagine this antenna tracker could also be used to keep a camera focused on the vehicle which might be good for easing the burden on creating videos of our vehicles.
So if you want to give it a try please do and stick any findings, questions or issues below. Alternatively Issues can go into the issues list.
I'll start sticking things into the wiki as they become clear.
Replies
Hi Jakub,
If I understand you right only your first Item from the pull request is implemented in the AT0.7.1?
with 0.7.1 i´m also not able to get the AT running. Please can you provide me your version of AT for the Pixhawk?
I'm using 360° Servos.
Hi,
I'm out in the woods for the weekend with almost zero internet access and I won't be able to upload anything from here. You can either wait till monday (I will send you a .px4) or you can check out my fork at github and compile it yourself
Thanks Jakub!
See here for images of my antenna tracker. I have two GPS units tied to the Pixhawk with the NEO-M8N and it's compass mounted to the vertical support arm which rotates along the yaw/pan axis and is in alignment with the orientation of both the 915Mhz antenna and Pixhawk FC.
I will go and order the CR servo you mention and would ask of you to look at setting up the code to support the two types of antennas I will have on the tracker. I will keep the Tilt servo as is.
Thanks for all you great work and I look forward to testing and using my antenna tracker with your code.
You definately don't need CR servo for pitch. It will only go from -90 degrees (straight down) to +90 degrees (straight up). It will never "roll over" to the other side, so 180 degrees of rotation is more than enough. As for YAW servo - it is very comftable to have CR servo - the tracker will rotate constantly if you fly around it, it will never go around to the "other side" causing temporary breakups in radio transmission. On the negative side - if you have any cables they will eventually get tangled around (I use slip rings in my tracker so it is not an issue).
The basic firmware assumes that both servos are of the same type. I can easily prepare a firmware which supports 2 different servos - just let me know if you need it. I would strongly recommend modifying your yaw servo - it is as simple as disconnecting the potentiometer and replacing it with 2 resistors (you can also take the potentiometer out of the servo and leave it tuned to 50%).
One more thing - your magnetometer needs to be mounted on the antenna part - it cannot change it's orientation relative to Pixhawk during operation. You can either move it or disable it (use the one that is onboard Pixhawk)
@Jakub,
I have the PT785-S from servo city which states it is a closed loop system. The Pitch gear is a 7:1 and the Pan gear is a 3.8:1. I initially set my antenna tracker to be wireless in the hopes of using it for 360 pan coverage. Would I need to swap both servos out to get a continuous pan and pitch even though I know 360 pitch isn't needed? What recommendations would you make for my setup? I have pics in my profile section if you are interested in seeing how I set my system up.
I'm leaning on keeping what I have but would like to get it to cover 360 pan at a minimum but continuous works well for my video setup on the antenna.
Andre,
here is a .px4 with all changes that were submitted for a Pull request.
If your servos are CR type you need to set "servo_type" parameter to 2. If you are unsure - read though this: https://www.servocity.com/html/continuous_rotation_informatio.html#... and this: https://www.servocity.com/html/spg805a-cr_continuous_rotation.html
It is possible, that you have classic servos with increased range - in that case set servo_type to 0. You also need to set "brd_safetyenable" to 0, otherwise you may have issues (I didn't test it much on pixhawk).
Quick howto:
1. Disconnect your servos, upload firmware.
2. Set the following parameters:
a) AHRS_ORIENTATION - depends on your frame
b) SERVO_TYPE = 2 (for CR servos) or 0 for classic servos
c) DISTANCE_MIN doesn't do anything with CR servos so you don't need to worry about it with CR servos (there is a good explanation why I disabled it)
d) PITCH_RANGE defines maximum allowed deflection from 0 degrees in pitch. In your case the frame cannot rotate freely in pitch (it can hit metal bar) and this should prevent that as long as your tracker is placed vertically (as it should be in normal operation). I usually set it to 70 to avoid gimbal-lock situation and I believe that 70 is a good value for you, so set PITCH_RANGE = 70
e) STARTUP_DELAY = 5 is very important - in CR servo configuration AHRS drift during startup has a huge effect and can lead to erratic behavior during startup, including breaking the tracker (you have a mechanical limitation). I will explain that later.
f) BRD_SAFETYENABLE = 0
g) PID values that I came up with are not optimal, but work for me and could be a good starting point:
PITCH2SRV_P = 0,5
PITCH2SRV_I = 0,05
PITCH2SRV_D = 0
PITCH2SRV_IMAX = 4000
YAW2SRV_P = 1,5
YAW2SRV_I = 1
YAW2SRV_D = 0
YAW2SRV_IMAX = 4000
Also, with RC1_MIN/MAX and RC2_MIN/MAX you can limit the speed and torque. In my case I set it like this:
RC1_MIN = 1100
RC1_MAX = 1900
RC1_TRIM = 1500
RC2_MIN = 1100
RC2_MAX = 1900
RC2_TRIM = 1500
3. Perform the necessary calibrations (Accelerometer, compass)
4. Make sure, that AHRS angles reported by HUD are correct ("front" of the AHRS is aligned with front of the tracker)
5. Disable power, level the tracker (place pitch at 0 degrees - antenna looking forward)
6. Plug in servos and apply power but be prepared to disconnect it quicly - pitch servo should move the tracker up (point it at 45 degrees into the sky). If instead of moving up it tries to move down disconnect the power quickly (before it hits mechanical limits...), disconnect servos and change RC1_REV parameter from 0 to 1 (or the other way around). This is the most difficult part of the setup, since it needs a quick reaction :)
The way this firmware works is as follows:
1. After power-on the tracker will go into INITIALIZING mode, which tries to point the PITCH axis to +45 degrees. After +45 degrees is reached, it will wait for STARTUP_DELAY (5 seconds) and then start moving YAW axis. This is required, because AHRS tends to drift a lot after power-on (filters need to collect enough data etc) and 5 seconds of delay are usually enough to prevent any erratic movements.
2. After PITCH locks at +45 degrees (it may drift slightly at the begining) and STARTUP_DELAY time passes it will start moving YAW. Again, it may drift a little. If YAW is rotating constantly it means, that you need to change RC2_REV.
3. After completing INITIALIZATION the tracker will automatically switch to AUTO mode. In this mode it will wait for MAVLink from air vehicle. Until such datastream arrives, the tracker will keep +45 degrees in PITCH and some angle in YAW. You can use it to tune PID settings by moving the tracker around
4. When the tracker looses MAVLink from air vehicle it will keep last known position of the target and point that way (plus some estimation based on speed and heading).
You can manually switch modes from STOP (servos should be disabled) throught AUTO and SCAN up to SERVO_TEST. In servo_test the sliders in Mission Planner are converted into angular information and it is a good way to tune PID's - simply move the sliders and observe reactions.
If you have any questions or issues just let me know. As for compiling the software - it is fairly easy now that I have it up and running. If you need asistance with that let me know.
AntennaTracker-v2.px4
this will be my next goal to be able to compile:-). But at the moment I´ll wait until monday for your .px4 - Thanks!
Thanks for your reply, Jakub. I will setup the tracker from scratch again today. Perhaps I did something wrong upgrading from 0.5.
In MP I can only find 0.4.
I am glad to hear that the tracker firmware should work. The strange thing is, pitch does not even move in scan mode. I can see PWM value changes of +/- 5us max for RC2, but thats not enough to move the pitch servo. If I increase the min/max PWM values for pitch, the output for scan mode is still +/- 5us max.
I will try to get it to work, but it would be really nice, if you could send me the 0.5 firmware and your customized version perhaps?
If you are having problems with the servos not moving, check the appropriate slew rate parameter. This threw me off for a while. I have some modified v0.5 firmware if you want it (added guided mode).
Could not get 0.71 to work, so I flashed 0.4 from MP. Pitch is working again. Also the tuning window in MP shows all four graphs. With 0.71 nav_pitch and nav_roll were missing.