From 3f2ab2356338ab31a02b327a7160a68c90f1f3e9 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 8 Jan 2019 01:24:01 -0800 Subject: [PATCH] Move default multiCameraServer from allwpilib to tools --- deps/04-copy.sh | 4 +- deps/tools/Makefile | 22 ++++ deps/tools/multiCameraServer.cpp | 190 +++++++++++++++++++++++++++++++ stage2/01-sys-tweaks/01-run.sh | 3 + 4 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 deps/tools/multiCameraServer.cpp diff --git a/deps/04-copy.sh b/deps/04-copy.sh index dec4d2a..2b73bc1 100755 --- a/deps/04-copy.sh +++ b/deps/04-copy.sh @@ -19,6 +19,8 @@ sh -c 'cd examples && zip -r - python-multiCameraServer' > ${DEST}/python-multiC cp tools/setuidgids ${DEST}/ cp tools/_cscore.so ${DEST}/_cscore.cpython-35m-arm-linux-gnueabihf.so cp tools/_cscore.so.debug ${DEST}/ +cp tools/multiCameraServer ${DEST}/ +cp tools/multiCameraServer.debug ${DEST}/ cp tools/rpiConfigServer ${DEST}/ cp tools/rpiConfigServer.debug ${DEST}/ @@ -72,4 +74,4 @@ sh -c 'cd allwpilib/cscore/src/main/native/include && tar czf - .' > ${DEST}/csc sh -c 'cd allwpilib/ntcore/src/main/native/include && tar czf - .' > ${DEST}/ntcore-include.tar.gz sh -c 'cd allwpilib/cameraserver/src/main/native/include && tar czf - cameraserver vision' > ${DEST}/cameraserver-include.tar.gz -sh -c 'cd 03-build/allwpilib-static/bin && tar czf - cscore_* multiCameraServer* netconsoleTee*' > ${DEST}/wpilib-bin.tar.gz +sh -c 'cd 03-build/allwpilib-static/bin && tar czf - cscore_* netconsoleTee*' > ${DEST}/wpilib-bin.tar.gz diff --git a/deps/tools/Makefile b/deps/tools/Makefile index b577e56..05b1e8a 100644 --- a/deps/tools/Makefile +++ b/deps/tools/Makefile @@ -4,6 +4,7 @@ WPILIB_SRC?=../allwpilib WPILIB_BUILD?=../03-build/allwpilib-build WPILIB_STATIC_BUILD?=../03-build/allwpilib-static OPENCV_INSTALL?=../03-build/opencv-build/install +OPENCV_STATIC_INSTALL?=../03-build/opencv-static/install EXEC_HOME?=/home/pi FRC_JSON?=/boot/frc.json DHCPCD_CONF?=/boot/dhcpcd.conf @@ -42,6 +43,27 @@ _cscore.so: ../robotpy-cscore/src/_cscore.cpp ../robotpy-cscore/src/ndarray_conv ${COMPILER}strip -g $@ ${COMPILER}objcopy --add-gnu-debuglink=$@.debug $@ +multiCameraServer: multiCameraServer.cpp + ${COMPILER}g++ -pthread -g -o $@ \ + -I${OPENCV_INSTALL}/include \ + -I${WPILIB_SRC}/wpiutil/src/main/native/include \ + -I${WPILIB_SRC}/cameraserver/src/main/native/include \ + -I${WPILIB_SRC}/cscore/src/main/native/include \ + -I${WPILIB_SRC}/ntcore/src/main/native/include \ + -L${WPILIB_STATIC_BUILD}/lib \ + -L${OPENCV_STATIC_INSTALL}/lib \ + -L${OPENCV_STATIC_INSTALL}/share/OpenCV/3rdparty/lib \ + $< \ + -lcameraserver \ + -lcscore \ + -lntcore \ + -lwpiutil \ + -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_core \ + -ltegra_hal -llibpng -llibjpeg-turbo -lzlib + ${COMPILER}objcopy --only-keep-debug $@ $@.debug + ${COMPILER}strip -g $@ + ${COMPILER}objcopy --add-gnu-debuglink=$@.debug $@ + RPICONFIGSERVER_OBJS= \ rpiConfigServer_src/main.o \ rpiConfigServer_src/Application.o \ diff --git a/deps/tools/multiCameraServer.cpp b/deps/tools/multiCameraServer.cpp new file mode 100644 index 0000000..dbfc7b6 --- /dev/null +++ b/deps/tools/multiCameraServer.cpp @@ -0,0 +1,190 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2018 FIRST. All Rights Reserved. */ +/* Open Source Software - may be modified and shared by FRC teams. The code */ +/* must be accompanied by the FIRST BSD license file in the root directory of */ +/* the project. */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "cameraserver/CameraServer.h" + +/* + JSON format: + { + "team": , + "ntmode": <"client" or "server", "client" if unspecified> + "cameras": [ + { + "name": + "path": + "pixel format": <"MJPEG", "YUYV", etc> // optional + "width":