MAVLink simple message receiver 接通了 再來要實裝 node topic
This commit is contained in:
@@ -205,6 +205,21 @@ def mavlink_btye_generator_test():
|
||||
custom_mode=0,
|
||||
system_status=mavutil.mavlink.MAV_STATE_ACTIVE
|
||||
)
|
||||
msg = mav.command_long_encode(
|
||||
target_system=1,
|
||||
target_component=1,
|
||||
command=mavutil.mavlink.MAV_CMD_DO_SET_MODE,
|
||||
confirmation=0,
|
||||
param1=0, # Custom mode
|
||||
param2=0, # Custom sub-mode
|
||||
param3=0,
|
||||
param4=0,
|
||||
param5=0,
|
||||
param6=0,
|
||||
param7=0
|
||||
)
|
||||
|
||||
|
||||
|
||||
# 取得 MAVLink 訊息的 bytes
|
||||
mavlink_bytes = msg.pack(mav)
|
||||
@@ -219,6 +234,19 @@ def mavlink_btye_generator_test():
|
||||
print(dir(mav2))
|
||||
# print(my_msg)
|
||||
|
||||
def simple_getMavlink():
|
||||
connection_string="udp:127.0.0.1:14550"
|
||||
# connection_string='/dev/ttyUSB0'
|
||||
connection = mavutil.mavlink_connection(connection_string)
|
||||
|
||||
while True:
|
||||
msg = connection.recv_msg()
|
||||
if msg:
|
||||
print(msg)
|
||||
else:
|
||||
print('No message yet, 0.1 second for data to fill')
|
||||
sleep(0.1)
|
||||
|
||||
|
||||
|
||||
print('Start')
|
||||
@@ -226,5 +254,6 @@ print('Start')
|
||||
# fdm_parser_example()
|
||||
# mavlink_analyzer_simple(8)
|
||||
# mavlink_btye_generator_test()
|
||||
simple_getMavlink()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user