Teensy interface

From Rsewiki
Revision as of 12:06, 21 July 2024 by Jca (talk | contribs)

Back to Scorpi

Installation packages

See installation notes for needed OS-packages.

For the Teensy interface fetch the software here:

mkdir -p ~/svn
cd ~/svn
svn checkout svn://repos.gbar.dtu.dk/jcan/scorpi

Then go to the Teensy_interface and compile like this:

cd scorpi/teensy_interface
mkdir build
cd build
cmake ..

-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - 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/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr (found version "4.5.1") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in thread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
# Is a RASPBERRY; CPU=aarch64 (Pi3=armv7l, pi4=aarch64)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/local/svn/scorpi/teensy_interface/build


A Makefile is now generated. To compile:

make -j3

local@joe:~/svn/scorpi/teensy_interface/build $ make -j3
Scanning dependencies of target teensy_interface
[  9%] Building CXX object CMakeFiles/teensy_interface.dir/src/cheading.cpp.o
[  9%] Building CXX object CMakeFiles/teensy_interface.dir/src/bplan100.cpp.o
[ 13%] Building CXX object CMakeFiles/teensy_interface.dir/src/cmixer.cpp.o
[ 18%] Building CXX object CMakeFiles/teensy_interface.dir/src/cmotor.cpp.o
[ 22%] Building CXX object CMakeFiles/teensy_interface.dir/src/cservo.cpp.o
[ 27%] Building CXX object CMakeFiles/teensy_interface.dir/src/main.cpp.o
[ 31%] Building CXX object CMakeFiles/teensy_interface.dir/src/maruco.cpp.o
[ 36%] Building CXX object CMakeFiles/teensy_interface.dir/src/mpose.cpp.o
[ 40%] Building CXX object CMakeFiles/teensy_interface.dir/src/sas5147u.cpp.o
[ 45%] Building CXX object CMakeFiles/teensy_interface.dir/src/scam.cpp.o
[ 50%] Building CXX object CMakeFiles/teensy_interface.dir/src/sencoder.cpp.o
[ 54%] Building CXX object CMakeFiles/teensy_interface.dir/src/sgpiod.cpp.o
[ 59%] Building CXX object CMakeFiles/teensy_interface.dir/src/simu.cpp.o
[ 63%] Building CXX object CMakeFiles/teensy_interface.dir/src/sjoylogitech.cpp.o
[ 68%] Building CXX object CMakeFiles/teensy_interface.dir/src/spyvision.cpp.o
[ 72%] Building CXX object CMakeFiles/teensy_interface.dir/src/sstate.cpp.o
[ 77%] Building CXX object CMakeFiles/teensy_interface.dir/src/steensy.cpp.o
[ 81%] Building CXX object CMakeFiles/teensy_interface.dir/src/upid.cpp.o
[ 86%] Building CXX object CMakeFiles/teensy_interface.dir/src/uservice.cpp.o
/home/local/svn/scorpi/teensy_interface/src/steensy.cpp: In member function ‘bool UOutQueue::setMessage(const char*)’:
/home/local/svn/scorpi/teensy_interface/src/steensy.cpp:66:12: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be  truncated copying 3 bytes from a string of length 3 [-Wstringop-truncation]
   66 |     strncpy(msg, cc, 3);
      |     13:06, 21 July 2024 (CEST)~~^13:06, 21 July 2024 (CEST)13:06, 21 July 2024 (CEST)~
[ 90%] Building CXX object CMakeFiles/teensy_interface.dir/src/usocket.cpp.o
[ 95%] Building CXX object CMakeFiles/teensy_interface.dir/src/utime.cpp.o
[100%] Linking CXX executable teensy_interface
[100%] Built target teensy_interface

After a while, all should be compiled with a few warnings. Test if it can run:

local@joe:~/svn/scorpi/teensy_interface/build $ ./teensy_interface 
# UService:: created directory log_20240721_130326.804/
# UService::setup: open to Teensy 0
# UService::setup: open to Teensy 1
# SGpiod::setup there is no GPIO chip found - disable function
# SpyVision:: disabled in robot.ini
# UCam:: disabled in robot.ini
# --------- terminating -----------
# UService:: configuration saved to robot.ini

Output depends on the configuration file "robot.ini" created with default values.