Skip to content

PyMavLink- Unable to arm and run AUX pin motors #1004

@RishiWadhwa

Description

@RishiWadhwa

I was trying to do some individual motor tests to be able to autonomously control the motors on the AUX pins of the Orange CubePilot controller, but I can't seem to be able to test the motors or even arm the device. It returns a MAV_RESULT of 1, meaning temporarily rejected, because I assume it can't get a GPS lock, as it is just 2 motors attached to a battery and the Cube. Is there a way of overriding this?

For reference here is my code:

from pymavlink import mavutil
import time

# Connect to the flight controller
# Replace '/dev/tty.usbmodem01' with the correct serial port
# master = mavutil.mavlink_connection('localhost:14445')
# master = mavutil.mavlink_connection('/dev/tty.usbmodem01', baud=57600)
master = mavutil.mavlink_connection('/dev/cu.usbmodem01')

# Wait for a heartbeat to confirm the connection
master.wait_heartbeat()
print("Heartbeat received! Flight controller is connected.")

master.mav.command_long_send(master.target_system, master.target_component, 
    mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1, 0, 0, 0, 0, 0, 0)

msg = master.recv_match(type="COMMAND_ACK", blocking=True)
print(msg)

# master.mav.command_long_send(master.target_system, master.target_component,
    # mavutil.mavlink.MAV_CMD_DO_MOTOR_TEST, 0, 5, 1, 1500, 15, 
    # 0, 0, 0)

--
And here is what I am getting when I run the code:

Heartbeat received! Flight controller is connected.
COMMAND_ACK {command : 400, result : 1, progress : 0, result_param2 : 0, target_system : 255, target_component : 0}

My end goal is to be able to run the motors autonomously without using tols like QGroundControl of another GUI system. I would like to be able to run commands independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions