Hi, I dont receive ATTITUDE message. There is a connection with a copter, I can arm it via script but thit piece of code constantly returns None:
msg = connection.connection.recv_match(type="ATTITUDE", blocking=False)
print(msg) // None
What I am doing wrong?
I have found similar question here but there is no SR*_RATE parameter in mission planner or I just cant find it
You need to request that message in order to receive it.
Which serial connection are you using for telemetry on the ArduPilot side?
If it is Telem2 the look for SR2_*_RATE parameters.
1 Like
I have changed a flight controller and this issue is back.
Even though I set SR2_EXTA1 = 50, I still dont receive ATTITUDE message. SHould I update any other params?
def get_current_rotation(self):
print("get current rotation")
msg = self.connection.recv_match(type="ATTITUDE", blocking=True)
print("current rotation received")
if msg:
roll = math.degrees(msg.roll)
pitch = math.degrees(msg.pitch)
yaw = math.degrees(msg.yaw)
return [roll, pitch, yaw]
else:
print("Failed to retrieve current rotation angle.")
return [0, 0, 10]
This is all
I have resolved it by requesting all types of messages. I know it is a bad solution and I dont recommend it to use, but I dont know how to request only one type of message:
self.connection.mav.request_data_stream_send(
self.connection.target_system, # Target system ID
self.connection.target_component, # Target component ID
_.MAV_DATA_STREAM_ALL, # Request all data streams
10, # Request at 10 Hz (you can adjust this frequency as needed)
1, # Start sending immediately
)