Hi,
We are developing a drone swarm. We are using:
- px4 beta
- mateksys h743-slm v3 dosn’t have compass
- mateksys GNSS & Compass, M10Q-5883 has a compass
We have a problem like this. After calibration, every time we start the drone, the direction of the drone appears wrong. In the tests we conducted, when we rotated the flight card, we observed that the direction indicator in QGround rotated, and when we rotated the GPS (it has a compass inside), there was no rotation. I am attaching some outputs below. We would be very happy if you could help.
We get magnetude value than convert it to degree with blow code:
import math
def calculate_heading(x, y):
heading = math.atan2(y, x) # Calculate the radian angle
heading_deg = math.degrees(heading) # Convert to degree
if heading_deg < 0:
heading_deg += 360 # set between 0 and 360
return heading_deg
x_mag = 0.15850
y_mag = 0.03083
heading_deg = calculate_heading(x_mag, y_mag)
print(f"Compass: {heading_deg} degrees")
drone looking north
x_mag = -0.09791
y_mag = 0.30475
Compass: 107.81115955708043 degrees
drone looking west
x_mag = 0.15850
y_mag = 0.03083
Compass: 11.007217497265838 degrees
drone looking south
x_mag = -0.10083
y_mag = -0.22766
Compass: 246.11157638549287 degrees