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 Randy,
I'm very interested in this thread (since I really need reliable AT). Today I downloaded code from GIT (master) and tried to compile it in Arduino 1.0.3 for my old APM 1.4 with Oil Pan Shield. HAL Board set to "ArduPilot Mega 1" and Board is "Arduino Mega 2560". Compilation process faild with error - see next listing. Can You please point me what I have wrong set in Arduino?
Building for ArduPilot Mega 1
Excluding arduino core from include paths
C:\APM\ArduPilot-Arduino-1.0.3\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega2560 -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=103 -mcall-prologues -DCONFIG_HAL_BOARD=HAL_BOARD_APM1 -DEXCLUDECORE -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Common -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Progmem -IC:\APM\ArduCopter-V3.2.1\libraries\AP_HAL -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Param -IC:\APM\ArduCopter-V3.2.1\libraries\StorageManager -IC:\APM\ArduCopter-V3.2.1\libraries\AP_GPS -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Baro -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Compass -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Math -IC:\APM\ArduCopter-V3.2.1\libraries\AP_ADC -IC:\APM\ArduCopter-V3.2.1\libraries\AP_ADC_AnalogSource -IC:\APM\ArduCopter-V3.2.1\libraries\AP_InertialSensor -IC:\APM\ArduCopter-V3.2.1\libraries\AP_AHRS -IC:\APM\ArduCopter-V3.2.1\libraries\Filter -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Buffer -IC:\APM\ArduCopter-V3.2.1\libraries\AP_HAL_AVR -IC:\APM\ArduCopter-V3.2.1\libraries\GCS_MAVLink -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Declination -IC:\APM\ArduCopter-V3.2.1\libraries\DataFlash -IC:\APM\ArduCopter-V3.2.1\libraries\SITL -IC:\APM\ArduCopter-V3.2.1\libraries\PID -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Scheduler -IC:\APM\ArduCopter-V3.2.1\libraries\AP_NavEKF -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Vehicle -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Mission -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Terrain -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Rally -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Notify -IC:\APM\ArduCopter-V3.2.1\libraries\AP_BattMonitor -IC:\APM\ArduCopter-V3.2.1\libraries\AP_Airspeed -IC:\APM\ArduCopter-V3.2.1\libraries\RC_Channel -IC:\APM\ArduCopter-V3.2.1\libraries\AP_BoardConfig -IC:\APM\ArduCopter-V3.2.1\libraries\AP_HAL_AVR_SITL -IC:\APM\ArduCopter-V3.2.1\libraries\AP_HAL_PX4 -IC:\APM\ArduCopter-V3.2.1\libraries\AP_HAL_FLYMAPLE -IC:\APM\ArduCopter-V3.2.1\libraries\AP_HAL_Linux -IC:\APM\ArduCopter-V3.2.1\libraries\AP_HAL_Empty C:\Users\lospalos\AppData\Local\Temp\build4910662348085036024.tmp\AntennaTracker.cpp -o C:\Users\lospalos\AppData\Local\Temp\build4910662348085036024.tmp\AntennaTracker.cpp.o
AntennaTracker.pde:174:41: error: no matching function for call to 'AP_InertialSensor_Oilpan::AP_InertialSensor_Oilpan(AP_ADC_ADS7844*)'
AntennaTracker.pde:174:41: note: candidates are:
In file included from C:\APM\ArduCopter-V3.2.1\libraries\AP_InertialSensor/AP_InertialSensor.h:296:0,
from AntennaTracker.pde:42:
C:\APM\ArduCopter-V3.2.1\libraries\AP_InertialSensor/AP_InertialSensor_Oilpan.h:12:5: note: AP_InertialSensor_Oilpan::AP_InertialSensor_Oilpan(AP_InertialSensor&)
C:\APM\ArduCopter-V3.2.1\libraries\AP_InertialSensor/AP_InertialSensor_Oilpan.h:12:5: note: no known conversion for argument 1 from 'AP_ADC_ADS7844*' to 'AP_InertialSensor&'
C:\APM\ArduCopter-V3.2.1\libraries\AP_InertialSensor/AP_InertialSensor_Oilpan.h:9:7: note: AP_InertialSensor_Oilpan::AP_InertialSensor_Oilpan(const AP_InertialSensor_Oilpan&)
C:\APM\ArduCopter-V3.2.1\libraries\AP_InertialSensor/AP_InertialSensor_Oilpan.h:9:7: note: no known conversion for argument 1 from 'AP_ADC_ADS7844*' to 'const AP_InertialSensor_Oilpan&'
AntennaTracker.pde:189:37: error: no matching function for call to 'AP_AHRS_DCM::AP_AHRS_DCM(AP_InertialSensor_Oilpan&, AP_Baro_BMP085&, AP_GPS&)'
AntennaTracker.pde:189:37: note: candidates are:
In file included from C:\APM\ArduCopter-V3.2.1\libraries\AP_AHRS/AP_AHRS.h:421:0,
from AntennaTracker.pde:43:
C:\APM\ArduCopter-V3.2.1\libraries\AP_AHRS/AP_AHRS_DCM.h:28:5: note: AP_AHRS_DCM::AP_AHRS_DCM(AP_InertialSensor&, AP_Baro&, AP_GPS&)
C:\APM\ArduCopter-V3.2.1\libraries\AP_AHRS/AP_AHRS_DCM.h:28:5: note: no known conversion for argument 1 from 'AP_InertialSensor_Oilpan' to 'AP_InertialSensor&'
C:\APM\ArduCopter-V3.2.1\libraries\AP_AHRS/AP_AHRS_DCM.h:24:7: note: AP_AHRS_DCM::AP_AHRS_DCM(const AP_AHRS_DCM&)
C:\APM\ArduCopter-V3.2.1\libraries\AP_AHRS/AP_AHRS_DCM.h:24:7: note: candidate expects 1 argument, 3 provided
AntennaTracker.pde: In function 'void loop()':
AntennaTracker.pde:278:14: error: 'class AP_InertialSensor_Oilpan' has no member named 'wait_for_sample'
GCS_Mavlink.pde: In member function 'bool GCS_MAVLINK::try_send_message(ap_message)':
GCS_Mavlink.pde:203:59: error: no matching function for call to 'GCS_MAVLINK::send_raw_imu(AP_InertialSensor_Oilpan&, AP_Compass_HMC5843&)'
GCS_Mavlink.pde:203:59: note: candidate is:
In file included from AntennaTracker.pde:73:0:
C:\APM\ArduCopter-V3.2.1\libraries\GCS_MAVLink/GCS.h:196:10: note: void GCS_MAVLINK::send_raw_imu(const AP_InertialSensor&, const Compass&)
C:\APM\ArduCopter-V3.2.1\libraries\GCS_MAVLink/GCS.h:196:10: note: no known conversion for argument 1 from 'AP_InertialSensor_Oilpan' to 'const AP_InertialSensor&'
GCS_Mavlink.pde:213:77: error: no matching function for call to 'GCS_MAVLINK::send_sensor_offsets(AP_InertialSensor_Oilpan&, AP_Compass_HMC5843&, AP_Baro_BMP085&)'
GCS_Mavlink.pde:213:77: note: candidate is:
In file included from AntennaTracker.pde:73:0:
C:\APM\ArduCopter-V3.2.1\libraries\GCS_MAVLink/GCS.h:198:10: note: void GCS_MAVLINK::send_sensor_offsets(const AP_InertialSensor&, const Compass&, AP_Baro&)
C:\APM\ArduCopter-V3.2.1\libraries\GCS_MAVLink/GCS.h:198:10: note: no known conversion for argument 1 from 'AP_InertialSensor_Oilpan' to 'const AP_InertialSensor&'
GCS_Mavlink.pde:170:12: warning: enumeration value 'MSG_TERRAIN' not handled in switch [-Wswitch]
GCS_Mavlink.pde:170:12: warning: enumeration value 'MSG_BATTERY2' not handled in switch [-Wswitch]
GCS_Mavlink.pde: In member function 'void GCS_MAVLINK::handleMessage(mavlink_message_t*)':
GCS_Mavlink.pde:620:28: error: 'class AP_InertialSensor_Oilpan' has no member named 'calibrate_accel'
system.pde: In function 'void init_tracker()':
system.pde:68:9: error: 'class AP_InertialSensor_Oilpan' has no member named 'init'
system.pde: In function 'void calibrate_ins()':
system.pde:117:9: error: 'class AP_InertialSensor_Oilpan' has no member named 'init'
system.pde:118:9: error: 'class AP_InertialSensor_Oilpan' has no member named 'init_accel'
Hi Palo,
I'm not really sure what's going wrong with your compile there. It looks like maybe the libraries directory is out of date but I don't know how that could happen. I've just done a test compile using our hacked arduino 1.0.3 compiler and it seems to have compiled ok.
Hello,
I am struggling with antenna tracker since friday. I spent a whole friday and weekend building tracker frame (actually converting old 3 axis gimbal into 2 axis tracker - removed the lowest "stage" of gimbal and put it upsidedown) and configuring it.
My tracker is built using modified servos with gears - I removed the potentiometer from the servo and replaced it with a resistor. The mechanical turn limiter was also removed. These servos work just as they are supposed to work in gimbals with controller mounted on the moving part - the further you go from 1500us the faster the servo rotates. Rotation direction depends on the range: 1000-1500 us is CCW and 1500-2000 us is CW (CW/CCW depends on a specific servo, I'm writing this just to explain my problem, it is not relevant at this point, plus I have a reduction gearbox which reverses the direction anyway). To sum it up - the servo is still at around 1500us (that value drifts with temperautre unfortunately but usually is between 1450 and 1550) and rotates with the speed more or less proportional to the signal.
I am using APM 2.5 in antenna tracker, Pixhawk in my Copter. As a datalink I am using IP datalink with mavproxy - on Pixhawk's end I have an Odroid U3 talking to the Pixhawk via FT232 converter, on the tracker I have a RaspberryPI with another FT232 converter connected to APM's UART2 (switched over from UART0 as mentioned in the Wiki). I have another problem with connecting 2 devices to 1 mission planner but it is not relevant now, the APM is getting the mavlink stream from pixhawk properly. I also have slip-rings on each axis which make my tracker free to rotate as much as it needs to in each axis (there is no mechanical limitation)
I have 2 major problems currently, one is related directly to antenna tracker and it's movements, other is related to mavproxy but it is less relevant at this point, I can work around it for now. I also have a list of changes that should be implemented to make this more usable, I wrote them at the end of this comment.
Problem #1:
I believe that there is a problem (or maybe I am misusing it and there are servos that are supposed to work this way) with on/off servo mode in antenna tracker firmware. It seems to operate the servos with only 3 states: minumum, center (trim) and maximum. As a result my tracker is oscilating rapidly on each axis overshooting the desired angle. Changing PID settings has no effect, I went as low as 0,0001 on P and it still does the same. It may have something to do with ONOFF_YAW_MINT parameters but regardless of the settings it still oscillates and is unusable. During the oscillation it actually tries to point in the proper direction and when I move my copter it tries to follow (poorly, because of very high overshoot). My question is: did somebody set it up successfully with velocity-servos (input signal controls velocity rather than angle)?
Changes/Improvements for the future:
1. Parameters not updating "on the fly" - whenever I change a parameter (servo min/max, PID etc) i need to make a reboot in order for these parameters to be operational. Probably the antenna tracker firmware reads parameters during boot process and never looks at them afterwards.
2. Beforementioned (and somehow solved) switches and sliders in MP (not as critical but useful)
3. The tracker is not operational without valid mavlink signal - when there is no signal it either rotates in one direction continously (this is not scanning mode, just constant movement with random speed and direction) or makes some unexpected movements ignoring angle limits (this problem may be related to my first issue so it needs to be verified).
4. Ability to set a direction/point at which the tracker points when there is no mavlink since boot - I would like to test my tracker by clicking "point tracker here" on a map (I think there were such an option with old-style tracker?) rather than running around with my copter
5. Displaying current target on the map or at least heading and elevation to it
6. Fixing red heading line on the map - the red line is constantly showing north regardless of the tracker's heading (mentioned on the forum before)
Sorry for such long reading but I tried to explain my problem as good as I could.
Hi Jakob,
You've modified your servos to "continues rotation" so the parameter "on/off servo" is correct.
I've also seen this kind of oscillation of my axis. In my case it's an issue of servo trim. I have to recalibrate the servos (little poti instead of your resistor) quite often to stop at 1500us. Otherwise the servo would overshoot the desire position and oscillates back. I believe it's also an issue of temperature...
I thought of replacing the potentiometer with fixed resistors to overcome this problem. Too sad to read, that might won't solve my problem. Maybe with more accurate and temperature stable resistors??
I'm thinking about a auto-calibation routine in the code at system startup:
-> If theres a movement detected although there shouldn't be any rise the "dead center" value. If it still moves and gets faster lower the value.
But that would be just an work around... I think the issue has to be fixed on hardware side.
Thank you for your reply.
I decided not to give up on my continuous rotation servos and modified the firmware a little bit - It works very good, although the code is very poor. I just modified the on/off functions for the servos and it should be done as a separate mode (additional servo mode). I also got rid of another problem - after power-on the tracker tries to reach 0 degrees on pitch and 90 degrees on yaw until it gets a valid location, rather than rotating unexpectedly on each axis. It may not be an issue with traditional servos, but it is for me and now it's fixed. I will tidy-up the code, maybe add another servo mode and push it into the world if someone is interested. For now I can only provide a precompiled version just as described because I don't want to scare anyone with my programming :)
Hi Jakub,
Did you fix your "oscillation issue" too?? Would be interested on what you've changed... so please scare me and show me your coude :-) Cause I've also some changes (Servo Test Buttons) in my code to merge.
Christian,
I basically changed channel_xxxx.servo_out from +-9000 to what outputs from PID controller and multiplied it by 100 since I couldn't figure out the PID output range. I then played with PID settings. If you set "D" to 0, P and I to 0,1 it will move good enough to tell if you need to reverse the servos or not. If you want I could work with you to integrate both features and maybe add new ones. The first thing to do would be adding a third servo mode (other than on/off and position) and place the code there. I tested my tracker yesterday flying my copter in urban areas and it worked perfectly.
Hi Jakub,
Finaly got some time to have a look at v0.5 and it would be nice to impelment your "continues rotation servo" routine there. I've forked arupilot https://github.com/SCUBA82/ardupilot.
We could work there if you want to. Adding a third servo mode shouldn't be a real challenge
I like the idea. I even forked it myself into my own github and I added some changes, but I am not familiar with GIT since I always worked with Subversion and I need some time to get used to it. I forked it to https://github.com/rcairman/ardupilot
I am a little short on time but I should be able to do some work next week. How do you suggest we proceed?
Just a noob question:
Is there a possibility with this AT-sw to have installed two different servos -one for pan/yaw with continuous rotating and second for tilting with standard servo behaviour (moves only in range 0-90 degree)?
I'm asking because in MissionPlanner servotype setting is only one combobox. It means to me it is global setting for both servos, isn't it?
Then both servos must be the same operation type?