@@ -3,27 +3,38 @@ function ulog2csv(ulogfile, outputFileName)
3
3
% outputFileName
4
4
% usage£ºulog2csv('log001.ulg','log001')
5
5
if exist(ulogfile ,' file' )
6
- if ~exist(outputFileName ,' dir' )
7
- mkdir(outputFileName );
8
- end
9
-
10
- pathstr = pwd ;
6
+ dirNmae= [userpath ,' \ulogTmp' ];
7
+ if exist(dirNmae ,' dir' )
8
+ rmdir(dirNmae ,' s' );
9
+ end
10
+ mkdir(dirNmae );
11
+ mkdir([dirNmae ,' \' ,outputFileName ]);
12
+
13
+ copyfile(ulogfile ,dirNmae ,' f' );
14
+
15
+ pathstr = dirNmae ;
11
16
pathstr= strrep(pathstr ,' :' ,' ' );
12
17
pathstr= strrep(pathstr ,' \' ,' /' );
13
18
pathstr(1 )=lower(pathstr(1 ));
14
19
pathstr1= [' /mnt/' ,pathstr ];
15
-
16
- if exist([userpath ,' \Add-Ons\Toolboxes\PX4 PSP\code\+codertarget\+Pixhawk\+CMAKE_Utils\FirmwareVersion.mat' ],' file' )
17
- load([userpath ,' \Add-Ons\Toolboxes\PX4 PSP\code\+codertarget\+Pixhawk\+CMAKE_Utils\FirmwareVersion.mat' ]);
20
+ pathstr1= strrep(pathstr1 ,' ' ,' \ ' );
21
+
22
+ PSPFold= ' PX4PSP' ;
23
+ if exist([userpath ,' \Add-Ons\Toolboxes\PX4 PSP' ],' dir' )
24
+ PSPFold= ' PX4 PSP' ;
25
+ end
26
+
27
+ if exist([userpath ,' \Add-Ons\Toolboxes\' ,PSPFold ,' \code\+codertarget\+Pixhawk\+CMAKE_Utils\FirmwareVersion.mat' ],' file' )
28
+ load([userpath ,' \Add-Ons\Toolboxes\' ,PSPFold ,' \code\+codertarget\+Pixhawk\+CMAKE_Utils\FirmwareVersion.mat' ]);
18
29
if exist(' buildToolchain' ,' var' )
19
30
toolchainType= buildToolchain ;
20
31
21
32
if toolchainType == ' 1'
22
- command = [' C:\Windows\system32 \b ash.exe -c ' ,' cd ~; ulog2csv ' ,' -o ' ,pathstr1 ,' /' ,outputFileName ,' / ' ,pathstr1 ,' /' ,ulogfile ,' ' ];
33
+ command = [' wsl ' ,' cd ~; ulog2csv ' ,' -o ' ,pathstr1 ,' /' ,outputFileName ,' / ' ,pathstr1 ,' /' ,ulogfile ,' ' ];
23
34
else
24
35
defaultPX4Path = ' C:\PX4PSP' ;
25
- if exist([userpath ,' \Add-Ons\Toolboxes\PX4 PSP \code\+codertarget\+Pixhawk\+CMAKE_Utils\CmakeInfo.mat' ],' file' )
26
- load([userpath ,' \Add-Ons\Toolboxes\PX4 PSP \code\+codertarget\+Pixhawk\+CMAKE_Utils\CmakeInfo.mat' ]);
36
+ if exist([userpath ,' \Add-Ons\Toolboxes\' , PSPFold , ' \code\+codertarget\+Pixhawk\+CMAKE_Utils\CmakeInfo.mat' ],' file' )
37
+ load([userpath ,' \Add-Ons\Toolboxes\' , PSPFold , ' \code\+codertarget\+Pixhawk\+CMAKE_Utils\CmakeInfo.mat' ]);
27
38
if ~isempty(Px4PSP_CmakeInfo .Px4_Base_Dir )
28
39
defaultPX4Path= Px4PSP_CmakeInfo .Px4_Base_Dir ;
29
40
end
@@ -42,10 +53,14 @@ function ulog2csv(ulogfile, outputFileName)
42
53
end
43
54
status = system(command );
44
55
if status
45
- error( ' Make sure this code executes in the same workspace as the data file!' );
56
+ fprintf( 2 , ' Error: Make sure this code executes in the same workspace as the data file!\n ' );
46
57
else
58
+ copyfile([dirNmae ,' \' ,outputFileName ],[pwd ,' \' ,outputFileName ],' f' );
47
59
disp(' *******The conversion is complete!*******' );
48
60
end
61
+ if exist(dirNmae ,' dir' )
62
+ rmdir(dirNmae ,' s' );
63
+ end
49
64
else
50
65
error(' file does not exist!' );
51
66
end
0 commit comments