Pixhawk 4 with UAVCAN esc not sending command

#1

Hi,

I connect my esc with the uavcan to my Pixhawk 4 (with generic ground vehicle).
The node is detected, I can see it doing “uavcan status” in the nsh console.
I can read the rpm etc…
Here is the issue:
-when I arm, no command are received to the esc through the uavcan
-when I hardcode the pwm value in esc.cpp:

    for (unsigned i = 0; i < num_outputs; i++) {
	  if (_armed_mask & MOTOR_BIT(i)) {
		float scaled = (outputs[i] + 1.0F) * 0.5F * cmd_max;
		scaled = 1615; // if I hardcode, it goes through the UAVCAN and the motor spins
		// trim negative values back to minimum
		if (scaled < cmd_min) {
			scaled = cmd_min;
			perf_count(_perfcnt_scaling_error);
		}

		if (scaled > cmd_max) {
			scaled = cmd_max;
			perf_count(_perfcnt_scaling_error);
		}

		msg.cmd.push_back(static_cast<int>(scaled));

		_esc_status.esc[i].esc_setpoint_raw = abs(static_cast<int>(scaled));
		actuator_outputs.output[i] = scaled;

	} else {
		msg.cmd.push_back(static_cast<unsigned>(0));
		actuator_outputs.output[i] = 0.0f;
	}
}

-Same, if I hardcode the command value in uavcan_main.cpp before sending it to the esc it spins.
_outputs.output[0] = 0.2f
_esc_controller.update_outputs(_outputs.output, _outputs.noutputs);

I tested putting this hardcoded line in a couple of places in uavcan_main.cpp, and I suspect:
1-either that the control commands never arrives in _actuator_direct variable (see file)
2- if I put the hardcoded line before this line:
_outputs.noutputs = _mixers->mix(&_outputs.output[0], num_outputs_max);
->it doesn’t work
if I put it after, it works.

Any ideas?

Best regards,