Using DO_SET_ACTUATOR to releasing the payload

Hi everyone :wink:

I have question about MAV_CMD_DO_SET_ACTUATOR command. I would like to assign via mixer file four servos connected to AUX1,2,3 and 4 to release the payload. Payload should be released when the autopilot receives MAVLink command from GCS. I found out that the best command for that action will be MAV_CMD_DO_SET_ACTUATOR, but it didn’t work when I sent this command.

I looked to source code and found out the block of code which is responsible for handling received MAV_CMD_DO_SET_ACTUATOR.

 else if (cmd_mavlink.command == MAV_CMD_DO_SET_ACTUATOR) {
		// since we're only paying attention to 3 AUX outputs, the
		// index should be 0, otherwise ignore the message
		if (((int) vehicle_command.param7) == 0) {
			actuator_controls_s actuator_controls{};
			// update with existing values to avoid changing unspecified controls
			_actuator_controls_3_sub.update(&actuator_controls);

			actuator_controls.timestamp = hrt_absolute_time();

			bool updated = false;

			if (PX4_ISFINITE(vehicle_command.param1)) {
				actuator_controls.control[5] = vehicle_command.param1;
				updated = true;
			}

			if (PX4_ISFINITE(vehicle_command.param2)) {
				actuator_controls.control[6] = vehicle_command.param2;
				updated = true;
			}

			if (PX4_ISFINITE(vehicle_command.param3)) {
				actuator_controls.control[7] = vehicle_command.param3;
				updated = true;
			}

			if (updated) {
				_actuator_controls_pubs[3].publish(actuator_controls);
			}
		}

		_cmd_pub.publish(vehicle_command);

	}
  1. Is variable _actuator_controls_3_sub represent control group #3 (manual passthrough)? How to get access to control group #6 (first payload)?

  2. Why AUX1,2 and 3 is appropriately vehicle_command.param1 (2 and 3) with vehicle_command.param7 equals to 0? I thought after reading command description that param1,2,3...,6 with param7=0 (index) is appropriately MAIN1,2,3,…6 and if you want to change MAIN7 you will have to change index do 1 and start again from param1. How does it works?