You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
578 B

function AP_send(gyro, attitude, accel, velocity, position, time)
global u
if isempty(u)
return
end
persistent past_time
if isempty(past_time)
past_time = -1;
end
if past_time == time
error('Send repeat time');
end
past_time = time;
% build structure representing the JSON string to be sent
JSON.timestamp = time;
JSON.imu.gyro = gyro;
JSON.imu.accel_body = accel;
JSON.position = position;
JSON.attitude = attitude;
JSON.velocity = velocity;
% Report to AP
pnet(u,'printf',sprintf('\n%s\n',jsonencode(JSON)));
pnet(u,'writepacket');
end