Generic Actuator Control not working with MAVSDK

Hello everyone,
i am currently trying to move my rover vehicle via a companion computer, that is connected over usb. I have written some basic mavsdk c++ code to control the motor. My motor is connected on aux1 and when using the slider in QGroundControl the motor moves as expected. MavSDK sucessfully connects and sends actuator control messages without errors. What i need is direct motor and servo control.

Setup:
Pix32v6 (Software V. 1.15.2)
Airframe Type: Rover
Nvidia Jetson Nano (Connected over usb)

What have i tried / State of configuration:

  1. Setting function to Throttle and to Peripheral via Actuator Set 1 (Generic Actuator Control | PX4 Guide (main))
  2. No parameters changed.
  3. Testing motors via console in QGroundControl (PWM test works)
  4. I am using the actuators tab and there is no radio configured.
  5. Sending direct passthrough comands like MAV_CMD_DO_SET_ACTUATOR

What are my problems:

  1. The motor won’t move via mavlink control
  2. I need to force arm because of missing sensor calibration and missing radio ( That may be the problem?)

Code:

   Mavsdk mavsdk(Mavsdk::Configuration(ComponentType::CompanionComputer));
    ConnectionResult connection_result = mavsdk.add_any_connection("serial:///dev/serial/by-id/usb-Auterion_PX4_FMU_v6C.x_0-if00:57600");
    if (connection_result != ConnectionResult::Success) {
        std::cout << "Adding connection failed: " << connection_result << '\n';
    }

    // Test code
    auto system = mavsdk.first_autopilot(3.0);

    // Instantiate plugins.
    auto action = Action{system.value()};

    const Action::Result arm_result = action.arm_force();

    if (arm_result != Action::Result::Success) {
        std::cout << "Arming failed:" << arm_result <<  '\n';
        return 1; //Exit if arming fails
    }
    for(int i  = 1; i < 10; i++){
        int32_t test = i;
        LOG_S("Set actuator " + std::to_string(test),"main");
        const Action::Result set_actuator_result = action.set_actuator(test,0.3f);
        if (set_actuator_result != Action::Result::Success) {
            std::cerr << "Setting actuator failed:" << set_actuator_result << '\n';
            return 1;
        }
    }

Output:

  1. [02:23:29|Info ] MAVSDK version: v3.0.0 (mavsdk_impl.cpp:30) [02:23:29|Debug] New system ID: 1 Comp ID: 1 (mavsdk_impl.cpp:730) [02:23:29|Debug] Component Autopilot (1) added. (system_impl.cpp:377) [02:23:29|Warn ] Vehicle type changed (new type: 10, old type: 0) (system_impl.cpp:217) [02:23:29|Debug] Discovered 1 component(s) (system_impl.cpp:497) [02:23:29|Debug] Request message 148 using REQUEST_MESSAGE (mavlink_request_message.cpp:78) (26-02-2025 13:23:29)[main] Set actuator 1 (26-02-2025 13:23:29)[main] Set actuator 2 (26-02-2025 13:23:29)[main] Set actuator 3 (26-02-2025 13:23:29)[main] Set actuator 4 (26-02-2025 13:23:29)[main] Set actuator 5 (26-02-2025 13:23:29)[main] Set actuator 6 (26-02-2025 13:23:29)[main] Set actuator 7 (26-02-2025 13:23:29)[main] Set actuator 8 (26-02-2025 13:23:29)[main] Set actuator 9 (Bearbeitet)

Thanks in advance!

1 Like