From 322024fca4708fc61d3f597f7ce54786b52fe187 Mon Sep 17 00:00:00 2001 From: Sudhanshu Prasad Date: Thu, 27 Oct 2022 11:57:01 +0530 Subject: [PATCH 1/4] Add files via upload --- .../controlling drone using python/takeoff.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Python Projects/controlling drone using python/takeoff.py diff --git a/Python Projects/controlling drone using python/takeoff.py b/Python Projects/controlling drone using python/takeoff.py new file mode 100644 index 00000000..301214c6 --- /dev/null +++ b/Python Projects/controlling drone using python/takeoff.py @@ -0,0 +1,25 @@ +from pymavlink import mavutil + +the_connection=mavutil.mavlink_connection('udpin:localhost:14551') + +the_connection.wait_heartbeat() +print("Heartbeat from system (system %u component %u)" % + (the_connection.target_system, the_connection.target_component)) + +# while True: +# message=the_connection.recv_match(blocking=True) +# print(message) + +def takeoff(height): + + 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) + + 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) + + print("height: ", height) + +if __name__ == "__main__": + takeoff(20) + +msg = the_connection.recv_match(type='COMMAND_ACK', blocking=True) +print(msg) \ No newline at end of file From 66ec1557bcf98f80bb3a0dc9e031543d16bd3397 Mon Sep 17 00:00:00 2001 From: Sudhanshu Prasad Date: Thu, 27 Oct 2022 11:58:04 +0530 Subject: [PATCH 2/4] Delete takeoff.py --- .../controlling drone using python/takeoff.py | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 Python Projects/controlling drone using python/takeoff.py diff --git a/Python Projects/controlling drone using python/takeoff.py b/Python Projects/controlling drone using python/takeoff.py deleted file mode 100644 index 301214c6..00000000 --- a/Python Projects/controlling drone using python/takeoff.py +++ /dev/null @@ -1,25 +0,0 @@ -from pymavlink import mavutil - -the_connection=mavutil.mavlink_connection('udpin:localhost:14551') - -the_connection.wait_heartbeat() -print("Heartbeat from system (system %u component %u)" % - (the_connection.target_system, the_connection.target_component)) - -# while True: -# message=the_connection.recv_match(blocking=True) -# print(message) - -def takeoff(height): - - 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) - - 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) - - print("height: ", height) - -if __name__ == "__main__": - takeoff(20) - -msg = the_connection.recv_match(type='COMMAND_ACK', blocking=True) -print(msg) \ No newline at end of file From 1093f22a8880c410bec940e11ade496ac879dd7a Mon Sep 17 00:00:00 2001 From: Sudhanshu Prasad Date: Thu, 27 Oct 2022 11:58:36 +0530 Subject: [PATCH 3/4] taking off --- .../controlling drone using python/takeoff.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Python Projects/controlling drone using python/takeoff.py diff --git a/Python Projects/controlling drone using python/takeoff.py b/Python Projects/controlling drone using python/takeoff.py new file mode 100644 index 00000000..301214c6 --- /dev/null +++ b/Python Projects/controlling drone using python/takeoff.py @@ -0,0 +1,25 @@ +from pymavlink import mavutil + +the_connection=mavutil.mavlink_connection('udpin:localhost:14551') + +the_connection.wait_heartbeat() +print("Heartbeat from system (system %u component %u)" % + (the_connection.target_system, the_connection.target_component)) + +# while True: +# message=the_connection.recv_match(blocking=True) +# print(message) + +def takeoff(height): + + 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) + + 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) + + print("height: ", height) + +if __name__ == "__main__": + takeoff(20) + +msg = the_connection.recv_match(type='COMMAND_ACK', blocking=True) +print(msg) \ No newline at end of file From 46c7e58cfc5128be2d461b5aafba65a07ec74cfa Mon Sep 17 00:00:00 2001 From: Sudhanshu Prasad Date: Sat, 29 Oct 2022 00:25:03 +0530 Subject: [PATCH 4/4] landing --- Python Projects/controlling drone using python/land.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Python Projects/controlling drone using python/land.py diff --git a/Python Projects/controlling drone using python/land.py b/Python Projects/controlling drone using python/land.py new file mode 100644 index 00000000..b7413128 --- /dev/null +++ b/Python Projects/controlling drone using python/land.py @@ -0,0 +1,10 @@ +from pymavlink import mavutil + +the_connection=mavutil.mavlink_connection('udpin:localhost:14551') + +the_connection.wait_heartbeat() +print("Heartbeat from system (system %u component %u)" % + (the_connection.target_system, the_connection.target_component)) + + +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) \ No newline at end of file