Compare commits
No commits in common. "simulation-cmake" and "master" have entirely different histories.
simulation
...
master
45 changed files with 351 additions and 1771 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -64,6 +64,4 @@ GUI
|
||||||
|
|
||||||
/software/raspberry/superviseur-robot/superviseur/dist/
|
/software/raspberry/superviseur-robot/superviseur/dist/
|
||||||
/software/raspberry/testeur/testeur/build/
|
/software/raspberry/testeur/testeur/build/
|
||||||
/software/raspberry/testeur/testeur/dist/
|
/software/raspberry/testeur/testeur/dist/
|
||||||
/software/simulateur/build/
|
|
||||||
/software/simulateur/dist/
|
|
|
@ -35,7 +35,7 @@ namespace monitor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default server name
|
/// Default server name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string defaultIP = "localhost";
|
public const string defaultIP = "10.105.1.13";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default server port number
|
/// Default server port number
|
||||||
|
|
|
@ -180,16 +180,11 @@ namespace monitor
|
||||||
isBusy = true;
|
isBusy = true;
|
||||||
|
|
||||||
// Send command to server
|
// Send command to server
|
||||||
if (timeout > 0) // Command request an acknowledge
|
|
||||||
{
|
|
||||||
waitForAcknowledge = true; // Flag used in OnMessageReception callback to avoid
|
|
||||||
// sending acknowledge message to upper level
|
|
||||||
}
|
|
||||||
|
|
||||||
Client.Write(cmd);
|
Client.Write(cmd);
|
||||||
|
|
||||||
if (timeout > 0) // Command request an acknowledge
|
if (timeout > 0) // Command request an acknowledge
|
||||||
{
|
{
|
||||||
|
|
||||||
waitForAcknowledge = true; // Flag used in OnMessageReception callback to avoid
|
waitForAcknowledge = true; // Flag used in OnMessageReception callback to avoid
|
||||||
// sending acknowledge message to upper level
|
// sending acknowledge message to upper level
|
||||||
waitTimer.Interval = timeout;
|
waitTimer.Interval = timeout;
|
||||||
|
|
|
@ -111,8 +111,7 @@ namespace monitor
|
||||||
InvalidAnswer,
|
InvalidAnswer,
|
||||||
Busy,
|
Busy,
|
||||||
CommunicationLostWithRobot,
|
CommunicationLostWithRobot,
|
||||||
CommunicationLostWithServer,
|
CommunicationLostWithServer
|
||||||
CommunicationError
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct Point {
|
public struct Point {
|
||||||
|
@ -260,8 +259,6 @@ namespace monitor
|
||||||
if (answer.ToUpper().Contains(DestijlCommandList.ANSWER_NACK)) status = CommandStatus.Rejected;
|
if (answer.ToUpper().Contains(DestijlCommandList.ANSWER_NACK)) status = CommandStatus.Rejected;
|
||||||
// if communication is lost with robot, return CommunicationLostWithRobot
|
// if communication is lost with robot, return CommunicationLostWithRobot
|
||||||
else if (answer.ToUpper().Contains(DestijlCommandList.ANSWER_TIMEOUT)) status = CommandStatus.CommunicationLostWithRobot;
|
else if (answer.ToUpper().Contains(DestijlCommandList.ANSWER_TIMEOUT)) status = CommandStatus.CommunicationLostWithRobot;
|
||||||
|
|
||||||
else if (answer.ToUpper().Contains(DestijlCommandList.ANSWER_COM_ERROR)) status = CommandStatus.CommunicationError;
|
|
||||||
// if answer is empty, communication with robot is lost
|
// if answer is empty, communication with robot is lost
|
||||||
else if (answer.Length == 0) status = CommandStatus.CommunicationLostWithServer;
|
else if (answer.Length == 0) status = CommandStatus.CommunicationLostWithServer;
|
||||||
//else status = CommandStatus.InvalidAnswer;
|
//else status = CommandStatus.InvalidAnswer;
|
||||||
|
|
Binary file not shown.
|
@ -1,9 +1,10 @@
|
||||||
build/
|
build/
|
||||||
src.sav/
|
src.sav/
|
||||||
cmake-build-*/
|
cmake-build-debug/
|
||||||
futur/
|
futur/
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
|
|
||||||
|
*.cmake
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
|
|
||||||
docs/
|
docs/
|
||||||
|
@ -12,3 +13,5 @@ doc/
|
||||||
workspace/
|
workspace/
|
||||||
dist/
|
dist/
|
||||||
not_for_students/
|
not_for_students/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.13)
|
|
||||||
project(superviseur)
|
|
||||||
|
|
||||||
# Import modules
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules)
|
|
||||||
|
|
||||||
# Compile libraries
|
|
||||||
# Base64
|
|
||||||
add_library(base64
|
|
||||||
lib/base64/base64.cpp
|
|
||||||
lib/base64/base64.h
|
|
||||||
)
|
|
||||||
target_include_directories(base64 PUBLIC lib/base64)
|
|
||||||
|
|
||||||
# lib
|
|
||||||
add_library(lib
|
|
||||||
lib/camera.cpp
|
|
||||||
lib/camera.h
|
|
||||||
lib/commonitor.cpp
|
|
||||||
lib/commonitor.h
|
|
||||||
lib/comrobot.cpp
|
|
||||||
lib/comrobot.h
|
|
||||||
lib/img.cpp
|
|
||||||
lib/img.h
|
|
||||||
lib/messages.cpp
|
|
||||||
lib/messages.h
|
|
||||||
)
|
|
||||||
target_include_directories(lib PUBLIC lib)
|
|
||||||
target_link_libraries(lib base64)
|
|
||||||
target_compile_definitions(lib PUBLIC __FOR_PC__ __SIMULATION__ __WITH_ARUCO__)
|
|
||||||
|
|
||||||
# Compile main executable
|
|
||||||
add_executable(main main.cpp tasks.cpp tasks.h)
|
|
||||||
target_link_libraries(main lib)
|
|
||||||
|
|
||||||
# OpenCV
|
|
||||||
#set (OpenCV_DIR /path/to/opencv) # Optiona: hint for OpenCV root folder
|
|
||||||
find_package(OpenCV REQUIRED)
|
|
||||||
target_link_libraries(lib ${OpenCV_LIBS})
|
|
||||||
|
|
||||||
# Raspicam_CV
|
|
||||||
#find_package(raspicam REQUIRED)
|
|
||||||
#target_link_libraries(lib ${raspicam_CV_LIBS})
|
|
||||||
|
|
||||||
# Xenomai
|
|
||||||
set(Xenomai_ROOT_DIR /usr/xenomai) # Optional: hint for Xenomai root folder
|
|
||||||
set(Xenomai_libs POSIX ALCHEMY RTDM PSOS VXWORKS SMOKEY NATIVE) # List of Xenomai libraries to link
|
|
||||||
|
|
||||||
find_package(Xenomai 3.0 REQUIRED ${Xenomai_libs})
|
|
||||||
if (Xenomai_FOUND)
|
|
||||||
message(STATUS "Xenomai found with theses skins: ${Xenomai_SKINS}")
|
|
||||||
else ()
|
|
||||||
message(FATAL_ERROR "Xenomai not found")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
foreach (lib IN LISTS Xenomai_libs)
|
|
||||||
target_include_directories(main PRIVATE ${Xenomai_${lib}_INCLUDE_DIRS})
|
|
||||||
target_link_options(main PRIVATE "LINKER:-R/usr/xenomai/lib")
|
|
||||||
target_link_libraries(main ${Xenomai_${lib}_LIBRARY_DIRS} ${Xenomai_${lib}_LIBRARIES})
|
|
||||||
set_target_properties(main PROPERTIES LINK_FLAGS ${Xenomai_${lib}_LDFLAGS})
|
|
||||||
target_compile_definitions(main PRIVATE ${Xenomai_${lib}_DEFINITIONS})
|
|
||||||
endforeach ()
|
|
|
@ -1,58 +0,0 @@
|
||||||
############################################################
|
|
||||||
# Returns the definitions and includes from a cflags output
|
|
||||||
#
|
|
||||||
# _list cflags var
|
|
||||||
# _includes return var with the Includes
|
|
||||||
# _definitions return var with the Definitions
|
|
||||||
function(PARSE_CFLAGS _list _includes _definitions)
|
|
||||||
|
|
||||||
separate_arguments(${_list})
|
|
||||||
foreach (_item ${${_list}})
|
|
||||||
if ("${_item}" MATCHES "^-I")
|
|
||||||
string(SUBSTRING ${_item} 2 -1 _item_t)
|
|
||||||
set(_includes_t ${_includes_t} ${_item_t})
|
|
||||||
else ("${_item}" MATCHES "^-I")
|
|
||||||
set(_definitions_t ${_definitions_t} ${_item})
|
|
||||||
endif ("${_item}" MATCHES "^-I")
|
|
||||||
endforeach (_item)
|
|
||||||
|
|
||||||
string(REPLACE ";" " " _definitions_k "${_definitions_t}")
|
|
||||||
|
|
||||||
set(${_includes} ${_includes_t} PARENT_SCOPE)
|
|
||||||
set(${_definitions} ${_definitions_k} PARENT_SCOPE)
|
|
||||||
|
|
||||||
#message(STATUS "Calling Macro ${${_list}} and returning ${_includes_k} and ${_definitions_k}")
|
|
||||||
endfunction(PARSE_CFLAGS)
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Retrieve information from a ldflags output
|
|
||||||
#
|
|
||||||
# _list ldflags var
|
|
||||||
# _libraries return var with the libraries
|
|
||||||
# _ldflags return var with the ldflags value
|
|
||||||
# _libdir return var with the libdir value
|
|
||||||
function(PARSE_LDFLAGS _list _libraries _ldflags _libdir)
|
|
||||||
|
|
||||||
separate_arguments(${_list})
|
|
||||||
foreach (_item ${${_list}})
|
|
||||||
if ("${_item}" MATCHES "^-l")
|
|
||||||
string(SUBSTRING ${_item} 2 -1 _item_t)
|
|
||||||
set(_libraries_t ${_libraries_t} ${_item_t})
|
|
||||||
elseif ("${_item}" MATCHES "^-L")
|
|
||||||
set(_libdir_t ${_libdir_t} ${_item})
|
|
||||||
else ("${_item}" MATCHES "^-L")
|
|
||||||
set(_ldflags_t ${_ldflags_t} ${_item})
|
|
||||||
endif ("${_item}" MATCHES "^-l")
|
|
||||||
endforeach (_item ${${_list}})
|
|
||||||
|
|
||||||
string(REPLACE ";" " " _ldflags_k "${_ldflags_t}")
|
|
||||||
string(REPLACE ";" " " _libdir_k "${_libdir_t}")
|
|
||||||
|
|
||||||
set(${_libraries} ${_libraries_t} PARENT_SCOPE)
|
|
||||||
set(${_ldflags} ${_ldflags_k} PARENT_SCOPE)
|
|
||||||
set(${_libdir} ${_libdir_k} PARENT_SCOPE)
|
|
||||||
|
|
||||||
#message(STATUS "Calling Macro ${${_list}} and returning ${_libraries_k} ${_ldflags_k} ${_libdir_k}")
|
|
||||||
endfunction(PARSE_LDFLAGS)
|
|
|
@ -1,28 +0,0 @@
|
||||||
# Find the kernel release
|
|
||||||
execute_process(
|
|
||||||
COMMAND uname -r
|
|
||||||
OUTPUT_VARIABLE KERNEL_RELEASE
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
|
|
||||||
# Find the headers
|
|
||||||
find_path(KERNELHEADERS_DIR
|
|
||||||
include/linux/user.h
|
|
||||||
PATHS /usr/src/linux-headers-${KERNEL_RELEASE}
|
|
||||||
)
|
|
||||||
|
|
||||||
message(STATUS "Kernel release: ${KERNEL_RELEASE}")
|
|
||||||
message(STATUS "Kernel headers: ${KERNELHEADERS_DIR}")
|
|
||||||
|
|
||||||
if (KERNELHEADERS_DIR)
|
|
||||||
set(KERNELHEADERS_INCLUDE_DIRS
|
|
||||||
${KERNELHEADERS_DIR}/include
|
|
||||||
${KERNELHEADERS_DIR}/arch/x86/include
|
|
||||||
CACHE PATH "Kernel headers include dirs"
|
|
||||||
)
|
|
||||||
set(KERNELHEADERS_FOUND 1 CACHE STRING "Set to 1 if kernel headers were found")
|
|
||||||
else (KERNELHEADERS_DIR)
|
|
||||||
set(KERNELHEADERS_FOUND 0 CACHE STRING "Set to 1 if kernel headers were found")
|
|
||||||
endif (KERNELHEADERS_DIR)
|
|
||||||
|
|
||||||
mark_as_advanced(KERNELHEADERS_FOUND)
|
|
|
@ -1,253 +0,0 @@
|
||||||
###############################################################################
|
|
||||||
#
|
|
||||||
# CMake script for finding the Xenomai Libraries and skins
|
|
||||||
#
|
|
||||||
# Copyright 2015-2018 Leopold Palomo-Avellaneda <leopold.palomo@upc.edu>
|
|
||||||
# Copyright 2016-2018 Institute of Industrial and Control Engineering (IOC)
|
|
||||||
# Universitat Politecnica de Catalunya
|
|
||||||
# BarcelonaTech
|
|
||||||
# Redistribution and use is allowed according to the terms of the 3-clause BSD
|
|
||||||
# license.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Input variables:
|
|
||||||
#
|
|
||||||
# Cache variables (not intended to be used in CMakeLists.txt files)
|
|
||||||
# Input variables:
|
|
||||||
#
|
|
||||||
# - ${Xenomai_ROOT_DIR} (optional): Used as a hint to find the Xenomai root dir
|
|
||||||
# - $ENV{XENOMAI_ROOT_DIR} (optional): Used as a hint to find the Xenomai root dir
|
|
||||||
#
|
|
||||||
# Output Variables:
|
|
||||||
#
|
|
||||||
# - Xenomai_FOUND: Boolean that indicates if the package was found. Default is Native
|
|
||||||
# - Xenomai_SKINS: List of the available skins.
|
|
||||||
# The availabe skins are for 2.6: NATIVE POSIX PSOS RTDM UITRON VRTX VXWORKS
|
|
||||||
# The availabe skins are for 3.x: POSIX ALCHEMY RTDM PSOS VXWORKS SMOKEY COBALT NATIVE
|
|
||||||
# NATIVE for compatibility purpose
|
|
||||||
# - Xenomai_*_FOUND variables below for individual skins.
|
|
||||||
# - Xenomai_VERSION: major.minor.patch Xenomai version string
|
|
||||||
# - Xenomai_XENO_CONFIG: Path to xeno-config program
|
|
||||||
#
|
|
||||||
# For each available skin, theses Var are set:
|
|
||||||
# - Xenomai_${SKIN}_FOUND: Boolean that indicates if the skin was found
|
|
||||||
# - Xenomai_${SKIN}_DEFINITIONS
|
|
||||||
# - Xenomai_${SKIN}_INCLUDE_DIRS
|
|
||||||
# - Xenomai_${SKIN}_LIBRARY_DIRS
|
|
||||||
# - Xenomai_${SKIN}_LIBRARIES
|
|
||||||
# - Xenomai_${SKIN}_LDFLAGS
|
|
||||||
# - Xenomai_${SKIN}_DL_FLAGS # Direct Linker Flags
|
|
||||||
# From Xenomai 3.0.2. If you want to build a shared library
|
|
||||||
# - Xenomai_${SKIN}_LDFLAGS_LIBRARIES
|
|
||||||
# - Xenomai_${SKIN}_DL_FLAGS_LIBRARIES
|
|
||||||
#
|
|
||||||
# Specific var for compatibility with Johns Hopkins University (JHU) FindXenomai
|
|
||||||
#
|
|
||||||
# - Individual library variables:
|
|
||||||
# - Xenomai_LIBRARY_XENOMAI
|
|
||||||
# - Xenomai_LIBRARY_NATIVE
|
|
||||||
# - Xenomai_LIBRARY_PTHREAD_RT
|
|
||||||
# - Xenomai_LIBRARY_RTDM
|
|
||||||
# - Xenomai_LIBRARY_RTDK ( this will be empty, deprecated after Xenomai 2.6.0)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Example usage:
|
|
||||||
#
|
|
||||||
# find_package(Xenomai 2.6.4 REQUIRED POSIX)
|
|
||||||
# message(STATUS "Xenomai found with theses skins: ${Xenomai_SKINS}")
|
|
||||||
# # You have some sources xeno-example ${XENO_EXAMPLE_SRC}
|
|
||||||
#
|
|
||||||
# include_directories(${Xenomai_POSIX_INCLUDE_DIR})
|
|
||||||
# add_executable(demo_xeno ${XENO_EXAMPLE_SRC})
|
|
||||||
# target_link_libraries(demo_xeno ${Xenomai_POSIX_LIBRARY_DIRS} ${Xenomai_POSIX_LIBRARIES})
|
|
||||||
# set_target_properties(demo_xeno PROPERTIES
|
|
||||||
# LINK_FLAGS ${Xenomai_POSIX_LDFLAGS})
|
|
||||||
# target_compile_definitions(demo_xeno PUBLIC ${Xenomai_POSIX_DEFINITIONS})
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Returns the definitions and includes from a cflags output
|
|
||||||
#
|
|
||||||
# _list cflags var
|
|
||||||
# _includes return var with the Includes
|
|
||||||
# _definitions return var with the Definitions
|
|
||||||
function(PARSE_CFLAGS _list _includes _definitions)
|
|
||||||
|
|
||||||
separate_arguments(${_list})
|
|
||||||
foreach (_item ${${_list}})
|
|
||||||
if ("${_item}" MATCHES "^-I")
|
|
||||||
string(SUBSTRING ${_item} 2 -1 _item_t)
|
|
||||||
set(_includes_t ${_includes_t} ${_item_t})
|
|
||||||
else ("${_item}" MATCHES "^-I")
|
|
||||||
set(_definitions_t ${_definitions_t} ${_item})
|
|
||||||
endif ("${_item}" MATCHES "^-I")
|
|
||||||
endforeach (_item)
|
|
||||||
|
|
||||||
string(REPLACE ";" " " _definitions_k "${_definitions_t}")
|
|
||||||
|
|
||||||
set(${_includes} ${_includes_t} PARENT_SCOPE)
|
|
||||||
set(${_definitions} ${_definitions_k} PARENT_SCOPE)
|
|
||||||
|
|
||||||
#message(STATUS "Calling Macro ${${_list}} and returning ${_includes_k} and ${_definitions_k}")
|
|
||||||
endfunction(PARSE_CFLAGS)
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Retrieve information from a ldflags output
|
|
||||||
#
|
|
||||||
# _list ldflags var
|
|
||||||
# _libraries return var with the libraries
|
|
||||||
# _ldflags return var with the ldflags value
|
|
||||||
# _libdir return var with the libdir value
|
|
||||||
# _dlflags return var with the direct output
|
|
||||||
|
|
||||||
function(PARSE_LDFLAGS _list _libraries _ldflags _libdir _dlflags)
|
|
||||||
separate_arguments(${_list})
|
|
||||||
foreach (_item ${${_list}})
|
|
||||||
if ("${_item}" MATCHES "^-l")
|
|
||||||
string(SUBSTRING ${_item} 2 -1 _item_t)
|
|
||||||
set(_libraries_t ${_libraries_t} ${_item_t})
|
|
||||||
elseif ("${_item}" MATCHES "^-L")
|
|
||||||
set(_libdir_t ${_libdir_t} ${_item})
|
|
||||||
else ("${_item}" MATCHES "^-L")
|
|
||||||
set(_ldflags_t ${_ldflags_t} ${_item})
|
|
||||||
endif ("${_item}" MATCHES "^-l")
|
|
||||||
endforeach (_item ${${_list}})
|
|
||||||
|
|
||||||
string(REPLACE ";" " " _ldflags_k "${_ldflags_t}")
|
|
||||||
string(REPLACE ";" " " _libdir_k "${_libdir_t}")
|
|
||||||
string(REPLACE ";" " " _dlflags_t "${${_list}}")
|
|
||||||
|
|
||||||
set(${_libraries} ${_libraries_t} PARENT_SCOPE)
|
|
||||||
set(${_ldflags} ${_ldflags_k} PARENT_SCOPE)
|
|
||||||
set(${_libdir} ${_libdir_k} PARENT_SCOPE)
|
|
||||||
set(${_dlflags} ${_dlflags_t} PARENT_SCOPE)
|
|
||||||
|
|
||||||
#message(STATUS "Calling Macro ${${_list}} and returning ${_libraries_k} ${_ldflags_k} ${_libdir_k}")
|
|
||||||
endfunction(PARSE_LDFLAGS)
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
if (Xenomai_FIND_COMPONENTS)
|
|
||||||
# if components specified in find_package(), make sure each of those pieces were found
|
|
||||||
set(_XENOMAI_FOUND_REQUIRED_VARS)
|
|
||||||
foreach (component ${Xenomai_FIND_COMPONENTS})
|
|
||||||
string(TOUPPER ${component} _COMPONENT)
|
|
||||||
set(_XENOMAI_FOUND_REQUIRED_VARS ${_XENOMAI_FOUND_REQUIRED_VARS} Xenomai_${_COMPONENT}_INCLUDE_DIRS Xenomai_${_COMPONENT}_LIBRARIES)
|
|
||||||
endforeach ()
|
|
||||||
else ()
|
|
||||||
# if no components specified, we'll make a default set of required variables to say Qt is found
|
|
||||||
set(_XENOMAI_FOUND_REQUIRED_VARS Xenomai_XENO_CONFIG Xenomai_VERSION Xenomai_NATIVE_INCLUDE_DIRS Xenomai_NATIVE_LIBRARIES)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Get hint from environment variable (if any)
|
|
||||||
if (NOT $ENV{XENOMAI_ROOT_DIR} STREQUAL "")
|
|
||||||
set(XENOMAI_ROOT_DIR $ENV{XENOMAI_ROOT_DIR} CACHE PATH "Xenomai base directory location (optional, used for nonstandard installation paths)" FORCE)
|
|
||||||
mark_as_advanced(XENOMAI_ROOT_DIR)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (DEFINED ENV{SDKTARGETSYSROOT} AND NOT DEFINED Xenomai_ROOT_DIR)
|
|
||||||
message("Found $SDKTARGETSYSROOT = $ENV{SDKTARGETSYSROOT}, using as Xenomai_ROOT_DIR and settings DESTDIR")
|
|
||||||
set(Xenomai_ROOT_DIR "$ENV{SDKTARGETSYSROOT}")
|
|
||||||
SET(ENV{DESTDIR} $ENV{SDKTARGETSYSROOT})
|
|
||||||
endif ()
|
|
||||||
# set the search paths
|
|
||||||
set(Xenomai_SEARCH_PATH ${Xenomai_ROOT_DIR})
|
|
||||||
|
|
||||||
# searching kernel headers
|
|
||||||
# Find kernel headers
|
|
||||||
find_package(KernelHeaders)
|
|
||||||
|
|
||||||
find_path(Xenomai_KERNEL_INCLUDE_DIR version.h
|
|
||||||
PATHS ${KERNELHEADERS_DIR}/include/xenomai/)
|
|
||||||
|
|
||||||
if (Xenomai_KERNEL_INCLUDE_DIR)
|
|
||||||
message(STATUS "Xenomai Kernel Headers located in ${Xenomai_KERNEL_INCLUDE_DIR}")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
# Find xeno-config
|
|
||||||
# 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)
|
|
||||||
set(Xenomai_FOUND ${Xenomai_XENO_CONFIG})
|
|
||||||
execute_process(COMMAND ${Xenomai_XENO_CONFIG} --version OUTPUT_VARIABLE Xenomai_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
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")
|
|
||||||
message(STATUS "xeno-config has the --auto-init-solib option")
|
|
||||||
endif ()
|
|
||||||
if (${Xenomai_VERSION} VERSION_LESS "3.0.0")
|
|
||||||
set(SKINS native posix psos rtdm uitron vrtx vxworks)
|
|
||||||
else (${Xenomai_VERSION} VERSION_LESS "3.0.0")
|
|
||||||
set(SKINS posix vxworks psos alchemy rtdm smokey cobalt native)
|
|
||||||
# From xeno-config manual
|
|
||||||
# --native and --skin=native are accepted for backward compatibility purpose. They are stricly equivalent to passing --alchemy --compat.
|
|
||||||
# Likewise, passing --rtdm or --skin=rtdm is stricly equivalent to passing --posix, enabling POSIX I/O routines to be wrapped to their
|
|
||||||
# respective Xenomai implementation.
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
foreach (_skin ${SKINS})
|
|
||||||
#message(STATUS "Processing skin ${_skin} ........")
|
|
||||||
string(TOUPPER ${_skin} SKINU)
|
|
||||||
|
|
||||||
execute_process(COMMAND ${Xenomai_XENO_CONFIG} --skin "${_skin}" --cflags OUTPUT_VARIABLE XENO_${SKINU}_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
PARSE_CFLAGS("XENO_${SKINU}_CFLAGS" "Xenomai_${SKINU}_INCLUDE_DIRS" "Xenomai_${SKINU}_DEFINITIONS")
|
|
||||||
#message(STATUS "Xenomai_${SKINU}_INCLUDE_DIRS = ${Xenomai_${SKINU}_INCLUDE_DIRS}")
|
|
||||||
#message(STATUS "Xenomai_${SKINU}_DEFINITIONS = ${Xenomai_${SKINU}_DEFINITIONS}")
|
|
||||||
|
|
||||||
execute_process(COMMAND ${Xenomai_XENO_CONFIG} --skin ${_skin} --ldflags OUTPUT_VARIABLE XENO_${SKINU}_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
PARSE_LDFLAGS("XENO_${SKINU}_LDFLAGS" "Xenomai_${SKINU}_LIBRARIES" "Xenomai_${SKINU}_LDFLAGS" "Xenomai_${SKINU}_LIBRARY_DIRS" "Xenomai_${SKINU}_DL_FLAGS")
|
|
||||||
#message(STATUS "Xenomai_${SKINU}_LIBRARIES = ${Xenomai_${SKINU}_LIBRARIES}")
|
|
||||||
#message(STATUS "Xenomai_${SKINU}_DIRS = ${Xenomai_${SKINU}_LIBRARY_DIRS}")
|
|
||||||
#message(STATUS "Xenomai_${SKINU}_LDFLAGS = ${Xenomai_${SKINU}_LDFLAGS}")
|
|
||||||
|
|
||||||
if (${Xenomai_VERSION} VERSION_GREATER "3.0.2")
|
|
||||||
#message(STATUS "xeno-config has the --auto-init-solib option")
|
|
||||||
execute_process(COMMAND ${Xenomai_XENO_CONFIG} --skin ${_skin} --auto-init-solib --ldflags OUTPUT_VARIABLE XENO_${SKINU}_LDFLAGS_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
PARSE_LDFLAGS("XENO_${SKINU}_LDFLAGS_LIBRARIES" "Xenomai_${SKINU}_LIBRARIES" "Xenomai_${SKINU}_LDFLAGS_LIBRARIES" "Xenomai_${SKINU}_LIBRARY_DIRS" "Xenomai_${SKINU}_DL_FLAGS_LIBRARIES")
|
|
||||||
endif ()
|
|
||||||
if (Xenomai_${SKINU}_LIBRARIES AND Xenomai_${SKINU}_INCLUDE_DIRS)
|
|
||||||
set(Xenomai_${SKINU}_FOUND TRUE)
|
|
||||||
set(Xenomai_SKINS ${Xenomai_SKINS} ${_skin})
|
|
||||||
#message(STATUS "Xenomai ${_skin} skin found")
|
|
||||||
set(Xenomai_${SKINU}_FOUND ${Xenomai_${SKINU}_FOUND} CACHE STRING "Xenomai ${SKINU} Found" FORCE)
|
|
||||||
set(Xenomai_${SKINU}_DEFINITIONS ${Xenomai_${SKINU}_DEFINITIONS} CACHE STRING "Xenomai ${SKINU} skin definitions" FORCE)
|
|
||||||
set(Xenomai_${SKINU}_INCLUDE_DIRS ${Xenomai_${SKINU}_INCLUDE_DIRS} CACHE STRING "Xenomai ${SKINU} include directories" FORCE)
|
|
||||||
set(Xenomai_${SKINU}_LIBRARY_DIRS ${Xenomai_${SKINU}_LIBRARY_DIRS} CACHE STRING "Xenomai ${SKINU} library directories" FORCE)
|
|
||||||
set(Xenomai_${SKINU}_LIBRARIES ${Xenomai_${SKINU}_LIBRARIES} CACHE STRING "Xenomai ${SKINU} libraries" FORCE)
|
|
||||||
set(Xenomai_${SKINU}_LDFLAGS ${Xenomai_${SKINU}_LDFLAGS} CACHE STRING "Xenomai ${SKINU} ldflags" FORCE)
|
|
||||||
set(Xenomai_${SKINU}_DL_FLAGS ${Xenomai_${SKINU}_DL_FLAGS} CACHE STRING "Xenomai ${SKINU} Direct linker flags" FORCE)
|
|
||||||
if (${Xenomai_VERSION} VERSION_GREATER "3.0.2")
|
|
||||||
set(Xenomai_${SKINU}_LDFLAGS_LIBRARIES ${Xenomai_${SKINU}_LDFLAGS_LIBRARIES} CACHE STRING "Xenomai ${SKINU} ldflags for libraries" FORCE)
|
|
||||||
set(Xenomai_${SKINU}_DL_FLAGS_LIBRARIES ${Xenomai_${SKINU}_DL_FLAGS_LIBRARIES} CACHE STRING "Xenomai ${SKINU} Direct linker flags for libraries" FORCE)
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
endforeach (_skin ${SKINS})
|
|
||||||
set(Xenomai_KERNEL_INCLUDE_DIR ${Xenomai_KERNEL_INCLUDE_DIR} CACHE STRING "Xenomai Kernel Headers directory " FORCE)
|
|
||||||
|
|
||||||
find_library(Xenomai_LIBRARY_NATIVE native ${Xenomai_ROOT_DIR}/lib)
|
|
||||||
find_library(Xenomai_LIBRARY_XENOMAI xenomai ${Xenomai_ROOT_DIR}/lib)
|
|
||||||
find_library(Xenomai_LIBRARY_PTHREAD_RT pthread_rt ${Xenomai_ROOT_DIR}/lib)
|
|
||||||
find_library(Xenomai_LIBRARY_RTDM rtdm ${Xenomai_ROOT_DIR}/lib)
|
|
||||||
|
|
||||||
# In 2.6.0 RTDK was merged into the main xenomai library
|
|
||||||
if (Xenomai_VERSION VERSION_GREATER 2.6.0)
|
|
||||||
set(Xenomai_LIBRARY_RTDK_FOUND ${Xenomai_LIBRARY_XENOMAI_FOUND})
|
|
||||||
set(Xenomai_LIBRARY_RTDK ${Xenomai_LIBRARY_XENOMAI})
|
|
||||||
else ()
|
|
||||||
find_library(Xenomai_LIBRARY_RTDK rtdk ${Xenomai_ROOT_DIR}/lib)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
find_package_handle_standard_args(Xenomai REQUIRED_VARS ${_XENOMAI_FOUND_REQUIRED_VARS}
|
|
||||||
VERSION_VAR Xenomai_VERSION
|
|
||||||
HANDLE_COMPONENTS)
|
|
||||||
else (Xenomai_XENO_CONFIG)
|
|
||||||
message(FATAL_ERROR "This program needs xeno-config")
|
|
||||||
endif ()
|
|
||||||
|
|
BIN
software/raspberry/superviseur-robot/dist/Debug/GNU-Linux/superviseur
vendored
Executable file
BIN
software/raspberry/superviseur-robot/dist/Debug/GNU-Linux/superviseur
vendored
Executable file
Binary file not shown.
BIN
software/raspberry/superviseur-robot/dist/Debug/GNU-Linux/superviseur-robot
vendored
Executable file
BIN
software/raspberry/superviseur-robot/dist/Debug/GNU-Linux/superviseur-robot
vendored
Executable file
Binary file not shown.
BIN
software/raspberry/superviseur-robot/dist/Debug__Pthread_/GNU-Linux/superviseur-robot
vendored
Executable file
BIN
software/raspberry/superviseur-robot/dist/Debug__Pthread_/GNU-Linux/superviseur-robot
vendored
Executable file
Binary file not shown.
BIN
software/raspberry/superviseur-robot/dist/Debug__Pthread__RPI/GNU-Linux/superviseur-robot
vendored
Normal file
BIN
software/raspberry/superviseur-robot/dist/Debug__Pthread__RPI/GNU-Linux/superviseur-robot
vendored
Normal file
Binary file not shown.
|
@ -34,12 +34,12 @@ Camera::Camera():Camera(sm, 10){
|
||||||
* @param fps speed of sampling
|
* @param fps speed of sampling
|
||||||
*/
|
*/
|
||||||
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);
|
this->cap.set(CV_CAP_PROP_FORMAT, CV_8UC3);
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
|
this->cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
|
this->cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
|
||||||
this->cap.set(CV_CAP_PROP_FPS, fps);
|
this->cap.set(CV_CAP_PROP_FPS, fps);
|
||||||
#endif /* __FOR_PC__ */
|
#endif /* __FOR_PC__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,34 +48,34 @@ Camera::Camera(int size, int fps) {
|
||||||
* @return True if camera is open, false otherwise
|
* @return True if camera is open, false otherwise
|
||||||
*/
|
*/
|
||||||
bool Camera::Open() {
|
bool Camera::Open() {
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
#ifdef __FOR_PC__
|
#ifdef __FOR_PC__
|
||||||
if (this->cap.open(0)) {
|
if (this->cap.open(0)) {
|
||||||
//this->cap.set(CV_CAP_PROP_FORMAT, CV_8UC3);
|
//this->cap.set(CV_CAP_PROP_FORMAT, CV_8UC3);
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
|
this->cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
|
||||||
this->cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
|
this->cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
|
||||||
|
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (this->cap.open()) {
|
if (this->cap.open()) {
|
||||||
cout << "Camera warmup 2sec" << endl << flush;
|
cout << "Camera warmup 2sec" << endl << flush;
|
||||||
sleep(2);
|
sleep(2);
|
||||||
cout << "Start capture" << endl << flush;
|
cout << "Start capture" << endl << flush;
|
||||||
|
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
#endif /* __FOR_PC__ */
|
#endif /* __FOR_PC__ */
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close and release camera
|
* Close and release camera
|
||||||
*/
|
*/
|
||||||
void Camera::Close() {
|
void Camera::Close() {
|
||||||
this->cap.release();
|
this->cap.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,23 +113,23 @@ void Camera::SetSize(int size) {
|
||||||
* @return Image taken from camera
|
* @return Image taken from camera
|
||||||
*/
|
*/
|
||||||
Img Camera::Grab() {
|
Img Camera::Grab() {
|
||||||
ImageMat frame;
|
ImageMat frame;
|
||||||
|
|
||||||
#ifdef __FOR_PC__
|
#ifdef __FOR_PC__
|
||||||
cap >> frame;
|
cap >> frame;
|
||||||
Img capture = Img(frame);
|
Img capture = Img(frame);
|
||||||
#else
|
#else
|
||||||
cap.grab();
|
cap.grab();
|
||||||
cap.retrieve(frame);
|
cap.retrieve(frame);
|
||||||
|
|
||||||
#ifdef __INVERSE_COLOR__
|
#ifdef __INVERSE_COLOR__
|
||||||
cvtColor(frame, frame, CV_BGR2RGB);
|
cvtColor(frame, frame, CV_BGR2RGB);
|
||||||
#endif // __INVERSE_COLOR__
|
#endif // __INVERSE_COLOR__
|
||||||
|
|
||||||
Img capture = Img(frame);
|
Img capture = Img(frame);
|
||||||
#endif /* __FOR_PC__ */
|
#endif /* __FOR_PC__ */
|
||||||
|
|
||||||
return capture;
|
return capture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +137,7 @@ 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();
|
return cap.isOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -80,38 +80,38 @@ public:
|
||||||
* @return true if camera is open, false otherwise
|
* @return true if camera is open, false otherwise
|
||||||
*/
|
*/
|
||||||
bool IsOpen();
|
bool IsOpen();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define size for sampled picture
|
||||||
|
* @param size Size of picture (@see captureSize)
|
||||||
|
*/
|
||||||
|
void SetSize(int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define size for sampled picture
|
* Grab next image from camera
|
||||||
* @param size Size of picture (@see captureSize)
|
* @return Image taken from camera
|
||||||
*/
|
*/
|
||||||
void SetSize(int size);
|
Img Grab();
|
||||||
|
|
||||||
/**
|
|
||||||
* Grab next image from camera
|
|
||||||
* @return Image taken from camera
|
|
||||||
*/
|
|
||||||
Img Grab();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef __FOR_PC__
|
#ifdef __FOR_PC__
|
||||||
/**
|
/**
|
||||||
* Camera descriptor
|
* Camera descriptor
|
||||||
*/
|
*/
|
||||||
cv::VideoCapture cap;
|
cv::VideoCapture cap;
|
||||||
#else
|
#else
|
||||||
raspicam::RaspiCam_Cv cap;
|
raspicam::RaspiCam_Cv cap;
|
||||||
#endif /* __FOR_PC__ */
|
#endif /* __FOR_PC__ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size for image (default= small)
|
* Size for image (default= small)
|
||||||
*/
|
*/
|
||||||
int size = sm;
|
int size = sm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Width of image
|
* Width of image
|
||||||
*/
|
*/
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Height of image
|
* Height of image
|
||||||
|
|
|
@ -26,15 +26,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#ifdef __SIMULATION__
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
int sock = 0;
|
|
||||||
string host = "127.0.0.1";
|
|
||||||
#define PORT 6699
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __FOR_PC__
|
#ifdef __FOR_PC__
|
||||||
#define USART_FILENAME "/dev/ttyUSB0"
|
#define USART_FILENAME "/dev/ttyUSB0"
|
||||||
#else
|
#else
|
||||||
|
@ -80,33 +71,6 @@ int ComRobot::Open() {
|
||||||
int ComRobot::Open(string usart) {
|
int ComRobot::Open(string usart) {
|
||||||
struct termios options;
|
struct termios options;
|
||||||
|
|
||||||
#ifdef __SIMULATION__
|
|
||||||
|
|
||||||
struct sockaddr_in serv_addr;
|
|
||||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
|
||||||
printf("\n Socket creation error \n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
struct timeval tv;
|
|
||||||
tv.tv_sec = 0;
|
|
||||||
tv.tv_usec = 200000;
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*) &tv, sizeof tv);
|
|
||||||
|
|
||||||
serv_addr.sin_family = AF_INET;
|
|
||||||
serv_addr.sin_port = htons(PORT);
|
|
||||||
|
|
||||||
// Convert IPv4 and IPv6 addresses from text to binary form
|
|
||||||
if (inet_pton(AF_INET, host.c_str(), &serv_addr.sin_addr) <= 0) {
|
|
||||||
printf("\nInvalid address/ Address not supported \n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connect(sock, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
#else
|
|
||||||
|
|
||||||
fd = open(usart.c_str(), O_RDWR | O_NOCTTY /*| O_NDELAY*/); //Open in blocking read/write mode
|
fd = open(usart.c_str(), O_RDWR | O_NOCTTY /*| O_NDELAY*/); //Open in blocking read/write mode
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
cerr << "[" << __PRETTY_FUNCTION__ << "] Unable to open UART (" << usart << "). Ensure it is not in use by another application" << endl << flush;
|
cerr << "[" << __PRETTY_FUNCTION__ << "] Unable to open UART (" << usart << "). Ensure it is not in use by another application" << endl << flush;
|
||||||
|
@ -124,37 +88,6 @@ int ComRobot::Open(string usart) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int ComRobot::Open(string shost, int nport) {
|
|
||||||
#ifdef __SIMULATION__
|
|
||||||
|
|
||||||
struct sockaddr_in serv_addr;
|
|
||||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
|
||||||
printf("\n Socket creation error \n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
struct timeval tv;
|
|
||||||
tv.tv_sec = 0;
|
|
||||||
tv.tv_usec = 200000;
|
|
||||||
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*) &tv, sizeof tv);
|
|
||||||
|
|
||||||
serv_addr.sin_family = AF_INET;
|
|
||||||
serv_addr.sin_port = htons(nport);
|
|
||||||
|
|
||||||
if (inet_pton(AF_INET, shost.c_str(), &serv_addr.sin_addr) <= 0) {
|
|
||||||
cout << "Invalid address/ Address not supported" << endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connect(sock, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
#else
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,11 +95,7 @@ int ComRobot::Open(string shost, int nport) {
|
||||||
* @return Success if above 0, failure if below 0
|
* @return Success if above 0, failure if below 0
|
||||||
*/
|
*/
|
||||||
int ComRobot::Close() {
|
int ComRobot::Close() {
|
||||||
#ifdef __SIMULATION__
|
|
||||||
return close(sock);
|
|
||||||
#else
|
|
||||||
return close(fd);
|
return close(fd);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,28 +115,6 @@ Message *ComRobot::Write(Message* msg) {
|
||||||
Write_Pre();
|
Write_Pre();
|
||||||
|
|
||||||
s = MessageToString(msg);
|
s = MessageToString(msg);
|
||||||
#ifdef __SIMULATION__
|
|
||||||
s += "\r";
|
|
||||||
|
|
||||||
char buffer[1024] = {0};
|
|
||||||
cout << "[" << __PRETTY_FUNCTION__ << "] Send command: " << s << endl << flush;
|
|
||||||
send(sock, s.c_str(), s.length(), MSG_NOSIGNAL);
|
|
||||||
|
|
||||||
int valread = read(sock, buffer, 1024);
|
|
||||||
|
|
||||||
if (valread == 0) {
|
|
||||||
cout << "The communication is out of order" << endl;
|
|
||||||
msgAnswer = new Message(MESSAGE_ANSWER_COM_ERROR);
|
|
||||||
} else if (valread < 0) {
|
|
||||||
cout << "Timeout" << endl;
|
|
||||||
msgAnswer = new Message(MESSAGE_ANSWER_ROBOT_TIMEOUT);
|
|
||||||
} else {
|
|
||||||
string s(&buffer[0], valread);
|
|
||||||
msgAnswer = StringToMessage(s);
|
|
||||||
cout << "Response: " << buffer << ", id: " << msgAnswer->GetID() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
AddChecksum(s);
|
AddChecksum(s);
|
||||||
|
|
||||||
//cout << "[" <<__PRETTY_FUNCTION__<<"] Send command: "<<s<<endl<<flush;
|
//cout << "[" <<__PRETTY_FUNCTION__<<"] Send command: "<<s<<endl<<flush;
|
||||||
|
@ -236,7 +143,6 @@ Message *ComRobot::Write(Message* msg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
cerr << __PRETTY_FUNCTION__ << ": Com port not open" << endl << flush;
|
cerr << __PRETTY_FUNCTION__ << ": Com port not open" << endl << flush;
|
||||||
throw std::runtime_error{"Com port not open"};
|
throw std::runtime_error{"Com port not open"};
|
||||||
|
|
|
@ -59,14 +59,6 @@ public:
|
||||||
*/
|
*/
|
||||||
int Open(string usart);
|
int Open(string usart);
|
||||||
|
|
||||||
/**
|
|
||||||
* Open tcp client for the graphical simulator
|
|
||||||
* @param host Host address
|
|
||||||
* @param port Port number
|
|
||||||
* @return 1 if ok or -1
|
|
||||||
*/
|
|
||||||
int Open(string shost, int nport);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close serial link
|
* Close serial link
|
||||||
* @return Success if above 0, failure if below 0
|
* @return Success if above 0, failure if below 0
|
||||||
|
@ -97,9 +89,9 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void Write_Post() {
|
virtual void Write_Post() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Message *SendCommand(Message* msg, MessageID answerID, int maxRetries);
|
Message *SendCommand(Message* msg, MessageID answerID, int maxRetries);
|
||||||
|
|
||||||
static Message *Ping() {
|
static Message *Ping() {
|
||||||
return new Message(MESSAGE_ROBOT_PING);
|
return new Message(MESSAGE_ROBOT_PING);
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,23 +234,23 @@ std::list<Position> Img::SearchRobot(Arena arena) {
|
||||||
* @return Arena object with coordinate of outline, empty if no arena found
|
* @return Arena object with coordinate of outline, empty if no arena found
|
||||||
*/
|
*/
|
||||||
Arena Img::SearchArena() {
|
Arena Img::SearchArena() {
|
||||||
std::vector<std::vector<cv::Point> > contours;
|
std::vector<std::vector<cv::Point> > contours;
|
||||||
std::vector<cv::Point> approx;
|
std::vector<cv::Point> approx;
|
||||||
std::vector<cv::Vec4i> hierarchy;
|
std::vector<cv::Vec4i> hierarchy;
|
||||||
|
|
||||||
ImageMat imageTrt;
|
ImageMat imageTrt;
|
||||||
cv::cvtColor(this->img, imageTrt, CV_RGB2GRAY); // conversion en niveau de gris
|
cv::cvtColor(this->img, imageTrt, CV_RGB2GRAY); // conversion en niveau de gris
|
||||||
cv::threshold(imageTrt, imageTrt, 128, 255, CV_THRESH_BINARY); // Threshold les éléments les plus clair
|
cv::threshold(imageTrt, imageTrt, 128, 255, CV_THRESH_BINARY); // Threshold les éléments les plus clair
|
||||||
cv::Canny(imageTrt, imageTrt, 100, 200, 3); // detection d'angle
|
cv::Canny(imageTrt, imageTrt, 100, 200, 3); // detection d'angle
|
||||||
|
|
||||||
findContours(imageTrt, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cv::Point(0, 0));
|
findContours(imageTrt, 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++) {
|
||||||
approxPolyDP(ImageMat(contours[i]), approx, cv::arcLength(ImageMat(contours[i]), true) * 0.1, true);
|
approxPolyDP(ImageMat(contours[i]), approx, cv::arcLength(ImageMat(contours[i]), true)*0.1, true);
|
||||||
if (approx.size() == 4 && fabs(cv::contourArea(contours[i])) > 100000) {
|
if (approx.size() == 4 && fabs(cv::contourArea(contours[i])) > 100000) {
|
||||||
Arena rectangle;
|
Arena rectangle;
|
||||||
rectangle.arena = cv::boundingRect(ImageMat(contours[i]));
|
rectangle.arena = cv::boundingRect(ImageMat(contours[i]));
|
||||||
return rectangle;
|
return rectangle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Arena();
|
return Arena();
|
||||||
|
|
|
@ -59,8 +59,7 @@ FFLAGS=
|
||||||
ASFLAGS=
|
ASFLAGS=
|
||||||
|
|
||||||
# Link Libraries and Options
|
# Link Libraries and Options
|
||||||
LDLIBSOPTIONS=`pkg-config --libs opencv4`
|
LDLIBSOPTIONS=`pkg-config --libs opencv`
|
||||||
LDFLAGSOPTIONS=`pkg-config --cflags opencv4`
|
|
||||||
|
|
||||||
# Build Targets
|
# Build Targets
|
||||||
.build-conf: ${BUILD_SUBPROJECTS}
|
.build-conf: ${BUILD_SUBPROJECTS}
|
||||||
|
@ -68,47 +67,47 @@ LDFLAGSOPTIONS=`pkg-config --cflags opencv4`
|
||||||
|
|
||||||
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot: ${OBJECTFILES}
|
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot: ${OBJECTFILES}
|
||||||
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
|
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
|
||||||
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot ${OBJECTFILES} ${LDLIBSOPTIONS} -Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt -Wl,--rpath /usr/xenomai/lib
|
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot ${OBJECTFILES} ${LDLIBSOPTIONS} -Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt
|
||||||
|
|
||||||
${OBJECTDIR}/lib/base64/base64.o: lib/base64/base64.cpp
|
${OBJECTDIR}/lib/base64/base64.o: lib/base64/base64.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}/lib/base64
|
${MKDIR} -p ${OBJECTDIR}/lib/base64
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/base64/base64.o lib/base64/base64.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/base64/base64.o lib/base64/base64.cpp
|
||||||
|
|
||||||
${OBJECTDIR}/lib/camera.o: lib/camera.cpp
|
${OBJECTDIR}/lib/camera.o: lib/camera.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}/lib
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/camera.o lib/camera.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/camera.o lib/camera.cpp
|
||||||
|
|
||||||
${OBJECTDIR}/lib/commonitor.o: lib/commonitor.cpp
|
${OBJECTDIR}/lib/commonitor.o: lib/commonitor.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}/lib
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/commonitor.o lib/commonitor.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/commonitor.o lib/commonitor.cpp
|
||||||
|
|
||||||
${OBJECTDIR}/lib/comrobot.o: lib/comrobot.cpp
|
${OBJECTDIR}/lib/comrobot.o: lib/comrobot.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}/lib
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/comrobot.o lib/comrobot.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/comrobot.o lib/comrobot.cpp
|
||||||
|
|
||||||
${OBJECTDIR}/lib/img.o: lib/img.cpp
|
${OBJECTDIR}/lib/img.o: lib/img.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}/lib
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/img.o lib/img.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/img.o lib/img.cpp
|
||||||
|
|
||||||
${OBJECTDIR}/lib/messages.o: lib/messages.cpp
|
${OBJECTDIR}/lib/messages.o: lib/messages.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}/lib
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/messages.o lib/messages.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/messages.o lib/messages.cpp
|
||||||
|
|
||||||
${OBJECTDIR}/main.o: main.cpp
|
${OBJECTDIR}/main.o: main.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}
|
${MKDIR} -p ${OBJECTDIR}
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp
|
||||||
|
|
||||||
${OBJECTDIR}/tasks.o: tasks.cpp
|
${OBJECTDIR}/tasks.o: tasks.cpp
|
||||||
${MKDIR} -p ${OBJECTDIR}
|
${MKDIR} -p ${OBJECTDIR}
|
||||||
${RM} "$@.d"
|
${RM} "$@.d"
|
||||||
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__SIMULATION__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury ${LDFLAGSOPTIONS} -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/tasks.o tasks.cpp
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__FOR_PC__ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/tasks.o tasks.cpp
|
||||||
|
|
||||||
# Subprojects
|
# Subprojects
|
||||||
.build-subprojects:
|
.build-subprojects:
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
#
|
||||||
|
# Generated Makefile - do not edit!
|
||||||
|
#
|
||||||
|
# Edit the Makefile in the project folder instead (../Makefile). Each target
|
||||||
|
# has a -pre and a -post target defined where you can add customized code.
|
||||||
|
#
|
||||||
|
# This makefile implements configuration specific macros and targets.
|
||||||
|
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
MKDIR=mkdir
|
||||||
|
CP=cp
|
||||||
|
GREP=grep
|
||||||
|
NM=nm
|
||||||
|
CCADMIN=CCadmin
|
||||||
|
RANLIB=ranlib
|
||||||
|
CC=gcc
|
||||||
|
CCC=g++
|
||||||
|
CXX=g++
|
||||||
|
FC=gfortran
|
||||||
|
AS=as
|
||||||
|
|
||||||
|
# Macros
|
||||||
|
CND_PLATFORM=GNU-Linux
|
||||||
|
CND_DLIB_EXT=so
|
||||||
|
CND_CONF=Debug__RPI_
|
||||||
|
CND_DISTDIR=dist
|
||||||
|
CND_BUILDDIR=build
|
||||||
|
|
||||||
|
# Include project Makefile
|
||||||
|
include ./Makefile
|
||||||
|
|
||||||
|
# Object Directory
|
||||||
|
OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
|
||||||
|
|
||||||
|
# Object Files
|
||||||
|
OBJECTFILES= \
|
||||||
|
${OBJECTDIR}/lib/base64/base64.o \
|
||||||
|
${OBJECTDIR}/lib/camera.o \
|
||||||
|
${OBJECTDIR}/lib/commonitor.o \
|
||||||
|
${OBJECTDIR}/lib/comrobot.o \
|
||||||
|
${OBJECTDIR}/lib/img.o \
|
||||||
|
${OBJECTDIR}/lib/messages.o \
|
||||||
|
${OBJECTDIR}/main.o \
|
||||||
|
${OBJECTDIR}/tasks.o
|
||||||
|
|
||||||
|
|
||||||
|
# C Compiler Flags
|
||||||
|
CFLAGS=-I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy
|
||||||
|
|
||||||
|
# CC Compiler Flags
|
||||||
|
CCFLAGS=-I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -Wno-pmf-conversions -std=gnu++11
|
||||||
|
CXXFLAGS=-I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -Wno-pmf-conversions -std=gnu++11
|
||||||
|
|
||||||
|
# Fortran Compiler Flags
|
||||||
|
FFLAGS=
|
||||||
|
|
||||||
|
# Assembler Flags
|
||||||
|
ASFLAGS=
|
||||||
|
|
||||||
|
# Link Libraries and Options
|
||||||
|
LDLIBSOPTIONS=`pkg-config --libs opencv` -lraspicam_cv -lraspicam
|
||||||
|
|
||||||
|
# Build Targets
|
||||||
|
.build-conf: ${BUILD_SUBPROJECTS}
|
||||||
|
"${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot
|
||||||
|
|
||||||
|
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot: ${OBJECTFILES}
|
||||||
|
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
|
||||||
|
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot ${OBJECTFILES} ${LDLIBSOPTIONS} -Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt
|
||||||
|
|
||||||
|
${OBJECTDIR}/lib/base64/base64.o: lib/base64/base64.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/lib/base64
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/base64/base64.o lib/base64/base64.cpp
|
||||||
|
|
||||||
|
${OBJECTDIR}/lib/camera.o: lib/camera.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/camera.o lib/camera.cpp
|
||||||
|
|
||||||
|
${OBJECTDIR}/lib/commonitor.o: lib/commonitor.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/commonitor.o lib/commonitor.cpp
|
||||||
|
|
||||||
|
${OBJECTDIR}/lib/comrobot.o: lib/comrobot.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/comrobot.o lib/comrobot.cpp
|
||||||
|
|
||||||
|
${OBJECTDIR}/lib/img.o: lib/img.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/img.o lib/img.cpp
|
||||||
|
|
||||||
|
${OBJECTDIR}/lib/messages.o: lib/messages.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}/lib
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/lib/messages.o lib/messages.cpp
|
||||||
|
|
||||||
|
${OBJECTDIR}/main.o: main.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp
|
||||||
|
|
||||||
|
${OBJECTDIR}/tasks.o: tasks.cpp
|
||||||
|
${MKDIR} -p ${OBJECTDIR}
|
||||||
|
${RM} "$@.d"
|
||||||
|
$(COMPILE.cc) -g -D_WITH_TRACE_ -D__WITH_ARUCO__ -I./ -I./lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury `pkg-config --cflags opencv` -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/tasks.o tasks.cpp
|
||||||
|
|
||||||
|
# Subprojects
|
||||||
|
.build-subprojects:
|
||||||
|
|
||||||
|
# Clean Targets
|
||||||
|
.clean-conf: ${CLEAN_SUBPROJECTS}
|
||||||
|
${RM} -r ${CND_BUILDDIR}/${CND_CONF}
|
||||||
|
|
||||||
|
# Subprojects
|
||||||
|
.clean-subprojects:
|
||||||
|
|
||||||
|
# Enable dependency checking
|
||||||
|
.dep.inc: .depcheck-impl
|
||||||
|
|
||||||
|
include .dep.inc
|
|
@ -31,7 +31,7 @@ DEFAULTCONF=Debug__PC_
|
||||||
CONF=${DEFAULTCONF}
|
CONF=${DEFAULTCONF}
|
||||||
|
|
||||||
# All Configurations
|
# All Configurations
|
||||||
ALLCONFS=Debug__PC_
|
ALLCONFS=Debug__PC_ Debug__RPI_
|
||||||
|
|
||||||
|
|
||||||
# build
|
# build
|
||||||
|
|
|
@ -14,6 +14,14 @@ CND_ARTIFACT_PATH_Debug__PC_=dist/Debug__PC_/GNU-Linux/superviseur-robot
|
||||||
CND_PACKAGE_DIR_Debug__PC_=dist/Debug__PC_/GNU-Linux/package
|
CND_PACKAGE_DIR_Debug__PC_=dist/Debug__PC_/GNU-Linux/package
|
||||||
CND_PACKAGE_NAME_Debug__PC_=superviseur-robot.tar
|
CND_PACKAGE_NAME_Debug__PC_=superviseur-robot.tar
|
||||||
CND_PACKAGE_PATH_Debug__PC_=dist/Debug__PC_/GNU-Linux/package/superviseur-robot.tar
|
CND_PACKAGE_PATH_Debug__PC_=dist/Debug__PC_/GNU-Linux/package/superviseur-robot.tar
|
||||||
|
# Debug__RPI_ configuration
|
||||||
|
CND_PLATFORM_Debug__RPI_=GNU-Linux
|
||||||
|
CND_ARTIFACT_DIR_Debug__RPI_=dist/Debug__RPI_/GNU-Linux
|
||||||
|
CND_ARTIFACT_NAME_Debug__RPI_=superviseur-robot
|
||||||
|
CND_ARTIFACT_PATH_Debug__RPI_=dist/Debug__RPI_/GNU-Linux/superviseur-robot
|
||||||
|
CND_PACKAGE_DIR_Debug__RPI_=dist/Debug__RPI_/GNU-Linux/package
|
||||||
|
CND_PACKAGE_NAME_Debug__RPI_=superviseur-robot.tar
|
||||||
|
CND_PACKAGE_PATH_Debug__RPI_=dist/Debug__RPI_/GNU-Linux/package/superviseur-robot.tar
|
||||||
#
|
#
|
||||||
# include compiler specific variables
|
# include compiler specific variables
|
||||||
#
|
#
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
# Macros
|
# Macros
|
||||||
TOP=`pwd`
|
TOP=`pwd`
|
||||||
CND_PLATFORM=GNU-Linux
|
CND_PLATFORM=GNU-Linux
|
||||||
CND_CONF=Debug
|
CND_CONF=Debug__RPI_
|
||||||
CND_DISTDIR=dist
|
CND_DISTDIR=dist
|
||||||
CND_BUILDDIR=build
|
CND_BUILDDIR=build
|
||||||
CND_DLIB_EXT=so
|
CND_DLIB_EXT=so
|
||||||
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
|
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
|
||||||
TMPDIRNAME=tmp-packaging
|
TMPDIRNAME=tmp-packaging
|
||||||
OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur
|
OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/superviseur-robot
|
||||||
OUTPUT_BASENAME=simulateur
|
OUTPUT_BASENAME=superviseur-robot
|
||||||
PACKAGE_TOP_DIR=simulateur/
|
PACKAGE_TOP_DIR=superviseur-robot/
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
function checkReturnCode
|
function checkReturnCode
|
||||||
|
@ -60,15 +60,15 @@ mkdir -p ${NBTMPDIR}
|
||||||
|
|
||||||
# Copy files and create directories and links
|
# Copy files and create directories and links
|
||||||
cd "${TOP}"
|
cd "${TOP}"
|
||||||
makeDirectory "${NBTMPDIR}/simulateur/bin"
|
makeDirectory "${NBTMPDIR}/superviseur-robot/bin"
|
||||||
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
|
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
|
||||||
|
|
||||||
|
|
||||||
# Generate tar file
|
# Generate tar file
|
||||||
cd "${TOP}"
|
cd "${TOP}"
|
||||||
rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/simulateur.tar
|
rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/superviseur-robot.tar
|
||||||
cd ${NBTMPDIR}
|
cd ${NBTMPDIR}
|
||||||
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/simulateur.tar *
|
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/superviseur-robot.tar *
|
||||||
checkReturnCode
|
checkReturnCode
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
|
@ -71,7 +71,6 @@
|
||||||
<preprocessorList>
|
<preprocessorList>
|
||||||
<Elem>_WITH_TRACE_</Elem>
|
<Elem>_WITH_TRACE_</Elem>
|
||||||
<Elem>__FOR_PC__</Elem>
|
<Elem>__FOR_PC__</Elem>
|
||||||
<Elem>__SIMULATION__</Elem>
|
|
||||||
<Elem>__WITH_ARUCO__</Elem>
|
<Elem>__WITH_ARUCO__</Elem>
|
||||||
</preprocessorList>
|
</preprocessorList>
|
||||||
</ccTool>
|
</ccTool>
|
||||||
|
@ -79,7 +78,78 @@
|
||||||
<linkerLibItems>
|
<linkerLibItems>
|
||||||
<linkerOptionItem>`pkg-config --libs opencv`</linkerOptionItem>
|
<linkerOptionItem>`pkg-config --libs opencv`</linkerOptionItem>
|
||||||
</linkerLibItems>
|
</linkerLibItems>
|
||||||
<commandLine>-Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt -Wl,--rpath /usr/xenomai/lib</commandLine>
|
<commandLine>-Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt</commandLine>
|
||||||
|
</linkerTool>
|
||||||
|
</compileType>
|
||||||
|
<item path="./gdbsudo.sh" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/base64/base64.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/base64/base64.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/camera.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/camera.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/commonitor.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/commonitor.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/comrobot.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/comrobot.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/img.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/img.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/messages.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./lib/messages.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./main.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./tasks.cpp" ex="false" tool="1" flavor2="0">
|
||||||
|
</item>
|
||||||
|
<item path="./tasks.h" ex="false" tool="3" flavor2="0">
|
||||||
|
</item>
|
||||||
|
</conf>
|
||||||
|
<conf name="Debug__RPI_" type="1">
|
||||||
|
<toolsSet>
|
||||||
|
<compilerSet>GNU|GNU</compilerSet>
|
||||||
|
<dependencyChecking>true</dependencyChecking>
|
||||||
|
<rebuildPropChanged>false</rebuildPropChanged>
|
||||||
|
</toolsSet>
|
||||||
|
<compileType>
|
||||||
|
<cTool>
|
||||||
|
<incDir>
|
||||||
|
<pElem>./</pElem>
|
||||||
|
<pElem>./lib</pElem>
|
||||||
|
<pElem>/usr/xenomai/include</pElem>
|
||||||
|
<pElem>/usr/xenomai/include/mercury</pElem>
|
||||||
|
</incDir>
|
||||||
|
<commandLine>-I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy</commandLine>
|
||||||
|
</cTool>
|
||||||
|
<ccTool>
|
||||||
|
<incDir>
|
||||||
|
<pElem>./</pElem>
|
||||||
|
<pElem>./lib</pElem>
|
||||||
|
<pElem>/usr/xenomai/include</pElem>
|
||||||
|
<pElem>/usr/xenomai/include/mercury</pElem>
|
||||||
|
</incDir>
|
||||||
|
<commandLine>-I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -Wno-pmf-conversions -std=gnu++11</commandLine>
|
||||||
|
<preprocessorList>
|
||||||
|
<Elem>_WITH_TRACE_</Elem>
|
||||||
|
<Elem>__WITH_ARUCO__</Elem>
|
||||||
|
</preprocessorList>
|
||||||
|
</ccTool>
|
||||||
|
<linkerTool>
|
||||||
|
<linkerLibItems>
|
||||||
|
<linkerOptionItem>`pkg-config --libs opencv`</linkerOptionItem>
|
||||||
|
<linkerLibLibItem>raspicam_cv</linkerLibLibItem>
|
||||||
|
<linkerLibLibItem>raspicam</linkerLibLibItem>
|
||||||
|
</linkerLibItems>
|
||||||
|
<commandLine>-Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt</commandLine>
|
||||||
</linkerTool>
|
</linkerTool>
|
||||||
</compileType>
|
</compileType>
|
||||||
<item path="./gdbsudo.sh" ex="false" tool="3" flavor2="0">
|
<item path="./gdbsudo.sh" ex="false" tool="3" flavor2="0">
|
||||||
|
|
|
@ -4,3 +4,4 @@
|
||||||
# NOCDDL
|
# NOCDDL
|
||||||
#
|
#
|
||||||
# Debug__PC_ configuration
|
# Debug__PC_ configuration
|
||||||
|
# Debug__RPI_ configuration
|
||||||
|
|
|
@ -39,5 +39,38 @@
|
||||||
</environment>
|
</environment>
|
||||||
</runprofile>
|
</runprofile>
|
||||||
</conf>
|
</conf>
|
||||||
|
<conf name="Debug__RPI_" type="1">
|
||||||
|
<toolsSet>
|
||||||
|
<developmentServer>pi@10.105.1.08:22</developmentServer>
|
||||||
|
<platform>2</platform>
|
||||||
|
</toolsSet>
|
||||||
|
<dbx_gdbdebugger version="1">
|
||||||
|
<gdb_pathmaps>
|
||||||
|
</gdb_pathmaps>
|
||||||
|
<gdb_interceptlist>
|
||||||
|
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
|
||||||
|
</gdb_interceptlist>
|
||||||
|
<gdb_options>
|
||||||
|
<DebugOptions>
|
||||||
|
</DebugOptions>
|
||||||
|
</gdb_options>
|
||||||
|
<gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/>
|
||||||
|
</dbx_gdbdebugger>
|
||||||
|
<nativedebugger version="1">
|
||||||
|
<engine>gdb</engine>
|
||||||
|
</nativedebugger>
|
||||||
|
<runprofile version="9">
|
||||||
|
<runcommandpicklist>
|
||||||
|
<runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem>
|
||||||
|
</runcommandpicklist>
|
||||||
|
<runcommand>"${OUTPUT_PATH}"</runcommand>
|
||||||
|
<rundir></rundir>
|
||||||
|
<buildfirst>true</buildfirst>
|
||||||
|
<terminal-type>0</terminal-type>
|
||||||
|
<remove-instrumentation>0</remove-instrumentation>
|
||||||
|
<environment>
|
||||||
|
</environment>
|
||||||
|
</runprofile>
|
||||||
|
</conf>
|
||||||
</confs>
|
</confs>
|
||||||
</configurationDescriptor>
|
</configurationDescriptor>
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||||
<data xmlns="http://www.netbeans.org/ns/make-project-private/1">
|
<data xmlns="http://www.netbeans.org/ns/make-project-private/1">
|
||||||
<activeConfTypeElem>1</activeConfTypeElem>
|
<activeConfTypeElem>1</activeConfTypeElem>
|
||||||
<activeConfIndexElem>0</activeConfIndexElem>
|
<activeConfIndexElem>1</activeConfIndexElem>
|
||||||
</data>
|
</data>
|
||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<group>
|
||||||
<file>file:/home/etud/dumber/software/raspberry/superviseur-robot/lib/comrobot.cpp</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.h</file>
|
||||||
<file>file:/home/etud/dumber/software/raspberry/superviseur-robot/lib/messages.cpp</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.cpp</file>
|
||||||
<file>file:/home/etud/dumber/software/raspberry/superviseur-robot/tasks.cpp</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.h</file>
|
||||||
<file>file:/home/etud/dumber/software/raspberry/superviseur-robot/lib/commonitor.cpp</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.cpp</file>
|
||||||
<file>file:/home/etud/dumber/software/raspberry/superviseur-robot/lib/commonitor.h</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.cpp</file>
|
||||||
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.h</file>
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
<name>Debug__PC_</name>
|
<name>Debug__PC_</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
</confElem>
|
</confElem>
|
||||||
|
<confElem>
|
||||||
|
<name>Debug__RPI_</name>
|
||||||
|
<type>1</type>
|
||||||
|
</confElem>
|
||||||
</confList>
|
</confList>
|
||||||
<formatting>
|
<formatting>
|
||||||
<project-formatting-style>false</project-formatting-style>
|
<project-formatting-style>false</project-formatting-style>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# This code depends on make tool being used
|
|
||||||
DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES} ${TESTOBJECTFILES}))
|
|
||||||
ifneq (${DEPFILES},)
|
|
||||||
include ${DEPFILES}
|
|
||||||
endif
|
|
|
@ -1,298 +0,0 @@
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <time.h>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
const char LABEL_ROBOT_PING = 'p';
|
|
||||||
const char LABEL_ROBOT_RESET = 'r';
|
|
||||||
const char LABEL_ROBOT_START_WITH_WD = 'W';
|
|
||||||
const char LABEL_ROBOT_START_WITHOUT_WD = 'u';
|
|
||||||
const char LABEL_ROBOT_RELOAD_WD = 'w';
|
|
||||||
const char LABEL_ROBOT_MOVE = 'M';
|
|
||||||
const char LABEL_ROBOT_TURN = 'T';
|
|
||||||
const char LABEL_ROBOT_GET_BATTERY = 'v';
|
|
||||||
const char LABEL_ROBOT_GET_STATE = 'b';
|
|
||||||
const char LABEL_ROBOT_POWEROFF = 'z';
|
|
||||||
|
|
||||||
const char LABEL_ROBOT_OK = 'O';
|
|
||||||
const char LABEL_ROBOT_ERROR = 'E';
|
|
||||||
const char LABEL_ROBOT_UNKNOWN_COMMAND = 'C';
|
|
||||||
|
|
||||||
const char LABEL_ROBOT_SEPARATOR_CHAR = '=';
|
|
||||||
const char LABEL_ROBOT_ENDING_CHAR = 0x0D;
|
|
||||||
|
|
||||||
int server_fd, new_socket, valread;
|
|
||||||
struct sockaddr_in address;
|
|
||||||
int addrlen;
|
|
||||||
#define PORT 6699
|
|
||||||
|
|
||||||
int status = 0;
|
|
||||||
int noerr = 0;
|
|
||||||
int isWD = 0;
|
|
||||||
|
|
||||||
long int ellapse(struct timespec ref, struct timespec cur) {
|
|
||||||
long int e;
|
|
||||||
e = cur.tv_sec - ref.tv_sec;
|
|
||||||
e *= 1000000000;
|
|
||||||
e += cur.tv_nsec - ref.tv_nsec;
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_time(struct timespec start_time) {
|
|
||||||
struct timespec t;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &t);
|
|
||||||
long int e = ellapse(start_time, t);
|
|
||||||
fprintf(stdout, "%9ld", e / 1000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
int simulate_error() {
|
|
||||||
int r = rand() % 1000;
|
|
||||||
if (r > 950) {
|
|
||||||
printf("[I don't understand what you said (-1)]\n");
|
|
||||||
return -1;
|
|
||||||
} else if (r > 900) {
|
|
||||||
printf("[I'm mute, because I never got your message (-2)]\n");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
printf("[WILCO (0)] ");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void simulate_transmission_time() {
|
|
||||||
usleep((rand() % 30) * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void open_server() {
|
|
||||||
|
|
||||||
int opt = 1;
|
|
||||||
// Creating socket file descriptor
|
|
||||||
if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0) {
|
|
||||||
perror("socket failed");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forcefully attaching socket to the port 8080
|
|
||||||
if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT,
|
|
||||||
&opt, sizeof (opt))) {
|
|
||||||
perror("setsockopt");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "<<< simulator >>>" << endl;
|
|
||||||
cout << ">>> Hello, I'm Mr " ;
|
|
||||||
if (noerr) cout << "perfect ";
|
|
||||||
cout << "Robot" << endl;
|
|
||||||
|
|
||||||
// Forcefully attaching socket to the port 8080
|
|
||||||
if (bind(server_fd, (struct sockaddr *) &address,
|
|
||||||
sizeof (address)) < 0) {
|
|
||||||
perror("bind failed");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
cout << ">>> I create a server" << endl;
|
|
||||||
cout << ">>> ..." << endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait_connection() {
|
|
||||||
if (listen(server_fd, 3) < 0) {
|
|
||||||
perror("listen");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << ">>> I'm waiting a client" << endl;
|
|
||||||
if ((new_socket = accept(server_fd, (struct sockaddr *) &address,
|
|
||||||
(socklen_t*) & addrlen)) < 0) {
|
|
||||||
perror("accept");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset(){
|
|
||||||
isWD = 0;
|
|
||||||
status = 0;
|
|
||||||
cout << ">>> XX I stop XX" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char const *argv[]) {
|
|
||||||
if (argc != 1){
|
|
||||||
if (argv[1] == std::string("noerror")){
|
|
||||||
noerr = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char buffer[1024] = {0};
|
|
||||||
addrlen = sizeof (address);
|
|
||||||
address.sin_family = AF_INET;
|
|
||||||
address.sin_addr.s_addr = INADDR_ANY;
|
|
||||||
address.sin_port = htons(PORT);
|
|
||||||
|
|
||||||
srand(time(NULL));
|
|
||||||
|
|
||||||
open_server();
|
|
||||||
wait_connection();
|
|
||||||
cout << ">>> I'm ready to receive something" << endl;
|
|
||||||
struct timespec start_time;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &start_time);
|
|
||||||
struct timespec start_wd;
|
|
||||||
|
|
||||||
|
|
||||||
struct timespec t;
|
|
||||||
|
|
||||||
long int e;
|
|
||||||
struct timespec last_call;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &last_call);
|
|
||||||
isWD = 0;
|
|
||||||
|
|
||||||
while (status < 3) {
|
|
||||||
|
|
||||||
if (isWD) {
|
|
||||||
clock_gettime(CLOCK_REALTIME, &t);
|
|
||||||
e = ellapse(last_call, t);
|
|
||||||
if ((e / 1000000000) > 3) {
|
|
||||||
cout << ">>> You break my heart, you never talk at the right time." << endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
valread = read(new_socket, buffer, 1024);
|
|
||||||
if (valread <= 0) {
|
|
||||||
if (errno == EAGAIN) {
|
|
||||||
status = 3;
|
|
||||||
cout << ">>> You break my heart, I've been waiting too long for you." << endl;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
cout << ">>> Why did you hang up? Please, contact me again." << endl;
|
|
||||||
reset();
|
|
||||||
wait_connection();
|
|
||||||
clock_gettime(CLOCK_REALTIME, &last_call);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
string s = "";
|
|
||||||
int error = 0;
|
|
||||||
|
|
||||||
if (!noerr) error = simulate_error();
|
|
||||||
|
|
||||||
if (error == 0) {
|
|
||||||
|
|
||||||
print_time(start_time);
|
|
||||||
printf(": I received a message %s\n", buffer);
|
|
||||||
switch (buffer[0]) {
|
|
||||||
case LABEL_ROBOT_START_WITHOUT_WD:
|
|
||||||
cout << ">>> I start without watchdog" << endl;
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_PING:
|
|
||||||
cout << ">>> ...Pong" << endl;
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_START_WITH_WD:
|
|
||||||
clock_gettime(CLOCK_REALTIME, &start_wd);
|
|
||||||
clock_gettime(CLOCK_REALTIME, &last_call);
|
|
||||||
struct timeval tv;
|
|
||||||
tv.tv_sec = 3;
|
|
||||||
tv.tv_usec = 0;
|
|
||||||
setsockopt(new_socket, SOL_SOCKET, SO_RCVTIMEO, (const char*) &tv, sizeof tv);
|
|
||||||
|
|
||||||
cout << ">>> I start with watchdog" << endl;
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
isWD = 1;
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_MOVE:
|
|
||||||
switch (buffer[2]) {
|
|
||||||
case '0':
|
|
||||||
cout << ">>> XX I stop XX" << endl;
|
|
||||||
break;
|
|
||||||
case '-':
|
|
||||||
cout << ">>> \\/ I move backward \\/" << endl;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cout << ">>> /\\ I move forward /\\" << endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_TURN:
|
|
||||||
switch (buffer[2]) {
|
|
||||||
case '-':
|
|
||||||
cout << ">>> << I turn to the left <<" << endl;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cout << ">>> >> I turn to the right >>" << endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_GET_BATTERY:
|
|
||||||
cout << ">>> I give you my battery level :-o" << endl;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &t);
|
|
||||||
e = ellapse(start_time, t);
|
|
||||||
if (e > 20000000000) {
|
|
||||||
s += '0';
|
|
||||||
} else {
|
|
||||||
if (e > 10000000000) {
|
|
||||||
s += '1';
|
|
||||||
} else {
|
|
||||||
s += '2';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_RELOAD_WD:
|
|
||||||
clock_gettime(CLOCK_REALTIME, &t);
|
|
||||||
e = ellapse(start_wd, t);
|
|
||||||
e = (e / 1000000) % 1000;
|
|
||||||
if (isWD) {
|
|
||||||
if ((e < 50) || (e > 950)) {
|
|
||||||
cout << ">>> Just in time for a reload " << e << "ms" << endl;
|
|
||||||
last_call = t;
|
|
||||||
status = 0;
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
} else {
|
|
||||||
status++;
|
|
||||||
cout << ">>> You missed the date, -1 point " << e << "ms (" << status << ")" << endl;
|
|
||||||
|
|
||||||
s += LABEL_ROBOT_UNKNOWN_COMMAND;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cout << "Why you said that, I do nothing" << endl;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_POWEROFF:
|
|
||||||
cout << ">>> Bye bye, see you soon" << endl;
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
status = 10;
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_RESET:
|
|
||||||
cout << ">>> I reset" << endl;
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
reset();
|
|
||||||
break;
|
|
||||||
case LABEL_ROBOT_GET_STATE:
|
|
||||||
cout << ">>> I'm fine, thank you" << endl;
|
|
||||||
s += LABEL_ROBOT_OK;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
//msg = new Message(MESSAGE_ANSWER_ROBOT_ERROR);
|
|
||||||
cerr << "[" << __PRETTY_FUNCTION__ << "] Unknown message received from robot (" << buffer << ")" << endl << flush;
|
|
||||||
}
|
|
||||||
simulate_transmission_time();
|
|
||||||
send(new_socket, s.c_str(), s.length(), 0);
|
|
||||||
} else if (error == -1) {
|
|
||||||
s += LABEL_ROBOT_UNKNOWN_COMMAND;
|
|
||||||
simulate_transmission_time();
|
|
||||||
send(new_socket, s.c_str(), s.length(), 0);
|
|
||||||
} else if (error == -2) {
|
|
||||||
/* Do nothing */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "The robot is out. End of story. " << endl;
|
|
||||||
cout << " /\\_/\\" << endl << "( o.o )" << endl << " > ^ <" << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
#
|
|
||||||
# Generated Makefile - do not edit!
|
|
||||||
#
|
|
||||||
# Edit the Makefile in the project folder instead (../Makefile). Each target
|
|
||||||
# has a -pre and a -post target defined where you can add customized code.
|
|
||||||
#
|
|
||||||
# This makefile implements configuration specific macros and targets.
|
|
||||||
|
|
||||||
|
|
||||||
# Environment
|
|
||||||
MKDIR=mkdir
|
|
||||||
CP=cp
|
|
||||||
GREP=grep
|
|
||||||
NM=nm
|
|
||||||
CCADMIN=CCadmin
|
|
||||||
RANLIB=ranlib
|
|
||||||
CC=gcc
|
|
||||||
CCC=g++
|
|
||||||
CXX=g++
|
|
||||||
FC=gfortran
|
|
||||||
AS=as
|
|
||||||
|
|
||||||
# Macros
|
|
||||||
CND_PLATFORM=GNU-Linux
|
|
||||||
CND_DLIB_EXT=so
|
|
||||||
CND_CONF=Debug
|
|
||||||
CND_DISTDIR=dist
|
|
||||||
CND_BUILDDIR=build
|
|
||||||
|
|
||||||
# Include project Makefile
|
|
||||||
include Makefile
|
|
||||||
|
|
||||||
# Object Directory
|
|
||||||
OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
|
|
||||||
|
|
||||||
# Object Files
|
|
||||||
OBJECTFILES= \
|
|
||||||
${OBJECTDIR}/main.o
|
|
||||||
|
|
||||||
|
|
||||||
# C Compiler Flags
|
|
||||||
CFLAGS=
|
|
||||||
|
|
||||||
# CC Compiler Flags
|
|
||||||
CCFLAGS=
|
|
||||||
CXXFLAGS=
|
|
||||||
|
|
||||||
# Fortran Compiler Flags
|
|
||||||
FFLAGS=
|
|
||||||
|
|
||||||
# Assembler Flags
|
|
||||||
ASFLAGS=
|
|
||||||
|
|
||||||
# Link Libraries and Options
|
|
||||||
LDLIBSOPTIONS=
|
|
||||||
|
|
||||||
# Build Targets
|
|
||||||
.build-conf: ${BUILD_SUBPROJECTS}
|
|
||||||
"${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur
|
|
||||||
|
|
||||||
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur: ${OBJECTFILES}
|
|
||||||
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
|
|
||||||
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur ${OBJECTFILES} ${LDLIBSOPTIONS}
|
|
||||||
|
|
||||||
${OBJECTDIR}/main.o: main.cpp
|
|
||||||
${MKDIR} -p ${OBJECTDIR}
|
|
||||||
${RM} "$@.d"
|
|
||||||
$(COMPILE.cc) -g -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp
|
|
||||||
|
|
||||||
# Subprojects
|
|
||||||
.build-subprojects:
|
|
||||||
|
|
||||||
# Clean Targets
|
|
||||||
.clean-conf: ${CLEAN_SUBPROJECTS}
|
|
||||||
${RM} -r ${CND_BUILDDIR}/${CND_CONF}
|
|
||||||
|
|
||||||
# Subprojects
|
|
||||||
.clean-subprojects:
|
|
||||||
|
|
||||||
# Enable dependency checking
|
|
||||||
.dep.inc: .depcheck-impl
|
|
||||||
|
|
||||||
include .dep.inc
|
|
|
@ -1,83 +0,0 @@
|
||||||
#
|
|
||||||
# Generated Makefile - do not edit!
|
|
||||||
#
|
|
||||||
# Edit the Makefile in the project folder instead (../Makefile). Each target
|
|
||||||
# has a -pre and a -post target defined where you can add customized code.
|
|
||||||
#
|
|
||||||
# This makefile implements configuration specific macros and targets.
|
|
||||||
|
|
||||||
|
|
||||||
# Environment
|
|
||||||
MKDIR=mkdir
|
|
||||||
CP=cp
|
|
||||||
GREP=grep
|
|
||||||
NM=nm
|
|
||||||
CCADMIN=CCadmin
|
|
||||||
RANLIB=ranlib
|
|
||||||
CC=gcc
|
|
||||||
CCC=g++
|
|
||||||
CXX=g++
|
|
||||||
FC=gfortran
|
|
||||||
AS=as
|
|
||||||
|
|
||||||
# Macros
|
|
||||||
CND_PLATFORM=GNU-Linux
|
|
||||||
CND_DLIB_EXT=so
|
|
||||||
CND_CONF=Release
|
|
||||||
CND_DISTDIR=dist
|
|
||||||
CND_BUILDDIR=build
|
|
||||||
|
|
||||||
# Include project Makefile
|
|
||||||
include Makefile
|
|
||||||
|
|
||||||
# Object Directory
|
|
||||||
OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
|
|
||||||
|
|
||||||
# Object Files
|
|
||||||
OBJECTFILES= \
|
|
||||||
${OBJECTDIR}/main.o
|
|
||||||
|
|
||||||
|
|
||||||
# C Compiler Flags
|
|
||||||
CFLAGS=
|
|
||||||
|
|
||||||
# CC Compiler Flags
|
|
||||||
CCFLAGS=
|
|
||||||
CXXFLAGS=
|
|
||||||
|
|
||||||
# Fortran Compiler Flags
|
|
||||||
FFLAGS=
|
|
||||||
|
|
||||||
# Assembler Flags
|
|
||||||
ASFLAGS=
|
|
||||||
|
|
||||||
# Link Libraries and Options
|
|
||||||
LDLIBSOPTIONS=
|
|
||||||
|
|
||||||
# Build Targets
|
|
||||||
.build-conf: ${BUILD_SUBPROJECTS}
|
|
||||||
"${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur
|
|
||||||
|
|
||||||
${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur: ${OBJECTFILES}
|
|
||||||
${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
|
|
||||||
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur ${OBJECTFILES} ${LDLIBSOPTIONS}
|
|
||||||
|
|
||||||
${OBJECTDIR}/main.o: main.cpp
|
|
||||||
${MKDIR} -p ${OBJECTDIR}
|
|
||||||
${RM} "$@.d"
|
|
||||||
$(COMPILE.cc) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp
|
|
||||||
|
|
||||||
# Subprojects
|
|
||||||
.build-subprojects:
|
|
||||||
|
|
||||||
# Clean Targets
|
|
||||||
.clean-conf: ${CLEAN_SUBPROJECTS}
|
|
||||||
${RM} -r ${CND_BUILDDIR}/${CND_CONF}
|
|
||||||
|
|
||||||
# Subprojects
|
|
||||||
.clean-subprojects:
|
|
||||||
|
|
||||||
# Enable dependency checking
|
|
||||||
.dep.inc: .depcheck-impl
|
|
||||||
|
|
||||||
include .dep.inc
|
|
|
@ -1,133 +0,0 @@
|
||||||
#
|
|
||||||
# Generated Makefile - do not edit!
|
|
||||||
#
|
|
||||||
# Edit the Makefile in the project folder instead (../Makefile). Each target
|
|
||||||
# has a pre- and a post- target defined where you can add customization code.
|
|
||||||
#
|
|
||||||
# This makefile implements macros and targets common to all configurations.
|
|
||||||
#
|
|
||||||
# NOCDDL
|
|
||||||
|
|
||||||
|
|
||||||
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
|
|
||||||
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
|
|
||||||
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
|
|
||||||
# and .clean-reqprojects-conf unless SUB has the value 'no'
|
|
||||||
SUB_no=NO
|
|
||||||
SUBPROJECTS=${SUB_${SUB}}
|
|
||||||
BUILD_SUBPROJECTS_=.build-subprojects
|
|
||||||
BUILD_SUBPROJECTS_NO=
|
|
||||||
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
|
|
||||||
CLEAN_SUBPROJECTS_=.clean-subprojects
|
|
||||||
CLEAN_SUBPROJECTS_NO=
|
|
||||||
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
|
|
||||||
|
|
||||||
|
|
||||||
# Project Name
|
|
||||||
PROJECTNAME=simulateur
|
|
||||||
|
|
||||||
# Active Configuration
|
|
||||||
DEFAULTCONF=Debug
|
|
||||||
CONF=${DEFAULTCONF}
|
|
||||||
|
|
||||||
# All Configurations
|
|
||||||
ALLCONFS=Debug Release
|
|
||||||
|
|
||||||
|
|
||||||
# build
|
|
||||||
.build-impl: .build-pre .validate-impl .depcheck-impl
|
|
||||||
@#echo "=> Running $@... Configuration=$(CONF)"
|
|
||||||
"${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf
|
|
||||||
|
|
||||||
|
|
||||||
# clean
|
|
||||||
.clean-impl: .clean-pre .validate-impl .depcheck-impl
|
|
||||||
@#echo "=> Running $@... Configuration=$(CONF)"
|
|
||||||
"${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf
|
|
||||||
|
|
||||||
|
|
||||||
# clobber
|
|
||||||
.clobber-impl: .clobber-pre .depcheck-impl
|
|
||||||
@#echo "=> Running $@..."
|
|
||||||
for CONF in ${ALLCONFS}; \
|
|
||||||
do \
|
|
||||||
"${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# all
|
|
||||||
.all-impl: .all-pre .depcheck-impl
|
|
||||||
@#echo "=> Running $@..."
|
|
||||||
for CONF in ${ALLCONFS}; \
|
|
||||||
do \
|
|
||||||
"${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# build tests
|
|
||||||
.build-tests-impl: .build-impl .build-tests-pre
|
|
||||||
@#echo "=> Running $@... Configuration=$(CONF)"
|
|
||||||
"${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf
|
|
||||||
|
|
||||||
# run tests
|
|
||||||
.test-impl: .build-tests-impl .test-pre
|
|
||||||
@#echo "=> Running $@... Configuration=$(CONF)"
|
|
||||||
"${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf
|
|
||||||
|
|
||||||
# dependency checking support
|
|
||||||
.depcheck-impl:
|
|
||||||
@echo "# This code depends on make tool being used" >.dep.inc
|
|
||||||
@if [ -n "${MAKE_VERSION}" ]; then \
|
|
||||||
echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES} \$${TESTOBJECTFILES}))" >>.dep.inc; \
|
|
||||||
echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
|
|
||||||
echo "include \$${DEPFILES}" >>.dep.inc; \
|
|
||||||
echo "endif" >>.dep.inc; \
|
|
||||||
else \
|
|
||||||
echo ".KEEP_STATE:" >>.dep.inc; \
|
|
||||||
echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# configuration validation
|
|
||||||
.validate-impl:
|
|
||||||
@if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
|
|
||||||
then \
|
|
||||||
echo ""; \
|
|
||||||
echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
|
|
||||||
echo "See 'make help' for details."; \
|
|
||||||
echo "Current directory: " `pwd`; \
|
|
||||||
echo ""; \
|
|
||||||
fi
|
|
||||||
@if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
|
|
||||||
then \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# help
|
|
||||||
.help-impl: .help-pre
|
|
||||||
@echo "This makefile supports the following configurations:"
|
|
||||||
@echo " ${ALLCONFS}"
|
|
||||||
@echo ""
|
|
||||||
@echo "and the following targets:"
|
|
||||||
@echo " build (default target)"
|
|
||||||
@echo " clean"
|
|
||||||
@echo " clobber"
|
|
||||||
@echo " all"
|
|
||||||
@echo " help"
|
|
||||||
@echo ""
|
|
||||||
@echo "Makefile Usage:"
|
|
||||||
@echo " make [CONF=<CONFIGURATION>] [SUB=no] build"
|
|
||||||
@echo " make [CONF=<CONFIGURATION>] [SUB=no] clean"
|
|
||||||
@echo " make [SUB=no] clobber"
|
|
||||||
@echo " make [SUB=no] all"
|
|
||||||
@echo " make help"
|
|
||||||
@echo ""
|
|
||||||
@echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
|
|
||||||
@echo " also build subprojects."
|
|
||||||
@echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
|
|
||||||
@echo " also clean subprojects."
|
|
||||||
@echo "Target 'clobber' will remove all built files from all configurations and,"
|
|
||||||
@echo " unless 'SUB=no', also from subprojects."
|
|
||||||
@echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
|
|
||||||
@echo " also build subprojects."
|
|
||||||
@echo "Target 'help' prints this message."
|
|
||||||
@echo ""
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#
|
|
||||||
# Generated - do not edit!
|
|
||||||
#
|
|
||||||
# NOCDDL
|
|
||||||
#
|
|
||||||
CND_BASEDIR=`pwd`
|
|
||||||
CND_BUILDDIR=build
|
|
||||||
CND_DISTDIR=dist
|
|
||||||
# Debug configuration
|
|
||||||
CND_PLATFORM_Debug=GNU-Linux
|
|
||||||
CND_ARTIFACT_DIR_Debug=dist/Debug/GNU-Linux
|
|
||||||
CND_ARTIFACT_NAME_Debug=simulateur
|
|
||||||
CND_ARTIFACT_PATH_Debug=dist/Debug/GNU-Linux/simulateur
|
|
||||||
CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux/package
|
|
||||||
CND_PACKAGE_NAME_Debug=simulateur.tar
|
|
||||||
CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux/package/simulateur.tar
|
|
||||||
# Release configuration
|
|
||||||
CND_PLATFORM_Release=GNU-Linux
|
|
||||||
CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux
|
|
||||||
CND_ARTIFACT_NAME_Release=simulateur
|
|
||||||
CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux/simulateur
|
|
||||||
CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux/package
|
|
||||||
CND_PACKAGE_NAME_Release=simulateur.tar
|
|
||||||
CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux/package/simulateur.tar
|
|
||||||
#
|
|
||||||
# include compiler specific variables
|
|
||||||
#
|
|
||||||
# dmake command
|
|
||||||
ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \
|
|
||||||
(mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)
|
|
||||||
#
|
|
||||||
# gmake command
|
|
||||||
.PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk))
|
|
||||||
#
|
|
||||||
include nbproject/private/Makefile-variables.mk
|
|
|
@ -1,76 +0,0 @@
|
||||||
#!/bin/bash -x
|
|
||||||
|
|
||||||
#
|
|
||||||
# Generated - do not edit!
|
|
||||||
#
|
|
||||||
|
|
||||||
# Macros
|
|
||||||
TOP=`pwd`
|
|
||||||
CND_PLATFORM=GNU-Linux
|
|
||||||
CND_CONF=Release
|
|
||||||
CND_DISTDIR=dist
|
|
||||||
CND_BUILDDIR=build
|
|
||||||
CND_DLIB_EXT=so
|
|
||||||
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
|
|
||||||
TMPDIRNAME=tmp-packaging
|
|
||||||
OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/simulateur
|
|
||||||
OUTPUT_BASENAME=simulateur
|
|
||||||
PACKAGE_TOP_DIR=simulateur/
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
function checkReturnCode
|
|
||||||
{
|
|
||||||
rc=$?
|
|
||||||
if [ $rc != 0 ]
|
|
||||||
then
|
|
||||||
exit $rc
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
function makeDirectory
|
|
||||||
# $1 directory path
|
|
||||||
# $2 permission (optional)
|
|
||||||
{
|
|
||||||
mkdir -p "$1"
|
|
||||||
checkReturnCode
|
|
||||||
if [ "$2" != "" ]
|
|
||||||
then
|
|
||||||
chmod $2 "$1"
|
|
||||||
checkReturnCode
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
function copyFileToTmpDir
|
|
||||||
# $1 from-file path
|
|
||||||
# $2 to-file path
|
|
||||||
# $3 permission
|
|
||||||
{
|
|
||||||
cp "$1" "$2"
|
|
||||||
checkReturnCode
|
|
||||||
if [ "$3" != "" ]
|
|
||||||
then
|
|
||||||
chmod $3 "$2"
|
|
||||||
checkReturnCode
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Setup
|
|
||||||
cd "${TOP}"
|
|
||||||
mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
|
|
||||||
rm -rf ${NBTMPDIR}
|
|
||||||
mkdir -p ${NBTMPDIR}
|
|
||||||
|
|
||||||
# Copy files and create directories and links
|
|
||||||
cd "${TOP}"
|
|
||||||
makeDirectory "${NBTMPDIR}/simulateur/bin"
|
|
||||||
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
|
|
||||||
|
|
||||||
|
|
||||||
# Generate tar file
|
|
||||||
cd "${TOP}"
|
|
||||||
rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/simulateur.tar
|
|
||||||
cd ${NBTMPDIR}
|
|
||||||
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/simulateur.tar *
|
|
||||||
checkReturnCode
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
cd "${TOP}"
|
|
||||||
rm -rf ${NBTMPDIR}
|
|
|
@ -1,66 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configurationDescriptor version="100">
|
|
||||||
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
|
|
||||||
<logicalFolder name="HeaderFiles"
|
|
||||||
displayName="Header Files"
|
|
||||||
projectFiles="true">
|
|
||||||
</logicalFolder>
|
|
||||||
<logicalFolder name="ResourceFiles"
|
|
||||||
displayName="Resource Files"
|
|
||||||
projectFiles="true">
|
|
||||||
</logicalFolder>
|
|
||||||
<logicalFolder name="SourceFiles"
|
|
||||||
displayName="Source Files"
|
|
||||||
projectFiles="true">
|
|
||||||
<itemPath>main.cpp</itemPath>
|
|
||||||
</logicalFolder>
|
|
||||||
<logicalFolder name="TestFiles"
|
|
||||||
displayName="Test Files"
|
|
||||||
projectFiles="false"
|
|
||||||
kind="TEST_LOGICAL_FOLDER">
|
|
||||||
</logicalFolder>
|
|
||||||
<logicalFolder name="ExternalFiles"
|
|
||||||
displayName="Important Files"
|
|
||||||
projectFiles="false"
|
|
||||||
kind="IMPORTANT_FILES_FOLDER">
|
|
||||||
<itemPath>Makefile</itemPath>
|
|
||||||
</logicalFolder>
|
|
||||||
</logicalFolder>
|
|
||||||
<projectmakefile>Makefile</projectmakefile>
|
|
||||||
<confs>
|
|
||||||
<conf name="Debug" type="1">
|
|
||||||
<toolsSet>
|
|
||||||
<compilerSet>default</compilerSet>
|
|
||||||
<dependencyChecking>true</dependencyChecking>
|
|
||||||
<rebuildPropChanged>false</rebuildPropChanged>
|
|
||||||
</toolsSet>
|
|
||||||
<compileType>
|
|
||||||
</compileType>
|
|
||||||
<item path="main.cpp" ex="false" tool="1" flavor2="0">
|
|
||||||
</item>
|
|
||||||
</conf>
|
|
||||||
<conf name="Release" type="1">
|
|
||||||
<toolsSet>
|
|
||||||
<compilerSet>default</compilerSet>
|
|
||||||
<dependencyChecking>true</dependencyChecking>
|
|
||||||
<rebuildPropChanged>false</rebuildPropChanged>
|
|
||||||
</toolsSet>
|
|
||||||
<compileType>
|
|
||||||
<cTool>
|
|
||||||
<developmentMode>5</developmentMode>
|
|
||||||
</cTool>
|
|
||||||
<ccTool>
|
|
||||||
<developmentMode>5</developmentMode>
|
|
||||||
</ccTool>
|
|
||||||
<fortranCompilerTool>
|
|
||||||
<developmentMode>5</developmentMode>
|
|
||||||
</fortranCompilerTool>
|
|
||||||
<asmTool>
|
|
||||||
<developmentMode>5</developmentMode>
|
|
||||||
</asmTool>
|
|
||||||
</compileType>
|
|
||||||
<item path="main.cpp" ex="false" tool="1" flavor2="0">
|
|
||||||
</item>
|
|
||||||
</conf>
|
|
||||||
</confs>
|
|
||||||
</configurationDescriptor>
|
|
|
@ -1,7 +0,0 @@
|
||||||
#
|
|
||||||
# Generated - do not edit!
|
|
||||||
#
|
|
||||||
# NOCDDL
|
|
||||||
#
|
|
||||||
# Debug configuration
|
|
||||||
# Release configuration
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
|
|
||||||
*
|
|
||||||
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
|
||||||
* Other names may be trademarks of their respective owners.
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the terms of either the GNU
|
|
||||||
* General Public License Version 2 only ("GPL") or the Common
|
|
||||||
* Development and Distribution License("CDDL") (collectively, the
|
|
||||||
* "License"). You may not use this file except in compliance with the
|
|
||||||
* License. You can obtain a copy of the License at
|
|
||||||
* http://www.netbeans.org/cddl-gplv2.html
|
|
||||||
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
|
||||||
* specific language governing permissions and limitations under the
|
|
||||||
* License. When distributing the software, include this License Header
|
|
||||||
* Notice in each file and include the License file at
|
|
||||||
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the GPL Version 2 section of the License file that
|
|
||||||
* accompanied this code. If applicable, add the following below the
|
|
||||||
* License Header, with the fields enclosed by brackets [] replaced by
|
|
||||||
* your own identifying information:
|
|
||||||
* "Portions Copyrighted [year] [name of copyright owner]"
|
|
||||||
*
|
|
||||||
* If you wish your version of this file to be governed by only the CDDL
|
|
||||||
* or only the GPL Version 2, indicate your decision by adding
|
|
||||||
* "[Contributor] elects to include this software in this distribution
|
|
||||||
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
|
||||||
* single choice of license, a recipient has the option to distribute
|
|
||||||
* your version of this file under either the CDDL, the GPL Version 2 or
|
|
||||||
* to extend the choice of license to its licensees as provided above.
|
|
||||||
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
|
||||||
* Version 2 license, then the option applies only if the new code is
|
|
||||||
* made subject to such option by the copyright holder.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*/
|
|
||||||
|
|
||||||
// List of standard headers was taken in http://en.cppreference.com/w/c/header
|
|
||||||
|
|
||||||
#include <assert.h> // Conditionally compiled macro that compares its argument to zero
|
|
||||||
#include <ctype.h> // Functions to determine the type contained in character data
|
|
||||||
#include <errno.h> // Macros reporting error conditions
|
|
||||||
#include <float.h> // Limits of float types
|
|
||||||
#include <limits.h> // Sizes of basic types
|
|
||||||
#include <locale.h> // Localization utilities
|
|
||||||
#include <math.h> // Common mathematics functions
|
|
||||||
#include <setjmp.h> // Nonlocal jumps
|
|
||||||
#include <signal.h> // Signal handling
|
|
||||||
#include <stdarg.h> // Variable arguments
|
|
||||||
#include <stddef.h> // Common macro definitions
|
|
||||||
#include <stdio.h> // Input/output
|
|
||||||
#include <string.h> // String handling
|
|
||||||
#include <stdlib.h> // General utilities: memory management, program utilities, string conversions, random numbers
|
|
||||||
#include <time.h> // Time/date utilities
|
|
||||||
#include <iso646.h> // (since C95) Alternative operator spellings
|
|
||||||
#include <wchar.h> // (since C95) Extended multibyte and wide character utilities
|
|
||||||
#include <wctype.h> // (since C95) Wide character classification and mapping utilities
|
|
||||||
#ifdef _STDC_C99
|
|
||||||
#include <complex.h> // (since C99) Complex number arithmetic
|
|
||||||
#include <fenv.h> // (since C99) Floating-point environment
|
|
||||||
#include <inttypes.h> // (since C99) Format conversion of integer types
|
|
||||||
#include <stdbool.h> // (since C99) Boolean type
|
|
||||||
#include <stdint.h> // (since C99) Fixed-width integer types
|
|
||||||
#include <tgmath.h> // (since C99) Type-generic math (macros wrapping math.h and complex.h)
|
|
||||||
#endif
|
|
||||||
#ifdef _STDC_C11
|
|
||||||
#include <stdalign.h> // (since C11) alignas and alignof convenience macros
|
|
||||||
#include <stdatomic.h> // (since C11) Atomic types
|
|
||||||
#include <stdnoreturn.h> // (since C11) noreturn convenience macros
|
|
||||||
#include <threads.h> // (since C11) Thread library
|
|
||||||
#include <uchar.h> // (since C11) UTF-16 and UTF-32 character utilities
|
|
||||||
#endif
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configurationDescriptor version="100">
|
|
||||||
<projectmakefile>Makefile</projectmakefile>
|
|
||||||
<confs>
|
|
||||||
<conf name="Debug" type="1">
|
|
||||||
<toolsSet>
|
|
||||||
<developmentServer>localhost</developmentServer>
|
|
||||||
<platform>2</platform>
|
|
||||||
</toolsSet>
|
|
||||||
<dbx_gdbdebugger version="1">
|
|
||||||
<gdb_pathmaps>
|
|
||||||
</gdb_pathmaps>
|
|
||||||
<gdb_interceptlist>
|
|
||||||
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
|
|
||||||
</gdb_interceptlist>
|
|
||||||
<gdb_options>
|
|
||||||
<DebugOptions>
|
|
||||||
</DebugOptions>
|
|
||||||
</gdb_options>
|
|
||||||
<gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/>
|
|
||||||
</dbx_gdbdebugger>
|
|
||||||
<nativedebugger version="1">
|
|
||||||
<engine>gdb</engine>
|
|
||||||
</nativedebugger>
|
|
||||||
<runprofile version="9">
|
|
||||||
<runcommandpicklist>
|
|
||||||
<runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem>
|
|
||||||
</runcommandpicklist>
|
|
||||||
<runcommand>"${OUTPUT_PATH}"</runcommand>
|
|
||||||
<rundir></rundir>
|
|
||||||
<buildfirst>true</buildfirst>
|
|
||||||
<terminal-type>0</terminal-type>
|
|
||||||
<remove-instrumentation>0</remove-instrumentation>
|
|
||||||
<environment>
|
|
||||||
</environment>
|
|
||||||
</runprofile>
|
|
||||||
</conf>
|
|
||||||
<conf name="Release" type="1">
|
|
||||||
<toolsSet>
|
|
||||||
<developmentServer>localhost</developmentServer>
|
|
||||||
<platform>2</platform>
|
|
||||||
</toolsSet>
|
|
||||||
<dbx_gdbdebugger version="1">
|
|
||||||
<gdb_pathmaps>
|
|
||||||
</gdb_pathmaps>
|
|
||||||
<gdb_interceptlist>
|
|
||||||
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
|
|
||||||
</gdb_interceptlist>
|
|
||||||
<gdb_options>
|
|
||||||
<DebugOptions>
|
|
||||||
</DebugOptions>
|
|
||||||
</gdb_options>
|
|
||||||
<gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/>
|
|
||||||
</dbx_gdbdebugger>
|
|
||||||
<nativedebugger version="1">
|
|
||||||
<engine>gdb</engine>
|
|
||||||
</nativedebugger>
|
|
||||||
<runprofile version="9">
|
|
||||||
<runcommandpicklist>
|
|
||||||
<runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem>
|
|
||||||
</runcommandpicklist>
|
|
||||||
<runcommand>"${OUTPUT_PATH}"</runcommand>
|
|
||||||
<rundir></rundir>
|
|
||||||
<buildfirst>true</buildfirst>
|
|
||||||
<terminal-type>0</terminal-type>
|
|
||||||
<remove-instrumentation>0</remove-instrumentation>
|
|
||||||
<environment>
|
|
||||||
</environment>
|
|
||||||
</runprofile>
|
|
||||||
</conf>
|
|
||||||
</confs>
|
|
||||||
</configurationDescriptor>
|
|
|
@ -1,135 +0,0 @@
|
||||||
/*
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
|
|
||||||
*
|
|
||||||
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
|
||||||
* Other names may be trademarks of their respective owners.
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the terms of either the GNU
|
|
||||||
* General Public License Version 2 only ("GPL") or the Common
|
|
||||||
* Development and Distribution License("CDDL") (collectively, the
|
|
||||||
* "License"). You may not use this file except in compliance with the
|
|
||||||
* License. You can obtain a copy of the License at
|
|
||||||
* http://www.netbeans.org/cddl-gplv2.html
|
|
||||||
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
|
||||||
* specific language governing permissions and limitations under the
|
|
||||||
* License. When distributing the software, include this License Header
|
|
||||||
* Notice in each file and include the License file at
|
|
||||||
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the GPL Version 2 section of the License file that
|
|
||||||
* accompanied this code. If applicable, add the following below the
|
|
||||||
* License Header, with the fields enclosed by brackets [] replaced by
|
|
||||||
* your own identifying information:
|
|
||||||
* "Portions Copyrighted [year] [name of copyright owner]"
|
|
||||||
*
|
|
||||||
* If you wish your version of this file to be governed by only the CDDL
|
|
||||||
* or only the GPL Version 2, indicate your decision by adding
|
|
||||||
* "[Contributor] elects to include this software in this distribution
|
|
||||||
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
|
||||||
* single choice of license, a recipient has the option to distribute
|
|
||||||
* your version of this file under either the CDDL, the GPL Version 2 or
|
|
||||||
* to extend the choice of license to its licensees as provided above.
|
|
||||||
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
|
||||||
* Version 2 license, then the option applies only if the new code is
|
|
||||||
* made subject to such option by the copyright holder.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*/
|
|
||||||
|
|
||||||
// List of standard headers was taken in http://en.cppreference.com/w/cpp/header
|
|
||||||
|
|
||||||
#include <cstdlib> // General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search
|
|
||||||
#include <csignal> // Functions and macro constants for signal management
|
|
||||||
#include <csetjmp> // Macro (and function) that saves (and jumps) to an execution context
|
|
||||||
#include <cstdarg> // Handling of variable length argument lists
|
|
||||||
#include <typeinfo> // Runtime type information utilities
|
|
||||||
#include <bitset> // std::bitset class template
|
|
||||||
#include <functional> // Function objects, designed for use with the standard algorithms
|
|
||||||
#include <utility> // Various utility components
|
|
||||||
#include <ctime> // C-style time/date utilites
|
|
||||||
#include <cstddef> // typedefs for types such as size_t, NULL and others
|
|
||||||
#include <new> // Low-level memory management utilities
|
|
||||||
#include <memory> // Higher level memory management utilities
|
|
||||||
#include <climits> // limits of integral types
|
|
||||||
#include <cfloat> // limits of float types
|
|
||||||
#include <limits> // standardized way to query properties of arithmetic types
|
|
||||||
#include <exception> // Exception handling utilities
|
|
||||||
#include <stdexcept> // Standard exception objects
|
|
||||||
#include <cassert> // Conditionally compiled macro that compares its argument to zero
|
|
||||||
#include <cerrno> // Macro containing the last error number
|
|
||||||
#include <cctype> // functions to determine the type contained in character data
|
|
||||||
#include <cwctype> // functions for determining the type of wide character data
|
|
||||||
#include <cstring> // various narrow character string handling functions
|
|
||||||
#include <cwchar> // various wide and multibyte string handling functions
|
|
||||||
#include <string> // std::basic_string class template
|
|
||||||
#include <vector> // std::vector container
|
|
||||||
#include <deque> // std::deque container
|
|
||||||
#include <list> // std::list container
|
|
||||||
#include <set> // std::set and std::multiset associative containers
|
|
||||||
#include <map> // std::map and std::multimap associative containers
|
|
||||||
#include <stack> // std::stack container adaptor
|
|
||||||
#include <queue> // std::queue and std::priority_queue container adaptors
|
|
||||||
#include <algorithm> // Algorithms that operate on containers
|
|
||||||
#include <iterator> // Container iterators
|
|
||||||
#include <cmath> // Common mathematics functions
|
|
||||||
#include <complex> // Complex number type
|
|
||||||
#include <valarray> // Class for representing and manipulating arrays of values
|
|
||||||
#include <numeric> // Numeric operations on values in containers
|
|
||||||
#include <iosfwd> // forward declarations of all classes in the input/output library
|
|
||||||
#include <ios> // std::ios_base class, std::basic_ios class template and several typedefs
|
|
||||||
#include <istream> // std::basic_istream class template and several typedefs
|
|
||||||
#include <ostream> // std::basic_ostream, std::basic_iostream class templates and several typedefs
|
|
||||||
#include <iostream> // several standard stream objects
|
|
||||||
#include <fstream> // std::basic_fstream, std::basic_ifstream, std::basic_ofstream class templates and several typedefs
|
|
||||||
#include <sstream> // std::basic_stringstream, std::basic_istringstream, std::basic_ostringstream class templates and several typedefs
|
|
||||||
#include <strstream> // std::strstream, std::istrstream, std::ostrstream(deprecated)
|
|
||||||
#include <iomanip> // Helper functions to control the format or input and output
|
|
||||||
#include <streambuf> // std::basic_streambuf class template
|
|
||||||
#include <cstdio> // C-style input-output functions
|
|
||||||
#include <locale> // Localization utilities
|
|
||||||
#include <clocale> // C localization utilities
|
|
||||||
#include <ciso646> // empty header. The macros that appear in iso646.h in C are keywords in C++
|
|
||||||
#if __cplusplus >= 201103L
|
|
||||||
#include <typeindex> // (since C++11) std::type_index
|
|
||||||
#include <type_traits> // (since C++11) Compile-time type information
|
|
||||||
#include <chrono> // (since C++11) C++ time utilites
|
|
||||||
#include <initializer_list> // (since C++11) std::initializer_list class template
|
|
||||||
#include <tuple> // (since C++11) std::tuple class template
|
|
||||||
#include <scoped_allocator> // (since C++11) Nested allocator class
|
|
||||||
#include <cstdint> // (since C++11) fixed-size types and limits of other types
|
|
||||||
#include <cinttypes> // (since C++11) formatting macros , intmax_t and uintmax_t math and conversions
|
|
||||||
#include <system_error> // (since C++11) defines std::error_code, a platform-dependent error code
|
|
||||||
#include <cuchar> // (since C++11) C-style Unicode character conversion functions
|
|
||||||
#include <array> // (since C++11) std::array container
|
|
||||||
#include <forward_list> // (since C++11) std::forward_list container
|
|
||||||
#include <unordered_set> // (since C++11) std::unordered_set and std::unordered_multiset unordered associative containers
|
|
||||||
#include <unordered_map> // (since C++11) std::unordered_map and std::unordered_multimap unordered associative containers
|
|
||||||
#include <random> // (since C++11) Random number generators and distributions
|
|
||||||
#include <ratio> // (since C++11) Compile-time rational arithmetic
|
|
||||||
#include <cfenv> // (since C++11) Floating-point environment access functions
|
|
||||||
#include <codecvt> // (since C++11) Unicode conversion facilities
|
|
||||||
#include <regex> // (since C++11) Classes, algorithms and iterators to support regular expression processing
|
|
||||||
#include <atomic> // (since C++11) Atomic operations library
|
|
||||||
#include <ccomplex> // (since C++11)(deprecated in C++17) simply includes the header <complex>
|
|
||||||
#include <ctgmath> // (since C++11)(deprecated in C++17) simply includes the headers <ccomplex> (until C++17)<complex> (since C++17) and <cmath>: the overloads equivalent to the contents of the C header tgmath.h are already provided by those headers
|
|
||||||
#include <cstdalign> // (since C++11)(deprecated in C++17) defines one compatibility macro constant
|
|
||||||
#include <cstdbool> // (since C++11)(deprecated in C++17) defines one compatibility macro constant
|
|
||||||
#include <thread> // (since C++11) std::thread class and supporting functions
|
|
||||||
#include <mutex> // (since C++11) mutual exclusion primitives
|
|
||||||
#include <future> // (since C++11) primitives for asynchronous computations
|
|
||||||
#include <condition_variable> // (since C++11) thread waiting conditions
|
|
||||||
#endif
|
|
||||||
#if __cplusplus >= 201300L
|
|
||||||
#include <shared_mutex> // (since C++14) shared mutual exclusion primitives
|
|
||||||
#endif
|
|
||||||
#if __cplusplus >= 201500L
|
|
||||||
#include <any> // (since C++17) std::any class template
|
|
||||||
#include <optional> // (since C++17) std::optional class template
|
|
||||||
#include <variant> // (since C++17) std::variant class template
|
|
||||||
#include <memory_resource> // (since C++17) Polymorphic allocators and memory resources
|
|
||||||
#include <string_view> // (since C++17) std::basic_string_view class template
|
|
||||||
#include <execution> // (since C++17) Predefined execution policies for parallel versions of the algorithms
|
|
||||||
#include <filesystem> // (since C++17) std::path class and supporting functions
|
|
||||||
#endif
|
|
|
@ -1,42 +0,0 @@
|
||||||
# Launchers File syntax:
|
|
||||||
#
|
|
||||||
# [Must-have property line]
|
|
||||||
# launcher1.runCommand=<Run Command>
|
|
||||||
# [Optional extra properties]
|
|
||||||
# launcher1.displayName=<Display Name, runCommand by default>
|
|
||||||
# launcher1.hide=<true if lancher is not visible in menu, false by default>
|
|
||||||
# launcher1.buildCommand=<Build Command, Build Command specified in project properties by default>
|
|
||||||
# launcher1.runDir=<Run Directory, ${PROJECT_DIR} by default>
|
|
||||||
# launcher1.runInOwnTab=<false if launcher reuse common "Run" output tab, true by default>
|
|
||||||
# launcher1.symbolFiles=<Symbol Files loaded by debugger, ${OUTPUT_PATH} by default>
|
|
||||||
# launcher1.env.<Environment variable KEY>=<Environment variable VALUE>
|
|
||||||
# (If this value is quoted with ` it is handled as a native command which execution result will become the value)
|
|
||||||
# [Common launcher properties]
|
|
||||||
# common.runDir=<Run Directory>
|
|
||||||
# (This value is overwritten by a launcher specific runDir value if the latter exists)
|
|
||||||
# common.env.<Environment variable KEY>=<Environment variable VALUE>
|
|
||||||
# (Environment variables from common launcher are merged with launcher specific variables)
|
|
||||||
# common.symbolFiles=<Symbol Files loaded by debugger>
|
|
||||||
# (This value is overwritten by a launcher specific symbolFiles value if the latter exists)
|
|
||||||
#
|
|
||||||
# In runDir, symbolFiles and env fields you can use these macroses:
|
|
||||||
# ${PROJECT_DIR} - project directory absolute path
|
|
||||||
# ${OUTPUT_PATH} - linker output path (relative to project directory path)
|
|
||||||
# ${OUTPUT_BASENAME}- linker output filename
|
|
||||||
# ${TESTDIR} - test files directory (relative to project directory path)
|
|
||||||
# ${OBJECTDIR} - object files directory (relative to project directory path)
|
|
||||||
# ${CND_DISTDIR} - distribution directory (relative to project directory path)
|
|
||||||
# ${CND_BUILDDIR} - build directory (relative to project directory path)
|
|
||||||
# ${CND_PLATFORM} - platform name
|
|
||||||
# ${CND_CONF} - configuration name
|
|
||||||
# ${CND_DLIB_EXT} - dynamic library extension
|
|
||||||
#
|
|
||||||
# All the project launchers must be listed in the file!
|
|
||||||
#
|
|
||||||
# launcher1.runCommand=...
|
|
||||||
# launcher2.runCommand=...
|
|
||||||
# ...
|
|
||||||
# common.runDir=...
|
|
||||||
# common.env.KEY=VALUE
|
|
||||||
|
|
||||||
# launcher1.runCommand=<type your run command here>
|
|
|
@ -1,13 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
|
||||||
<data xmlns="http://www.netbeans.org/ns/make-project-private/1">
|
|
||||||
<activeConfTypeElem>1</activeConfTypeElem>
|
|
||||||
<activeConfIndexElem>0</activeConfIndexElem>
|
|
||||||
</data>
|
|
||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
|
||||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
|
||||||
<group>
|
|
||||||
<file>file:/home/etud/dumber/software/simulateur/main.cpp</file>
|
|
||||||
</group>
|
|
||||||
</open-files>
|
|
||||||
</project-private>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
|
||||||
<type>org.netbeans.modules.cnd.makeproject</type>
|
|
||||||
<configuration>
|
|
||||||
<data xmlns="http://www.netbeans.org/ns/make-project/1">
|
|
||||||
<name>simulateur</name>
|
|
||||||
<c-extensions/>
|
|
||||||
<cpp-extensions>cpp</cpp-extensions>
|
|
||||||
<header-extensions/>
|
|
||||||
<sourceEncoding>UTF-8</sourceEncoding>
|
|
||||||
<make-dep-projects/>
|
|
||||||
<sourceRootList/>
|
|
||||||
<confList>
|
|
||||||
<confElem>
|
|
||||||
<name>Debug</name>
|
|
||||||
<type>1</type>
|
|
||||||
</confElem>
|
|
||||||
<confElem>
|
|
||||||
<name>Release</name>
|
|
||||||
<type>1</type>
|
|
||||||
</confElem>
|
|
||||||
</confList>
|
|
||||||
<formatting>
|
|
||||||
<project-formatting-style>false</project-formatting-style>
|
|
||||||
</formatting>
|
|
||||||
</data>
|
|
||||||
</configuration>
|
|
||||||
</project>
|
|
Loading…
Reference in a new issue