5. Gimbal Control System (Software)
5.1 Scope of Project
The gimbal control system forms the software backbone of the satellite ground station, enabling automated and precise tracking of satellites in real time.
It integrates Two-Line Element (TLE) from orbital data, GPS positional feedback to communicate with the gimbal motor controller to continuously align the satellite dish with the target satellite’s position throughout its visible pass window.
The software framework was designed to be modular and scalable, ensuring ease of maintenance and adaptability for future improvements. Each module handles a specific process, such as orbital prediction, GPS integration, or real-time motion control.
This chapter details the system’s current implementation, its operational workflow, and ongoing challenges in achieving sub-degree accuracy and motion smoothness.
5.1.1 Problem Statement
Commercial ground-station systems do not support our required downlink frequency of 13.95 GHz, making them unsuitable for the specific communication needs of this project.
There is also little to no open-sourced system available on the market that could integrate TLE-based orbital prediction, GPS feedback, and motion control into one ground station that met all of our requirements.
Another significant challenge was that the Galil motor controller lacked any available reference code or public documentation.
This required the development of a custom interface library in Python through trial and error to establish stable communication and command execution.
The project therefore required us to build a fully custom gimbal control software, capable of real-time satellite tracking with live GPS and TLE data integration, while being cost-effective and ensuring a robust system to fulfill all of the specification requirements.
5.1.2 Objective
The objective of the gimbal control system software is to achieve real-time, autonomous satellite tracking with smooth and stable motion, guided by accurate positional and heading feedback.
The system integrates:
-
Satellite orbital data from TLE files
-
GPS-based ground-station coordinates and heading
-
Motor control of the gimbal to move the satellite dish
By combining these data sources, the software maintains continuous satellite alignment during passes.
Although the current system achieves high reliability, further improvement is required to reach the targeted GPS heading accuracy of < 0.2°.
5.1.3 Current Progress
At the current stage, the software has achieved full integration across all functional modules:
-
TLE parsing and prediction using Skyfield
-
GPS positional feedback through the dual-antenna receiver
-
Smooth gimbal motion via PCHIP Hermite interpolation
-
Real-time tracking with continuous motor updates
The gimbal successfully follows satellite trajectories and responds dynamically to position updates.
However, measured GPS heading accuracy remains above 0.2°, affecting overall pointing precision.
In addition, motion smoothness can be improved by optimizing interpolation step resolution and timing intervals.
5.2 Design Requirements
| Parameter | Requirement | Description |
|---|---|---|
| Heading Accuracy | < 0.2° (Target) | Current performance does not yet achieve this level; improvement ongoing. |
| Position Accuracy | ± 2.5 m | Based on GPS module capability. |
| Update Rate | ≥ 10 Hz | Ensures smooth and responsive control. |
| Interpolation | PCHIP Hermite | Monotonic cubic interpolation without overshoot. |
| Communication Interface | Serial / TCP (Galil gclib) | For command exchange with the motor controller. |
| Software Modularity | High | Independent modules for GPS, TLE, scheduling, and motion. |
5.3 System Architecture
The gimbal software is composed of seven Python modules, each handling a specific subsystem.
| No. | Module | Function / Description |
|---|---|---|
| 1 | gclib.py | Low-level hardware driver that communicates with the Galil controller through official API functions. |
| 2 | gimbal_lib.py | Imports gclib.py and implements high-level motion functions, angle limits, safety controls, and PT mode for continuous updates. |
| 3 | TLE_Set_Builder.py | Downloads and compiles Two-Line Element (TLE) data from CelesTrak. |
| 4 | TLE_Parser_Test.py | Parses TLE data and computes azimuth/elevation relative to the ground station. Generates .pass files for scheduling. |
| 5 | pass_scheduler.py | Identifies the next visible satellite pass based on current time. |
| 6 | gps_reader.py | Reads GPS coordinates and heading data, providing live positional feedback. |
| 7 | live_with_gps.py | Main execution script that integrates all modules for real-time satellite tracking. |
5.4 Detailed Software Design
5.4.1 gclib.py: Galil Motor Controller Interface
Acts as the foundation for motion control, defining communication between Python and the Galil hardware library.
Implements command execution, connection handling, and motion-completion feedback.
5.4.2 gimbal_lib.py: High-Level Motion Control
Imports gclib.py and adds advanced control features such as:
-
Limit enforcement to prevent crashes
-
Smooth acceleration/deceleration with calculated steps
-
degSteer()for continuous steering under Position Tracking mode
This ensures easy, stable and precise motion during live satellite passes.
5.4.3 TLE_Set_Builder.py: Orbital Data Retrieval
Fetches up-to-date TLE data daily from CelesTrak and stores them locally for the parser and scheduler.
5.4.4 TLE_Parser_Test.py:Orbital Data Processing
Processes TLE data using Skyfield to calculate azimuth and elevation, implements flip logic near ± 90°, and generates .pass files.
5.4.5 pass_scheduler.py: Pass Scheduling
Reads .pass files, determines the next visible satellite pass, and provides both UTC and local times for tracking operations.
5.4.6 gps_reader.py: GPS Data Acquisition
Reads live data from the GPS module, extracting latitude, longitude, altitude, and heading.
Currently, heading accuracy exceeds 0.2°, requiring further refinement.
5.4.7 live_with_gps.py: Integration of all components above to track target satellite live
Integrates TLE and GPS inputs, computes real-time AZ/EL, and uses PCHIP interpolation for smooth motion.
Streams continuous position updates to the gimbal controller.
5.5 Interpolation in Gimbal Motion Control
5.5.1 Purpose of Interpolation
In the gimbal tracking system, the controller receives discrete position updates at fixed time intervals from orbital data.
Interpolation is required to estimate intermediate pointing angles between consecutive data points.
Without interpolation, the gimbal would move in abrupt steps, producing jerky motion, higher mechanical wear, and degraded stability.
Interpolation ensures that motor commands are smooth, continuous, and dynamically feasible.
5.5.2 Linear Interpolation
Connects consecutive data points with straight lines-simple and efficient but assumes constant angular velocity, causing sudden acceleration changes and vibration.
Adequate only for coarse control, not for precision tracking.
5.5.3 Quadratic Interpolation
Quadratic Interpolation uses second-order polynomials, introducing curvature for smoother velocity transitions. However, this method lacks acceleration continuity and is prone to overshoot which may lead to physical crashes and hitting limits set.
5.5.4 PCHIP (Piecewise Cubic Hermite Interpolating Polynomial)
PCHIP fits a monotonic cubic polynomial between data points, preserving both value and slope continuity.
Unlike natural cubic splines, it enforces monotonicity through the Fritsch–Carlson slope limiter to prevent overshoot.
Key advantages:
-
Smooth (C¹ continuous) position and velocity transitions
-
No overshooting even with irregular spacing
-
Real-time numerical stability for control use
5.5.5 Justification for Choosing PCHIP
Initially, we started off with linear interpolation, the movement of the gimbal was very choppy and steps were very large. Defence Science Organisation (DSO) also had the issue of movement being very choppy. Afterwards, we upgraded to quadratic interpolation, however, we kept exceeding the mechanical and soft limits in the code and we kept experiencing crashes. After consulting experts and doing further research, we learned about PCHIP interpolation and implemented it for testing. This worked flawlessly.
The gimbal requires smooth, non-oscillatory motion with predictable velocity control.
PCHIP provides the best balance of computational simplicity, smoothness, and stability compared with linear or quadratic interpolation, making it ideal for real-time gimbal motion.
5.5.6 Implementation in Code
Implemented in live_with_gps.py via pchip_slopes() and hermite_eval() (Annex B.A.7, L94-127).
These compute cubic Hermite slopes and evaluate interpolated angles between consecutive TLE-derived positions.
Interpolated azimuth/elevation values are then streamed to the controller through degSteer() in gimbal_lib.py.
5.6 Current Challenges
| Challenge | Description | Key Impact |
|---|---|---|
| GPS Heading Accuracy | Heading error has not yet achieved the < 0.2° target. | Affects stability & orientation precision. |
| PCHIP Interpolation | Requires optimization of step timing & resolution. | Impacts motion smoothness. |
| Spoilt Ethernet Port | Physical Ethernet port on controller is damaged. | Causes unstable connection to the gimbal. |
| Cable Management | Motor-cable routing needs improvement. | Risk of entanglement during multi-axis motion. |
5.7 Future Work
5.6.1 Software Improvements
-
Refine interpolation step size and timing.
-
Implement predictive motion algorithms for fast passes.
-
Integrate feedback-based GPS-heading error correction.
5.7.2 Hardware Integration
-
Hardware Integration: Achieve end-to-end connectivity across ground-station components (dish, feedhorn, LNB, GPS).
-
Receiver Hardware Development: Identify and validate the optimal receive chain for satellite downlink.
-
Space Segment Radio Payload Integration: Perform thermal and mechanical compatibility testing of the radio payload with the satellite bus.
5.8 Key Implementation Lines (for Cross-Reference)
Purpose. This subsection identifies the specific lines of code that implement each critical function used by the gimbal control software. Full source is provided in Appendix F to K with line numbers; references use (Appendix F, Lstart–Lend).
A. gclib.py - Galil Motor Controller Interface
-
Open/Close controller:
GOpen,GClose→ (Appendix F, L151–158; L161–168) -
Send commands:
GCommand→ (L171–180) -
Query info:
GInfo→ (L235–240) -
Assignments:
GAssign→ (L263–271) -
Transfers:
GProgramDownload,GArrayDownload→ (Appendix F,L293–302; L334–346) -
Wait for motion:
GMotionComplete→ (L435–442) -
Error handling:
_rc+GclibError→ (L116–121)
B. gimbal_lib.py - High-Level Motion Control (imports gclib.py)
-
PT mode:
_enter_pt,_exit_pt→ (Appendix G,L163–172; L174–181) -
Wait/settle:
_wait_inpos,_wait_settle_counts→ (Appendix G,L263–293) -
Motions:
move_absolute,move_relative→ (Appendix G,L355–406) -
Real-time steer:
degSteer→ (Appendix G,L408–456) -
Limits/scaling: constants → (Appendix G,L29–43)
C. live_with_gps.py - Real-Time Tracking Loop
-
PCHIP math:
pchip_slopes,hermite_eval→ (Appendix H,L94–127) -
Flip thresholds:
FLIP_ON_DEG,FLIP_OFF_DEG→ (Appendix H,L56–57) -
Flip logic:
decide_flip_with_hysteresis,map_to_gimbal_frame_with_state→ (Appendix H,L129–156) -
Main execution:
main→ (Appendix H,L161–255) -
Command stream:
gimbal.degSteer(...)→ (Appendix H,L245)
D. pass_scheduler.py - Next-Pass Selection
-
Datetime conversion:
_ensure_utc_datetime,convert_datetime→ (Appendix I,L49–109) -
Future pass selection:
select_pass→ (Appendix I,L132–167) -
Machine output:
NEXT_PASS,...→ (Appendix I,L205; L254)
E. TLE_Parser_Test.py - Pose Preview & .pass Generation
-
Pass list:
generate_pass_list→ (Appendix K,L52–89) -
Main function:
main→ (Appendix K,L117–154)
F. TLE_Set_Builder.py - Daily TLE Fetch
- CelesTrak source & writeout:
TLE_URL,requests.get(...), save file → (Appendix J, L12; L23; L27–35)
4.8 Annex Reference
The complete Python source code listings for the gimbal control system are also provided in Folder – Gimbal Control Software Listings, including inline documentation and comments for: Gimbal Control Software Folder -
-
gclib.py -
gimbal_lib.py -
TLE_Set_Builder.py -
TLE_Parser_Test.py -
pass_scheduler.py -
gps_reader.py -
live_with_gps.py
Each listing includes explanations of function usage and software flow to support reproducibility and future system development.
4.9 GPS & Live Testing Results
GPS Module: AS-STARTKIT-HEAD-L1L2-NH-00
gps_reader.py [output]
Our gps_reader.py script works by continuously reading the GNSS data streamed from the u-blox AS-STARTKIT-HEAD-L1L2 module through the USB serial interface. The module outputs precision UBX messages containing its computed GPS location, which includes latitude, longitude, altitude, and heading. The script uses a UBX decoder to interpret these binary messages and extract the numerical fields, such as position coordinates and accuracy values. Once decoded, the data is converted into human-readable engineering units and printed as shown in the output. Because the module uses dual-frequency GNSS and dual-antenna heading computation, it is able to determine our exact location and orientation with high accuracy, which is reflected in the final GPS FIX results.
Live_with_gps.py [output]
This is a live demo of the script live_with_gps.py being executed. The ground station automatically reads the current GPS coordinates and heading of the system, computes the real-time position of TELEOS-2 using its latest retrieved TLE data, and continuously updates the required Azimuth and Elevation angles.
The gimbal then rotates smoothly towards the target satellite’s calculated current position, moving every second to track TELEOS-2 as it travels across the horizon. As shown in the video, the gimbal tracks to face TELEOS-2 accurately and stays locked onto its trajectory throughout the pass, demonstrating that both our tracking algorithm and hardware control system are functioning correctly in real time.