Correction du cmake et tentative de build
Toujours impossible de trouver alchemy depuis tasks.h
This commit is contained in:
parent
f9ad5f6562
commit
7c3c63e032
6 changed files with 48 additions and 37 deletions
|
@ -10,7 +10,7 @@ add_library(base64
|
||||||
lib/base64/base64.cpp
|
lib/base64/base64.cpp
|
||||||
lib/base64/base64.h
|
lib/base64/base64.h
|
||||||
)
|
)
|
||||||
target_include_directories(base64 PUBLIC lib/base64/base64.h)
|
target_include_directories(base64 PUBLIC lib/base64)
|
||||||
|
|
||||||
# lib
|
# lib
|
||||||
add_library(lib
|
add_library(lib
|
||||||
|
@ -38,12 +38,12 @@ find_package(OpenCV REQUIRED)
|
||||||
target_link_libraries(lib ${OpenCV_LIBS})
|
target_link_libraries(lib ${OpenCV_LIBS})
|
||||||
|
|
||||||
# Raspicam_CV
|
# Raspicam_CV
|
||||||
find_package(raspicam REQUIRED)
|
#find_package(raspicam REQUIRED)
|
||||||
target_link_libraries(lib ${raspicam_CV_LIBS})
|
#target_link_libraries(lib ${raspicam_CV_LIBS})
|
||||||
|
|
||||||
# Xenomai
|
# Xenomai
|
||||||
set(Xenomai_ROOT_DIR /usr/xenomai) # Optional: hint for Xenomai root folder
|
set(Xenomai_ROOT_DIR /usr/xenomai) # Optional: hint for Xenomai root folder
|
||||||
set(Xenomai_libs POSIX ALCHEMY RTDM PSOS VXWORKS SMOKEY COBALT NATIVE) # List of Xenomai libraries to link
|
set(Xenomai_libs POSIX ALCHEMY RTDM PSOS VXWORKS SMOKEY NATIVE) # List of Xenomai libraries to link
|
||||||
|
|
||||||
find_package(Xenomai 3.0 REQUIRED ${Xenomai_libs})
|
find_package(Xenomai 3.0 REQUIRED ${Xenomai_libs})
|
||||||
if (Xenomai_FOUND)
|
if (Xenomai_FOUND)
|
||||||
|
@ -53,7 +53,7 @@ else ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
foreach (lib IN LISTS Xenomai_libs)
|
foreach (lib IN LISTS Xenomai_libs)
|
||||||
message(STATUS ${Xenomai_${lib}_LDFLAGS})
|
message(STATUS ${lib}: ${Xenomai_${lib}_LDFLAGS})
|
||||||
target_link_options(main PRIVATE ${Xenomai_${lib}_LDFLAGS})
|
target_link_options(main PRIVATE ${Xenomai_${lib}_LDFLAGS})
|
||||||
target_include_directories(main PRIVATE ${Xenomai_${lib}_INCLUDE_DIR})
|
target_include_directories(main PRIVATE ${Xenomai_${lib}_INCLUDE_DIR})
|
||||||
target_link_libraries(main ${Xenomai_${lib}_LIBRARY_DIRS} ${Xenomai_${lib}_LIBRARIES})
|
target_link_libraries(main ${Xenomai_${lib}_LIBRARY_DIRS} ${Xenomai_${lib}_LIBRARIES})
|
||||||
|
|
|
@ -155,7 +155,7 @@ if (DEFINED ENV{SDKTARGETSYSROOT} AND NOT DEFINED Xenomai_ROOT_DIR)
|
||||||
SET(ENV{DESTDIR} $ENV{SDKTARGETSYSROOT})
|
SET(ENV{DESTDIR} $ENV{SDKTARGETSYSROOT})
|
||||||
endif ()
|
endif ()
|
||||||
# set the search paths
|
# set the search paths
|
||||||
set(Xenomai_SEARCH_PATH /usr/local /usr $ENV{XENOMAI_ROOT_DIR} ${Xenomai_ROOT_DIR} ${Xenomai_ROOT_DIR}/usr/)
|
set(Xenomai_SEARCH_PATH ${Xenomai_ROOT_DIR})
|
||||||
|
|
||||||
# searching kernel headers
|
# searching kernel headers
|
||||||
# Find kernel headers
|
# Find kernel headers
|
||||||
|
@ -170,12 +170,14 @@ endif ()
|
||||||
|
|
||||||
|
|
||||||
# Find xeno-config
|
# Find xeno-config
|
||||||
find_program(Xenomai_XENO_CONFIG NAMES xeno-config PATHS ${Xenomai_SEARCH_PATH}/bin NO_DEFAULT_PATH)
|
# Always finds /usr/bin/xeno-config for some reason
|
||||||
|
# find_program(Xenomai_XENO_CONFIG NAMES xeno-config PATHS ${Xenomai_SEARCH_PATH}/bin NO_DEFAULT_PATH)
|
||||||
|
set(Xenomai_XENO_CONFIG ${Xenomai_SEARCH_PATH}/bin/xeno-config)
|
||||||
|
|
||||||
if (Xenomai_XENO_CONFIG)
|
if (Xenomai_XENO_CONFIG)
|
||||||
set(Xenomai_FOUND ${Xenomai_XENO_CONFIG})
|
set(Xenomai_FOUND ${Xenomai_XENO_CONFIG})
|
||||||
execute_process(COMMAND ${Xenomai_XENO_CONFIG} --version OUTPUT_VARIABLE Xenomai_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND ${Xenomai_XENO_CONFIG} --version OUTPUT_VARIABLE Xenomai_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
message(STATUS "xeno-config is found. Xenomai should be ok and version found is ${Xenomai_VERSION}")
|
message(STATUS "xeno-config is found at ${Xenomai_XENO_CONFIG}. Xenomai should be ok and version found is ${Xenomai_VERSION}")
|
||||||
|
|
||||||
if (${Xenomai_VERSION} VERSION_GREATER "3.0.2")
|
if (${Xenomai_VERSION} VERSION_GREATER "3.0.2")
|
||||||
message(STATUS "xeno-config has the --auto-init-solib option")
|
message(STATUS "xeno-config has the --auto-init-solib option")
|
||||||
|
|
|
@ -36,10 +36,11 @@ Camera::Camera():Camera(sm, 10){
|
||||||
Camera::Camera(int size, int fps) {
|
Camera::Camera(int size, int fps) {
|
||||||
this->SetSize(size);
|
this->SetSize(size);
|
||||||
#ifndef __FOR_PC__
|
#ifndef __FOR_PC__
|
||||||
this->cap.set(CV_CAP_PROP_FORMAT, CV_8UC3);
|
// TODO Throws Camera has no member cap
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
|
// this->cap.set(CV_CAP_PROP_FORMAT, CV_8UC3);
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
|
// this->cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
|
||||||
this->cap.set(CV_CAP_PROP_FPS, fps);
|
// this->cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
|
||||||
|
// this->cap.set(CV_CAP_PROP_FPS, fps);
|
||||||
#endif /* __FOR_PC__ */
|
#endif /* __FOR_PC__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,13 +61,14 @@ bool Camera::Open() {
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (this->cap.open()) {
|
// TODO Throws Camera has no member cap
|
||||||
cout << "Camera warmup 2sec" << endl << flush;
|
// if (this->cap.open()) {
|
||||||
sleep(2);
|
// cout << "Camera warmup 2sec" << endl << flush;
|
||||||
cout << "Start capture" << endl << flush;
|
// sleep(2);
|
||||||
|
// cout << "Start capture" << endl << flush;
|
||||||
status = true;
|
//
|
||||||
}
|
// status = true;
|
||||||
|
// }
|
||||||
#endif /* __FOR_PC__ */
|
#endif /* __FOR_PC__ */
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -76,7 +78,8 @@ bool Camera::Open() {
|
||||||
* Close and release camera
|
* Close and release camera
|
||||||
*/
|
*/
|
||||||
void Camera::Close() {
|
void Camera::Close() {
|
||||||
this->cap.release();
|
// TODO Throws Camera has no member cap
|
||||||
|
// this->cap.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,8 +123,9 @@ Img Camera::Grab() {
|
||||||
cap >> frame;
|
cap >> frame;
|
||||||
Img capture = Img(frame);
|
Img capture = Img(frame);
|
||||||
#else
|
#else
|
||||||
cap.grab();
|
// TODO Throws Camera has no member cap
|
||||||
cap.retrieve(frame);
|
// cap.grab();
|
||||||
|
// cap.retrieve(frame);
|
||||||
|
|
||||||
#ifdef __INVERSE_COLOR__
|
#ifdef __INVERSE_COLOR__
|
||||||
cvtColor(frame, frame, CV_BGR2RGB);
|
cvtColor(frame, frame, CV_BGR2RGB);
|
||||||
|
@ -138,7 +142,9 @@ Img Camera::Grab() {
|
||||||
* @return true if camera is open, false otherwise
|
* @return true if camera is open, false otherwise
|
||||||
*/
|
*/
|
||||||
bool Camera::IsOpen() {
|
bool Camera::IsOpen() {
|
||||||
return cap.isOpened();
|
// TODO Throws Camera has no member cap
|
||||||
|
// return cap.isOpened();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
#include <opencv2/imgproc/imgproc.hpp>
|
#include <opencv2/imgproc/imgproc.hpp>
|
||||||
|
|
||||||
#ifndef __FOR_PC__
|
#ifndef __FOR_PC__
|
||||||
#include "raspicam/raspicam_cv.h"
|
// TODO install raspicam and uncomment
|
||||||
|
//#include "raspicam/raspicam_cv.h"
|
||||||
#endif /* __FOR_PC__ */
|
#endif /* __FOR_PC__ */
|
||||||
#include "img.h"
|
#include "img.h"
|
||||||
|
|
||||||
|
@ -94,14 +95,15 @@ public:
|
||||||
Img Grab();
|
Img Grab();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef __FOR_PC__
|
// TODO install raspicam and uncomment
|
||||||
/**
|
//#ifdef __FOR_PC__
|
||||||
* Camera descriptor
|
// /**
|
||||||
*/
|
// * Camera descriptor
|
||||||
cv::VideoCapture cap;
|
// */
|
||||||
#else
|
// cv::VideoCapture cap;
|
||||||
raspicam::RaspiCam_Cv cap;
|
//#else
|
||||||
#endif /* __FOR_PC__ */
|
// raspicam::RaspiCam_Cv cap;
|
||||||
|
//#endif /* __FOR_PC__ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size for image (default= small)
|
* Size for image (default= small)
|
||||||
|
|
|
@ -153,7 +153,7 @@ int ComRobot::Open(string shost, int nport) {
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
return -1
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ int ComRobot::Open(string shost, int nport) {
|
||||||
int ComRobot::Close() {
|
int ComRobot::Close() {
|
||||||
#ifdef __SIMULATION__
|
#ifdef __SIMULATION__
|
||||||
return close(sock);
|
return close(sock);
|
||||||
#elif
|
#else
|
||||||
return close(fd);
|
return close(fd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,9 +175,10 @@ std::list<Position> Img::SearchRobot(Arena arena) {
|
||||||
imgTraitment = this->img(arena.arena);
|
imgTraitment = this->img(arena.arena);
|
||||||
}
|
}
|
||||||
|
|
||||||
cvtColor(imgTraitment, imgTraitment, CV_RGB2GRAY);
|
// TODO Cannot find symbols
|
||||||
threshold(imgTraitment, imgTraitment, 128, 255, CV_THRESH_BINARY);
|
// cvtColor(imgTraitment, imgTraitment, CV_RGB2GRAY);
|
||||||
findContours(imgTraitment, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cv::Point(0, 0));
|
// threshold(imgTraitment, imgTraitment, 128, 255, CV_THRESH_BINARY);
|
||||||
|
// findContours(imgTraitment, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cv::Point(0, 0));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < contours.size(); i++) {
|
for (unsigned int i = 0; i < contours.size(); i++) {
|
||||||
ImageMat m(contours[i]);
|
ImageMat m(contours[i]);
|
||||||
|
|
Loading…
Reference in a new issue