ArduPilot/node-mavlink

SetPositionTargetGlobalInt doesn't change altitude on pixhawk 4

Closed this issue · 0 comments

KTBM commented

I have two drones running on different Pixhawk systems, one is running on an old pixhawk 1 and the second is running on a new pixhawk 4 orange cube.
I have encountered a very peculiar issue that I can't seem to manage to solve, the pixhawk 1 system works well with the commands I am trying to run, but the pixhawk 4 system refuses to update its altitude when using the set_position_target_global_int. If i use only the .alt parameter, it does not move at all, and if I add other parameters such as long/lat or yaw, those change according to what I've provided, but the altitude does not change no matter what. The pixhawk 1 version works very well. I have compared their parameters using Mission Planner's full parameter list, and other than PID, they are the same. my code is running on V1 protocol, and my friend is working now on changing to V2 to test it. I would really appreciate it if you could shed some light on why this issue is occuring, if you are familiar with it or have any suggestions.

my sample code to change the alt:

const alt = new common.SetPositionTargetGlobalInt(1, 1); 
alt.coordinateFrame = 6; //
alt.typeMask = 4088;
alt.lonInt = current_long; 
alt.latInt = current_lat; 
alt.alt = altitude; 
alt.yaw = yaw_;
const buffer6 = protocol.serialize(alt, myMAV.sequence); //myMAV.sequence
console.log(buffer6.toString('hex'));
port.send(buffer6, 0, buffer6.length, 10001, "192.168.1.254", (error) => {
    if (error) {
      console.error(error);
    } else {
      console.log("changing altitude");
    }
});

if anyone has any questions i'll gladly answer.
any help is appreciated