Skip to content

Commit 88ec2d5

Browse files
authored
Merge pull request #142 from sudhanshuprasad/main
taking off
2 parents 158ea5b + 46c7e58 commit 88ec2d5

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pymavlink import mavutil
2+
3+
the_connection=mavutil.mavlink_connection('udpin:localhost:14551')
4+
5+
the_connection.wait_heartbeat()
6+
print("Heartbeat from system (system %u component %u)" %
7+
(the_connection.target_system, the_connection.target_component))
8+
9+
10+
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_NAV_LAND, 0, 0, 0, 0, 0, 0, 0, 0)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from pymavlink import mavutil
2+
3+
the_connection=mavutil.mavlink_connection('udpin:localhost:14551')
4+
5+
the_connection.wait_heartbeat()
6+
print("Heartbeat from system (system %u component %u)" %
7+
(the_connection.target_system, the_connection.target_component))
8+
9+
# while True:
10+
# message=the_connection.recv_match(blocking=True)
11+
# print(message)
12+
13+
def takeoff(height):
14+
15+
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1, 0, 0, 0, 0, 0, 0)
16+
17+
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, height)
18+
19+
print("height: ", height)
20+
21+
if __name__ == "__main__":
22+
takeoff(20)
23+
24+
msg = the_connection.recv_match(type='COMMAND_ACK', blocking=True)
25+
print(msg)

0 commit comments

Comments
 (0)