mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Fixed automatic log conversion / plotting script
This commit is contained in:
parent
c71f2ea204
commit
5f01688490
@ -1,5 +1,5 @@
|
||||
clear all
|
||||
clc
|
||||
close all
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% SYSTEM VECTOR
|
||||
@ -51,9 +51,21 @@ if exist('sysvector.bin', 'file')
|
||||
gps = sysvector(:,33:35);
|
||||
gps(~any(gps,2), :) = [];
|
||||
|
||||
plot3(gps(:,1), gps(:,2), gps(:,3));
|
||||
all_data = figure('Name', 'GPS RAW');
|
||||
gps_position = plot3(gps(:,1), gps(:,2), gps(:,3));
|
||||
|
||||
|
||||
all_data = figure('Name', 'Complete Log Data (exc. GPS)');
|
||||
plot(sysvector(:,1), sysvector(:,2:32));
|
||||
|
||||
actuator_inputs = figure('Name', 'Attitude controller outputs');
|
||||
plot(sysvector(:,1), sysvector(:,14:17));
|
||||
legend('roll motor setpoint', 'pitch motor setpoint', 'yaw motor setpoint', 'throttle motor setpoint');
|
||||
|
||||
actuator_outputs = figure('Name', 'Actuator outputs');
|
||||
plot(sysvector(:,1), sysvector(:,18:25));
|
||||
legend('actuator 0', 'actuator 1', 'actuator 2', 'actuator 3', 'actuator 4', 'actuator 5', 'actuator 6', 'actuator 7');
|
||||
|
||||
end
|
||||
|
||||
if exist('actuator_outputs0.bin', 'file')
|
||||
|
||||
@ -567,6 +567,7 @@ int file_copy(const char* file_old, const char* file_new)
|
||||
{
|
||||
FILE *source, *target;
|
||||
source = fopen(file_old, "r");
|
||||
int ret = 0;
|
||||
|
||||
if( source == NULL )
|
||||
{
|
||||
@ -580,21 +581,24 @@ int file_copy(const char* file_old, const char* file_new)
|
||||
{
|
||||
fclose(source);
|
||||
warnx("failed to open output file to copy");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char buf[128];
|
||||
int nread;
|
||||
while ((nread = fread(buf, sizeof(buf), 1, source)) > 0) {
|
||||
int ret = fwrite(buf, sizeof(buf), 1, target);
|
||||
while ((nread = fread(buf, 1, sizeof(buf), source)) > 0) {
|
||||
int ret = fwrite(buf, 1, nread, target);
|
||||
if (ret <= 0) {
|
||||
warnx("error writing file");
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fsync(fileno(target));
|
||||
|
||||
fclose(source);
|
||||
fclose(target);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user