Hi everyone,
I am trying to use pymavlink to control the yaw angle and depth of the bluerov with a desired value.
However, after reading the document of pymavlink, I designed the pid controllers to achieve the depth control and yaw control individually (It can achieve either depth control or yaw control).
When I am trying to achieve both the yaw control and the depth control , here comes a problem that the instant depth value and yaw value can not be obtained together.
The function I designed for the yaw_read and depth read are as follows.
I found out that sometimes either the yaw value or the depth value will be 1000, if the depth value a normal value, then the yaw value will be 1000, and vice versa, which indicates can the depth value and the yaw value cannot be obtained simultaneously.
Does anyone got any ideas how to deal with this situation? Is it related to the thread?
Thank you in advance!
def yaw_read():
msg = master.recv_match()
yaw_direction = 1000
if msg:
if msg.get_type() == 'ATTITUDE':
yaw_direction = msg.yaw
# print('d=', dep)
return yaw_direction`
def depth_read():
msg = master.recv_match()
dep = 1000
if msg:
if msg.get_type() == 'VFR_HUD':
dep = msg.alt
# print('depth_function=', dep)
return dep