How to compile and deploy a custom voxl- script to Sentinel
-
Hey all,
I have written a voxl-record-battery script to record battery information to a csv file. I have based it off of VOXL Inspect Battery. How do I compile and deploy this code to a Sentinel?
The code is written in C++ and I have the voxl-docker installed.
Thank you for you help.
-
@Hersch-Nathan See here: https://docs.modalai.com/build-environments/#voxl-cross-for-cross-compiling-applications
Binaries built in voxl-cross will be able to be executed on VOXL2
-
Thank you so much for your help. I was able to build, make, and deploy my package with Voxl-Cross. However, I can not seem to get it to run from the command line.
I wrote it similar to voxl-logger and voxl-inspect-battery. Do you have any advice?
-
@Hersch-Nathan Do you have any error messages or info to provide so we can determine what the issue is?
-
@tom The only error I get is when I try to call the code from the terminal on the Sentinel. See below:
voxl2:~$ voxl-recorder-battery
-bash: voxl-recorder-battery: command not foundWould it be useful for me to post my code?
-
edit - here is the output from running the following clear && ./clean.sh && ./install_build_deps.sh qrb5165 dev && ./build.sh qrb5165 && ./make_package.sh deb && ./deploy_to_voxl.sh ssh 10.3.141.30
using qrb5165 dev debian repo
Ign:1 http://voxl-packages.modalai.com ./dists/qrb5165/dev/binary-arm64/ InRelease
Ign:2 http://voxl-packages.modalai.com ./dists/qrb5165/dev/binary-arm64/ Release
Get:3 http://voxl-packages.modalai.com ./dists/qrb5165/dev/binary-arm64/ Packages [98.6 kB]
Fetched 98.6 kB in 1s (108 kB/s)
Reading package lists... Done
installing:
libmodal-json
libmodal-pipe
libvoxl-cutils
voxl-mavlink
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libmodal-json:arm64 libmodal-pipe:arm64 libvoxl-cutils:arm64
voxl-mavlink:arm64
0 upgraded, 4 newly installed, 0 to remove and 69 not upgraded.
Need to get 675 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://voxl-packages.modalai.com ./dists/qrb5165/dev/binary-arm64/ libmodal-json 0.4.3-202209281920 [43.8 kB]
Get:2 http://voxl-packages.modalai.com ./dists/qrb5165/dev/binary-arm64/ libmodal-pipe 2.8.5-202306211619 [84.5 kB]
Get:3 http://voxl-packages.modalai.com ./dists/qrb5165/dev/binary-arm64/ libvoxl-cutils 0.1.1-202210072352 [6228 B]
Get:4 http://voxl-packages.modalai.com ./dists/qrb5165/dev/binary-arm64/ voxl-mavlink 0.1.1-202305011701 [541 kB]
Fetched 675 kB in 1s (704 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 4.)
debconf: falling back to frontend: Readline
Selecting previously unselected package libmodal-json:arm64.
(Reading database ... 30768 files and directories currently installed.)
Preparing to unpack .../libmodal-json_0.4.3-202209281920_arm64.deb ...
Unpacking libmodal-json:arm64 (0.4.3-202209281920) ...
Selecting previously unselected package libmodal-pipe:arm64.
Preparing to unpack .../libmodal-pipe_2.8.5-202306211619_arm64.deb ...
Unpacking libmodal-pipe:arm64 (2.8.5-202306211619) ...
Selecting previously unselected package libvoxl-cutils:arm64.
Preparing to unpack .../libvoxl-cutils_0.1.1-202210072352_arm64.deb ...
Unpacking libvoxl-cutils:arm64 (0.1.1-202210072352) ...
Selecting previously unselected package voxl-mavlink:arm64.
Preparing to unpack .../voxl-mavlink_0.1.1-202305011701_arm64.deb ...
Unpacking voxl-mavlink:arm64 (0.1.1-202305011701) ...
Setting up voxl-mavlink:arm64 (0.1.1-202305011701) ...
Setting up libvoxl-cutils:arm64 (0.1.1-202210072352) ...
Setting up libmodal-json:arm64 (0.4.3-202209281920) ...
Setting up libmodal-pipe:arm64 (2.8.5-202306211619) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...Done installing dependencies
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc-7 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++-7 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- processor: aarch64
-- librc_math: LIBRC_MATH_SO-NOTFOUND
-- libmodal_pipe: /usr/lib64/libmodal_pipe.so
-- libmodal_json: /usr/lib64/libmodal_json.so
-- libturbojpeg.so: LIBJPEG_TURBO_SO-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /home/root/cross-workspace/voxl-recorder-battery/build
[ 25%] Building CXX object tools/CMakeFiles/voxl-record-battery.dir/voxl-record-battery.cpp.o
[ 50%] Building C object lib/CMakeFiles/voxl_common_config.dir/voxl_common_config.c.o
[ 75%] Linking C shared library libvoxl_common_config.so
[ 75%] Built target voxl_common_config
In file included from /home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp:52:0:
/home/root/cross-workspace/voxl-recorder-battery/tools/log_defs.h: In function 'void _rotation_to_tait_bryan_xyz_intrinsic(float ()[3], float, float*, float*)':
/home/root/cross-workspace/voxl-recorder-battery/tools/log_defs.h:158:19: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
if(fabs(R[0][2]) < 0.9999999){
~~~^
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp: In function 'int _start_csv(int)':
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp:227:66: warning: unknown conversion type character ')' in format [-Wformat=]
fprintf(fd, "i,timestamp(ns),,Voltage(V),Charge(%),Current(A)\n");
^
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp:205:6: warning: unused variable 'i' [-Wunused-variable]
int i;
^
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp:209:7: warning: unused variable 'raw_path' [-Wunused-variable]
char raw_path[512];
^
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp: In function 'int _parse_opts(int, char**)':
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp:201:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp: At global scope:
/home/root/cross-workspace/voxl-recorder-battery/tools/voxl-record-battery.cpp:82:13: warning: 'note' defined but not used [-Wunused-variable]
static char note[MAX_NOTE_LEN] = "na";
^~~~
[100%] Linking CXX executable voxl-record-battery
[100%] Built target voxl-record-battery
Package Name: voxl-recorder-battery
version Number: 0.0.2
Consolidate compiler generated dependencies of target voxl-record-battery
[ 50%] Built target voxl-record-battery
Consolidate compiler generated dependencies of target voxl_common_config
[100%] Built target voxl_common_config
Install the project...
-- Install configuration: ""
-- Installing: ../pkg/data/usr/bin/voxl-record-battery
-- Installing: ../pkg/data/usr/lib64/libvoxl_common_config.so
-- Installing: ../pkg/data/usr/include/voxl_common_config.h
/home/root/cross-workspace/voxl-recorder-battery
starting building Debian Package
dpkg-deb: building package 'voxl-recorder-battery' in 'voxl-recorder-battery_0.0.2_arm64.deb'.
DONE
searching for ssh device
checking VOXL for dpkg/opkg
dpkg detected
(Reading database ... 121951 files and directories currently installed.)
Preparing to unpack .../voxl-recorder-battery_0.0.2_arm64.deb ...
Unpacking voxl-recorder-battery (0.0.2) over (0.0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ... -
@Hersch-Nathan Looks like you called the binary
voxl-record-battery
based onInstalling: ../pkg/data/usr/bin/voxl-record-battery
whereas you're calling
voxl-recorder-battery
-
@tom Thank you so much for you help! I got my code to deploy to the voxl! Now on to bug fixing!