From: <rus...@us...> - 2009-10-28 13:16:22
|
Revision: 448 http://gearbox.svn.sourceforge.net/gearbox/?rev=448&view=rev Author: russo2503v Date: 2009-10-28 13:16:07 +0000 (Wed, 28 Oct 2009) Log Message: ----------- added version to license Modified Paths: -------------- gearbox/trunk/LICENSE gearbox/trunk/src/basicexample/CMakeLists.txt gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt gearbox/trunk/src/gbxserialacfr/CMakeLists.txt gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt gearbox/trunk/src/gbxutilacfr/CMakeLists.txt Modified: gearbox/trunk/LICENSE =================================================================== --- gearbox/trunk/LICENSE 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/LICENSE 2009-10-28 13:16:07 UTC (rev 448) @@ -2,17 +2,17 @@ ---------------------------------------------------------------------- DIRECTORY license ---------------------------------------------------------------------- -src/basicexample LGPL +src/basicexample LGPL2+ src/flexiport LGPL3 -src/gbxadvancedexample GPL -src/gbxserialacfr LGPL -src/gbxserialacfr/lockfile LGPL -src/gbxutilacfr LGPL -src/gbxgarminacfr LGPL -src/gbxnovatelacfr LGPL -src/gbxnovatelacfr/gbxnovatelutilacfr LGPL -src/gbxsickacfr LGPL -src/gbxsickacfr/gbxiceutilacfr LGPL -src/gbxsickacfr/gbxserialdeviceacfr LGPL -src/gbxsmartbatteryacfr LGPL +src/gbxadvancedexample GPL2+ +src/gbxserialacfr LGPL2+ +src/gbxserialacfr/lockfile LGPL2+ +src/gbxutilacfr LGPL2+ +src/gbxgarminacfr LGPL2+ +src/gbxnovatelacfr LGPL2+ +src/gbxnovatelacfr/gbxnovatelutilacfr LGPL2+ +src/gbxsickacfr LGPL2+ +src/gbxsickacfr/gbxiceutilacfr LGPL2+ +src/gbxsickacfr/gbxserialdeviceacfr LGPL2+ +src/gbxsmartbatteryacfr LGPL2+ src/hokuyo_aist LGPL3 Modified: gearbox/trunk/src/basicexample/CMakeLists.txt =================================================================== --- gearbox/trunk/src/basicexample/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/basicexample/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,12 +1,12 @@ set( lib_name basicexample ) set( libVersion 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} OFF ) if( build ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) file( GLOB hdrs *.h ) Modified: gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxadvancedexample/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxAdvancedExample ) set( libVersion 1.0.0 ) -GBX_ADD_LICENSE( GPL ) +GBX_ADD_LICENSE( GPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} OFF ) @@ -10,7 +10,7 @@ GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) file( GLOB hdrs *.h ) Modified: gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxgarminacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,21 +1,21 @@ set( lib_name GbxGarminAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} ON ) GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" ) -set( dep_libs GbxUtilAcfr GbxSerialAcfr ) +set( dep_libs GbxUtilAcfr GbxSerialAcfr ) GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) - + file( GLOB hdrs *.h ) file( GLOB srcs *.cpp ) - + GBX_ADD_LIBRARY( ${lib_name} DEFAULT ${lib_version} ${srcs} ) target_link_libraries( ${lib_name} ${dep_libs} ) GBX_ADD_PKGCONFIG( ${lib_name} "Garmin GPS driver" "" dep_libs "" "" ${lib_version} ) Modified: gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxnovatelacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxNovatelAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} ON ) Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxNovatelUtilAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) # don't give user an option @@ -17,7 +17,7 @@ GBX_REQUIRE_LIBS( build LIB ${lib_name} ${dep_libs} ) if( build ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) file( GLOB hdrs *.h ) Modified: gearbox/trunk/src/gbxserialacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxserialacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxserialacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxSerialAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} ON ) @@ -13,7 +13,7 @@ if( build ) add_subdirectory( lockfile ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) # for config.h Modified: gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxLockFileAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) # don't give user an option @@ -9,7 +9,7 @@ # GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" ) if( build ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) file( GLOB hdrs *.h ) Modified: gearbox/trunk/src/gbxsickacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxsickacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxSickAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} ON ) @@ -17,7 +17,7 @@ if( build ) add_subdirectory( gbxserialdeviceacfr ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) include( ${GBX_CMAKE_DIR}/UseIceUtil.cmake ) Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxIceUtilAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) @@ -13,7 +13,7 @@ GBX_REQUIRE_LIBS( build LIB ${lib_name} ${proj_libs} ) if( build ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) include( ${GBX_CMAKE_DIR}/UseIceUtil.cmake ) Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxSerialDeviceAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) # don't give user an option @@ -11,7 +11,7 @@ # GBX_REQUIRE_LIBS( build LIB ${lib_name} ${proj_libs} ) if( build ) - + include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) include( ${GBX_CMAKE_DIR}/UseIceUtil.cmake ) Modified: gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxSmartBatteryAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} ON ) @@ -12,16 +12,16 @@ if( build ) include( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) - + file( GLOB hdrs *.h ) file( GLOB srcs *.cpp ) - + GBX_ADD_LIBRARY( ${lib_name} DEFAULT ${lib_version} ${srcs} ) target_link_libraries( ${lib_name} ${dep_libs} ) GBX_ADD_PKGCONFIG( ${lib_name} "Interface library for Ocean Server battery systems" proj_libs dep_libs "" "" ${lib_version} ) - + GBX_ADD_HEADERS( gbxsmartbatteryacfr ${hdrs} ) - + if( GBX_BUILD_TESTS ) add_subdirectory( test ) endif( GBX_BUILD_TESTS ) Modified: gearbox/trunk/src/gbxutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxutilacfr/CMakeLists.txt 2009-10-27 03:02:57 UTC (rev 447) +++ gearbox/trunk/src/gbxutilacfr/CMakeLists.txt 2009-10-28 13:16:07 UTC (rev 448) @@ -1,6 +1,6 @@ set( lib_name GbxUtilAcfr ) set( lib_version 1.0.0 ) -GBX_ADD_LICENSE( LGPL ) +GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) GBX_REQUIRE_OPTION( build LIB ${lib_name} ON ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2009-11-06 06:58:36
|
Revision: 450 http://gearbox.svn.sourceforge.net/gearbox/?rev=450&view=rev Author: russo2503v Date: 2009-11-06 06:58:26 +0000 (Fri, 06 Nov 2009) Log Message: ----------- detect 64bitness Modified Paths: -------------- gearbox/trunk/cmake/SetupOs.cmake gearbox/trunk/doc/buildsys.dox Modified: gearbox/trunk/cmake/SetupOs.cmake =================================================================== --- gearbox/trunk/cmake/SetupOs.cmake 2009-11-01 12:05:08 UTC (rev 449) +++ gearbox/trunk/cmake/SetupOs.cmake 2009-11-06 06:58:26 UTC (rev 450) @@ -27,6 +27,16 @@ if( GBX_OS_LINUX ) message( STATUS "Running on Linux" ) + + # 32 or 64 bit Linux + # Set the library directory suffix accordingly + IF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") + SET (GBX_PROC_64BIT TRUE BOOL INTERNAL) + MESSAGE (STATUS "Linux x86_64 Target Detected") + ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64") + MESSAGE (STATUS "Linux ppc64 Target Detected") + SET (GBX_PROC_64BIT TRUE BOOL INTERNAL) + ENDIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") endif( GBX_OS_LINUX ) if( GBX_OS_QNX ) Modified: gearbox/trunk/doc/buildsys.dox =================================================================== --- gearbox/trunk/doc/buildsys.dox 2009-11-01 12:05:08 UTC (rev 449) +++ gearbox/trunk/doc/buildsys.dox 2009-11-06 06:58:26 UTC (rev 450) @@ -1,5 +1,5 @@ /* - * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics + * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ * Copyright (c) 2008 GearBox Team * @@ -26,7 +26,7 @@ Builds are controlled by a set of files called 'CMakeLists.txt'. There is approximately one in each directory, and builds descend recursively through the source tree. -An individual developer only needs to be concerned with writing CMakeLists.txt files in the directory containing his or her library code and below. +An individual developer only needs to be concerned with writing CMakeLists.txt files in the directory containing his or her library code and below. @section gbx_doc_buildsys_example Example @@ -49,7 +49,7 @@ GBX_REQUIRE_TARGETS( build LIB ${lib_name} ${dep_libs} ) IF ( build ) - + INCLUDE( ${GBX_CMAKE_DIR}/UseBasicRules.cmake ) FILE( GLOB hdrs *.h ) @@ -68,7 +68,7 @@ @verbatim SET ( lib_name GbxAdvanced ) @endverbatim -All variables in CMake contain text. Assignment is done with SET function. (The C++ equivalent of this line: <code>string lib_name = "GbxAdvanced"</code>). +All variables in CMake contain text. Assignment is done with SET function. (The C++ equivalent of this line: <code>string lib_name = "GbxAdvanced"</code>). - You can get more information on this and all other CMake commands. @verbatim $ cmake --help-command SET @@ -76,8 +76,8 @@ Notice the GearBox convention for naming CMake variables: - All "local" variables created in this CMakeLists.txt are in low case, e.g. @c lib_name. -- All "global" variables created somewhere else are in upper case. -- All custom "global" variables created by GearBox start with "GBX_", e.g. @c GBX_CMAKE_DIR. +- All "global" variables created somewhere else are in upper case. +- All custom "global" variables created by GearBox start with "GBX_", e.g. @c GBX_CMAKE_DIR. - Note that the standard CMake variables are also in upper case and some start with "CMAKE_", e.g. @c CMAKE_INSTALL_PREFIX and some don't, e.g. @c PROJECT_NAME. @verbatim @@ -97,14 +97,14 @@ Any text following "#" is a comment. Use them to explain uncommon usage. This GearBox macro checks for user input into the build process. It is actually a shortcut which does several things: -- Defines a CMake cache variable called @c BUILD_LIB_GBXADVANCED which can be used a user-controlled switch for turning compilation of this library ON and OFF. You will see this option when you run the @c ccmake tool. The option variable is defined the very first time CMake is run, and it is assigned the specified default value (ON). +- Defines a CMake cache variable called @c BUILD_LIB_GBXADVANCED which can be used a user-controlled switch for turning compilation of this library ON and OFF. You will see this option when you run the @c ccmake tool. The option variable is defined the very first time CMake is run, and it is assigned the specified default value (ON). - Every time CMake runs, it checks the current value of the @c BUILD_LIB_GBXADVANCED variable. If the user configured it FALSE, then the value of @c build variable will also become FALSE. - If it is decided that the library will not be built due to user input a corresponding entry will be added to a global list and the name of the library will be printed out at the end of the CMake process under the "Will NOT build..." heading. Notice that to evaluate the variable you have to inclose it in braces and add a dollar sign, i.e. @c ${lib_name}. Without this, CMake would just treat it as text. (Similar to the UNIX shells). This macro is quite flexible. You can specify custom names for the option variables and provide a custom description. - - Here's the complete signature. + - Here's the complete signature. @verbatim GBX_REQUIRE_OPTION( cumulative_var [EXE | LIB] module_name default_option_value [option_name] [option_description] ) @endverbatim @@ -153,7 +153,7 @@ FILE( GLOB hdrs *.h ) FILE( GLOB srcs *.cpp ) @endverbatim -Search for file in the current directory which fit the specified pattern and assign the list to the variables @c hdrs and @c srcs. +Search for file in the current directory which fit the specified pattern and assign the list to the variables @c hdrs and @c srcs. - Instead of searching you can just list the files you need. @verbatim SET( srcs util.cpp ) @@ -167,7 +167,7 @@ @c GBX_ADD_LIBRARY is a custom GearBox macro. It does several things: - Actually defines a library target (with a standard command @c ADD_LIBRARY ). In Linux, this will produce @c libGbxAdvanced.so or @c libGbxAdvanced.a -- Specifies library type. Valid options are SHARED, STATIC, or DEFAULT (the prefered option). DEFAULT is resolved to the user-specified variable GBX_DEFAULT_LIB_TYPE (which initially is set to SHARED). +- Specifies library type. Valid options are SHARED, STATIC, or DEFAULT (the prefered option). DEFAULT is resolved to the user-specified variable GBX_DEFAULT_LIB_TYPE (which initially is set to SHARED). - Specifies standard installation directory: @c [PREFIX]/lib/gearbox/ - Adds the name of the library to the global list of libraries which will be built (for feedback). @@ -212,6 +212,11 @@ GBX_OS_WIN @endverbatim +Under Linux, an additional variable if defined +@verbatim +GBX_PROC_64BIT +@endverbatim + Path variables for the current project: @verbatim GBX_BIN_INSTALL_DIR This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2009-11-07 03:39:50
|
Revision: 454 http://gearbox.svn.sourceforge.net/gearbox/?rev=454&view=rev Author: russo2503v Date: 2009-11-07 03:39:30 +0000 (Sat, 07 Nov 2009) Log Message: ----------- revised directory setup and package-congif Modified Paths: -------------- gearbox/trunk/cmake/SetupDirectories.cmake gearbox/trunk/cmake/TargetUtils.cmake gearbox/trunk/cmake/WritePackageConfig.cmake gearbox/trunk/cmake/internal/gearbox-config-internal.cmake gearbox/trunk/doc/buildsys.dox Added Paths: ----------- gearbox/trunk/cmake/internal/config-external.cmake.in gearbox/trunk/cmake/internal/config-version.cmake.in Removed Paths: ------------- gearbox/trunk/cmake/internal/gearbox-config-version.cmake.in gearbox/trunk/cmake/internal/gearbox-config.cmake Modified: gearbox/trunk/cmake/SetupDirectories.cmake =================================================================== --- gearbox/trunk/cmake/SetupDirectories.cmake 2009-11-06 07:11:29 UTC (rev 453) +++ gearbox/trunk/cmake/SetupDirectories.cmake 2009-11-07 03:39:30 UTC (rev 454) @@ -69,19 +69,35 @@ message( STATUS "Installation directory was set to ${CMAKE_INSTALL_PREFIX}" ) # special installation directories -set( GBX_BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin ) -set( GBX_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME} ) -set( GBX_SHARE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} ) +set( GBX_BIN_INSTALL_SUFFIX bin ) +set( GBX_INCLUDE_INSTALL_SUFFIX include/${PROJECT_NAME} ) +set( GBX_SHARE_INSTALL_SUFFIX share/${PROJECT_NAME} ) +set( GBX_CMAKE_INSTALL_SUFFIX ${GBX_SHARE_INSTALL_SUFFIX}/cmake ) -IF (GBX_PROC_64BIT) - set( GBX_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib64/${PROJECT_NAME} ) -ELSE (GBX_PROC_64BIT) - set( GBX_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME} ) -ENDIF(GBX_PROC_64BIT) +if( GBX_PROC_64BIT ) + set( GBX_LIB_INSTALL_SUFFIX lib64/${PROJECT_NAME} ) + set( GBX_PKGCONFIG_INSTALL_SUFFIX lib64/pkgconfig ) +else() + set( GBX_LIB_INSTALL_SUFFIX lib/${PROJECT_NAME} ) + set( GBX_PKGCONFIG_INSTALL_SUFFIX lib/pkgconfig ) +endif() +# by convention, we install cmake package-config files with the libraries +set( GBX_CMAKE_PKGCONFIG_INSTALL_SUFFIX ${GBX_LIB_INSTALL_SUFFIX} ) + +# now the acutal install directories +set( GBX_BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_BIN_INSTALL_SUFFIX} ) +set( GBX_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_INCLUDE_INSTALL_SUFFIX} ) +set( GBX_SHARE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_SHARE_INSTALL_SUFFIX} ) +set( GBX_CMAKE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_CMAKE_INSTALL_SUFFIX} ) +set( GBX_CMAKE_PKGCONFIG_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_CMAKE_PKGCONFIG_INSTALL_SUFFIX} ) +set( GBX_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_LIB_INSTALL_SUFFIX} ) +set( GBX_PKGCONFIG_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_PKGCONFIG_INSTALL_SUFFIX} ) + + # # It's sometimes useful to refer to the top level of the project. -# CMake does not make it very easy. +# CMake provides the right variables but, as all variables, they are poorly documented. # -set( GBX_PROJECT_SOURCE_DIR ${${PROJECT_NAME}_SOURCE_DIR} ) -set( GBX_PROJECT_BINARY_DIR ${${PROJECT_NAME}_BINARY_DIR} ) +set( GBX_PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR} ) +set( GBX_PROJECT_BINARY_DIR ${PROJECT_BINARY_DIR} ) Modified: gearbox/trunk/cmake/TargetUtils.cmake =================================================================== --- gearbox/trunk/cmake/TargetUtils.cmake 2009-11-06 07:11:29 UTC (rev 453) +++ gearbox/trunk/cmake/TargetUtils.cmake 2009-11-07 03:39:30 UTC (rev 454) @@ -39,6 +39,7 @@ # Executables should add themselves by calling 'GBX_ADD_EXECUTABLE' # instead of 'ADD_EXECUTABLE' in CMakeLists.txt. # Usage is the same as ADD_EXECUTABLE, all parameters are passed to ADD_EXECUTABLE. +# See SetupDirectories.cmake for definition of the install directory. # macro( GBX_ADD_EXECUTABLE name ) if( COMMAND cmake_policy ) @@ -49,7 +50,8 @@ # set_target_properties( ${name} PROPERTIES # INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}" # BUILD_WITH_INSTALL_RPATH TRUE ) - install( TARGETS ${name} RUNTIME DESTINATION bin ) + install( TARGETS ${name} RUNTIME + DESTINATION ${GBX_BIN_INSTALL_SUFFIX} ) set( templist ${EXE_LIST} ) list( APPEND templist ${name} ) # message( STATUS "DEBUG: ${templist}" ) @@ -67,6 +69,7 @@ # distinct from the Gearbox distribution version, as each library will change its # API independently. # All extra parameters are passed to ADD_LIBRARY as source files. +# See SetupDirectories.cmake for definition of the install directory. # macro( GBX_ADD_LIBRARY name type soversion ) if( COMMAND cmake_policy ) @@ -90,16 +93,10 @@ SOVERSION ${soversion} ) # INSTALL_RPATH "${INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}" # BUILD_WITH_INSTALL_RPATH TRUE ) - - if (GBX_PROC_64BIT) + install( TARGETS ${name} - DESTINATION lib64/${PROJECT_NAME} + DESTINATION ${GBX_LIB_INSTALL_SUFFIX} EXPORT ${PROJECT_NAME}-targets ) - else (GBX_PROC_64BIT) - install( TARGETS ${name} - DESTINATION lib/${PROJECT_NAME} - EXPORT ${PROJECT_NAME}-targets ) - ENDIF (GBX_PROC_64BIT) set( templist ${LIB_LIST} ) list( APPEND templist ${name}-${soversion} ) @@ -117,11 +114,12 @@ # GBX_ADD_HEADERS( install_subdir FILE0 [FILE1 FILE2 ...] ) # # Specialization of install(FILES ...) to install header files. -# All files are installed into PREFIX/include/${PROJECT_NAME}/${install_subdir} +# See SetupDirectories.cmake for definition of the install directory. # macro( GBX_ADD_HEADERS install_subdir ) if( GBX_INSTALL_HEADERS ) - install( FILES ${ARGN} DESTINATION include/${PROJECT_NAME}/${install_subdir} ) + install( FILES ${ARGN} + DESTINATION ${GBX_INCLUDE_INSTALL_SUFFIX}/${install_subdir} ) endif() endmacro( GBX_ADD_HEADERS install_subdir ) @@ -129,11 +127,12 @@ # GBX_ADD_SHARED_FILES( install_subdir FILE0 [FILE1 FILE2 ...] ) # # Specialization of install(FILES ...) to install shared files. -# All files are installed into PREFIX/share/${PROJECT_NAME}/${install_subdir} directory. +# See SetupDirectories.cmake for definition of the install directory. # macro( GBX_ADD_SHARED_FILES install_subdir ) if( GBX_INSTALL_SHARED_FILES ) - install( FILES ${ARGN} DESTINATION share/${PROJECT_NAME}/${install_subdir} ) + install( FILES ${ARGN} + DESTINATION ${GBX_SHARE_INSTALL_SUFFIX}/${install_subdir} ) endif() endmacro( GBX_ADD_SHARED_FILES install_subdir ) @@ -141,11 +140,12 @@ # GBX_ADD_CMAKE_SCRIPTS( FILE0 [FILE1 FILE2 ...] ) # # Specialization of install(FILES ...) to install CMake scripts. -# All files are installed into PREFIX/share/cmake/Modules directory. +# See SetupDirectories.cmake for definition of the install directory. # macro( GBX_ADD_CMAKE_SCRIPTS ) if( GBX_INSTALL_CMAKE_SCRIPTS ) - install( FILES ${ARGN} DESTINATION share/cmake/Modules ) + install( FILES ${ARGN} + DESTINATION ${GBX_CMAKE_INSTALL_SUFFIX} ) endif() endmacro( GBX_ADD_CMAKE_SCRIPTS ) @@ -160,8 +160,11 @@ macro( GBX_ADD_EXAMPLE install_subdir makefile.in makefile.out ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${makefile.in} ${CMAKE_CURRENT_BINARY_DIR}/${makefile.out} @ONLY) if( GBX_INSTALL_EXAMPLES ) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${makefile.out} DESTINATION share/${PROJECT_NAME}/${install_subdir} RENAME CMakeLists.txt ) - install( FILES ${ARGN} DESTINATION share/${PROJECT_NAME}/${install_subdir} ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${makefile.out} + DESTINATION ${GBX_SHARE_INSTALL_SUFFIX}/${install_subdir} + RENAME CMakeLists.txt ) + install( FILES ${ARGN} + DESTINATION ${GBX_SHARE_INSTALL_SUFFIX}/${install_subdir} ) endif() endmacro( GBX_ADD_EXAMPLE install_subdir makefile ) @@ -176,6 +179,7 @@ # libflags is appended to the "Libs" value. # version is the soversion of the library. # that should be linked with at the same time as linking to this library. +# See SetupDirectories.cmake for definition of the install directory. # macro( GBX_ADD_PKGCONFIG name desc ext_deps int_deps cflags libflags version ) set( PKG_NAME ${name} ) @@ -191,14 +195,13 @@ endforeach( item ${${int_deps}} ) endif( ${int_deps} ) - configure_file( ${GBX_CMAKE_DIR}/pkgconfig.in ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc @ONLY) + configure_file( ${GBX_CMAKE_DIR}/pkgconfig.in + ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc + @ONLY) if( GBX_INSTALL_PKGCONFIGS ) - IF (GBX_PROC_64BIT) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc DESTINATION lib64/pkgconfig/ ) - ELSE (GBX_PROC_64BIT) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc DESTINATION lib/pkgconfig/ ) - ENDIF(GBX_PROC_64BIT) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.pc + DESTINATION ${GBX_PKGCONFIG_INSTALL_SUFFIX} ) endif() endmacro( GBX_ADD_PKGCONFIG name desc cflags deps libflags libs ) @@ -376,7 +379,8 @@ string( TOUPPER ${PROJECT_NAME} upper_project_name ) write_file( ${output_file} "set( ${upper_project_name}_MANIFEST_LOADED 1)" APPEND ) - install( FILES ${output_file} DESTINATION . ) + install( FILES ${output_file} + DESTINATION . ) endmacro( GBX_WRITE_MANIFEST ) macro( GBX_WRITE_LICENSE ) Modified: gearbox/trunk/cmake/WritePackageConfig.cmake =================================================================== --- gearbox/trunk/cmake/WritePackageConfig.cmake 2009-11-06 07:11:29 UTC (rev 453) +++ gearbox/trunk/cmake/WritePackageConfig.cmake 2009-11-07 03:39:30 UTC (rev 454) @@ -1,39 +1,36 @@ +# +# Generate and install files to be used with CMake's PackageConfig system. +# (This is different from Linux's PkgConfig) +# set( _input_dir ${PROJECT_SOURCE_DIR}/cmake/internal ) set( _output_dir ${PROJECT_BINARY_DIR} ) -set( _destination lib/${PROJECT_NAME} ) +set( _destination ${GBX_CMAKE_PKGCONFIG_INSTALL_SUFFIX} ) -# set( _input_file config-internal.cmake.in ) -# set( _output_file ${PROJECT_NAME}-config-internal.cmake ) -# configure_file( -# ${_input_dir}/${_input_file} -# ${_output_dir}/${_output_file} -# @ONLY ) - -# set( _input_file config-external.cmake.in ) +set( _input_file config-external.cmake.in ) set( _output_file ${PROJECT_NAME}-config.cmake ) -# configure_file( -# ${_input_dir}/${_input_file} -# ${_output_dir}/${_output_file} -# @ONLY ) -install( - FILES ${_input_dir}/${_output_file} +configure_file( + ${_input_dir}/${_input_file} + ${_output_dir}/${_output_file} + @ONLY ) +install( + FILES ${_output_dir}/${_output_file} DESTINATION ${_destination} ) -set( _input_file ${PROJECT_NAME}-config-version.cmake.in ) +set( _input_file config-version.cmake.in ) set( _output_file ${PROJECT_NAME}-config-version.cmake ) -configure_file( +configure_file( ${_input_dir}/${_input_file} ${_output_dir}/${_output_file} @ONLY ) -install( +install( FILES ${_output_dir}/${_output_file} DESTINATION ${_destination} ) # export targets -install( - EXPORT ${PROJECT_NAME}-targets -# NAMESPACE import_ +install( + EXPORT ${PROJECT_NAME}-targets +# NAMESPACE import_ DESTINATION ${_destination} ) set( _input_dir ) Copied: gearbox/trunk/cmake/internal/config-external.cmake.in (from rev 453, gearbox/trunk/cmake/internal/gearbox-config.cmake) =================================================================== --- gearbox/trunk/cmake/internal/config-external.cmake.in (rev 0) +++ gearbox/trunk/cmake/internal/config-external.cmake.in 2009-11-07 03:39:30 UTC (rev 454) @@ -0,0 +1,35 @@ +# Find resources installed by Gearbox. +# To be used by external CMake projects. +# + +set( GEARBOX_FOUND 1 ) + +# this is the installed location of <package>-config.cmake file +get_filename_component( _found_dir "${CMAKE_CURRENT_LIST_FILE}" PATH ) + +# load all exported Gearbox targets +include( ${_found_dir}/gearbox-targets.cmake ) + +# assume that gearbox-config.cmake was installed into +# <install-root>/lib/gearbox/ +set( _install_dir "${_found_dir}/../../" ) + +get_filename_component( + GEARBOX_INCLUDE_DIR + "${_install_dir}/@GBX_INCLUDE_INSTALL_SUFFIX@" + ABSOLUTE ) + +get_filename_component( + GEARBOX_CMAKE_DIR + "${_install_dir}/@GBX_CMAKE_INSTALL_SUFFIX@" + ABSOLUTE ) +# this is where the use-file can be found +set( GEARBOX_USE_FILE "${GEARBOX_CMAKE_DIR}/gearbox-use-file.cmake" ) + +get_filename_component( + GEARBOX_LINK_DIR + "${_install_dir}/@GBX_LIB_INSTALL_SUFFIX@" + ABSOLUTE ) + +set( _found_dir ) +set( _install_dir ) Copied: gearbox/trunk/cmake/internal/config-version.cmake.in (from rev 453, gearbox/trunk/cmake/internal/gearbox-config-version.cmake.in) =================================================================== --- gearbox/trunk/cmake/internal/config-version.cmake.in (rev 0) +++ gearbox/trunk/cmake/internal/config-version.cmake.in 2009-11-07 03:39:30 UTC (rev 454) @@ -0,0 +1,8 @@ +set( PACKAGE_VERSION @GBX_PROJECT_VERSION@ ) + +if( "${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @GBX_PROJECT_VERSION_MAJOR@ ) +if( "${PACKAGE_FIND_VERSION_MINOR}" EQUAL @GBX_PROJECT_VERSION_MINOR@ ) + set( PACKAGE_VERSION_COMPATIBLE 1 ) + set( PACKAGE_VERSION_EXACT 1 ) +endif() +endif() Modified: gearbox/trunk/cmake/internal/gearbox-config-internal.cmake =================================================================== --- gearbox/trunk/cmake/internal/gearbox-config-internal.cmake 2009-11-06 07:11:29 UTC (rev 453) +++ gearbox/trunk/cmake/internal/gearbox-config-internal.cmake 2009-11-07 03:39:30 UTC (rev 454) @@ -1,5 +1,9 @@ -set( GEARBOX_FOUND 1 ) +# Find resources contained within Gearbox. +# To be used by CMake projects co-located with Gearbox within one "super-project". +# +set( GEARBOX_FOUND 1 ) + # This is potentially problematic: installed directory structure is different from in-source one. set( GEARBOX_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/gearbox/src" ) @@ -7,5 +11,5 @@ set( GEARBOX_USE_FILE "${GEARBOX_CMAKE_DIR}/gearbox-use-file.cmake" ) -# this is where Gearbox libs will be installed -set( GEARBOX_LINK_DIR ${CMAKE_INSTALL_PREFIX}/lib/gearbox ) +# this is where Gearbox libs will be installed +set( GEARBOX_LINK_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_LIB_INSTALL_DIR} ) Deleted: gearbox/trunk/cmake/internal/gearbox-config-version.cmake.in =================================================================== --- gearbox/trunk/cmake/internal/gearbox-config-version.cmake.in 2009-11-06 07:11:29 UTC (rev 453) +++ gearbox/trunk/cmake/internal/gearbox-config-version.cmake.in 2009-11-07 03:39:30 UTC (rev 454) @@ -1,8 +0,0 @@ -set( PACKAGE_VERSION @GBX_PROJECT_VERSION@ ) - -if( "${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @GBX_PROJECT_VERSION_MAJOR@ ) -if( "${PACKAGE_FIND_VERSION_MINOR}" EQUAL @GBX_PROJECT_VERSION_MINOR@ ) - set( PACKAGE_VERSION_COMPATIBLE 1 ) - set( PACKAGE_VERSION_EXACT 1 ) -endif() -endif() Deleted: gearbox/trunk/cmake/internal/gearbox-config.cmake =================================================================== --- gearbox/trunk/cmake/internal/gearbox-config.cmake 2009-11-06 07:11:29 UTC (rev 453) +++ gearbox/trunk/cmake/internal/gearbox-config.cmake 2009-11-07 03:39:30 UTC (rev 454) @@ -1,35 +0,0 @@ -# Find Gearbox includes and library. -# -# - -set( GEARBOX_FOUND 1 ) - -# this is the installed location of <package>-config.cmake file -get_filename_component( _found_dir "${CMAKE_CURRENT_LIST_FILE}" PATH ) - -# load all exported Gearbox targets -include( ${_found_dir}/gearbox-targets.cmake ) - -# assume that gearbox-config.cmake was installed into -# <install-root>/lib/gearbox/ -set( _install_dir "${_found_dir}/../../" ) - -get_filename_component( - GEARBOX_INCLUDE_DIR - "${_install_dir}/include/gearbox" - ABSOLUTE ) - -get_filename_component( - GEARBOX_CMAKE_DIR - "${_install_dir}/share/cmake/Modules" - ABSOLUTE ) - -set( GEARBOX_USE_FILE "${GEARBOX_CMAKE_DIR}/gearbox-use-file.cmake" ) - -get_filename_component( - GEARBOX_LINK_DIR - "${_install_dir}/lib/gearbox" - ABSOLUTE ) - -set( _found_dir ) -set( _install_dir ) Modified: gearbox/trunk/doc/buildsys.dox =================================================================== --- gearbox/trunk/doc/buildsys.dox 2009-11-06 07:11:29 UTC (rev 453) +++ gearbox/trunk/doc/buildsys.dox 2009-11-07 03:39:30 UTC (rev 454) @@ -217,14 +217,31 @@ GBX_PROC_64BIT @endverbatim -Path variables for the current project: +Source and binary directories can be distinguished as so @verbatim +GBX_PROJECT_BINARY_DIR +GBX_PROJECT_SOURCE_DIR +@endverbatim + +Install directories can be referenced with absolute paths +@verbatim GBX_BIN_INSTALL_DIR +GBX_CMAKE_INSTALL_DIR +GBX_CMAKE_PKGCONFIG_INSTALL_DIR +GBX_INCLUDE_INSTALL_DIR GBX_LIB_INSTALL_DIR -GBX_INCLUDE_INSTALL_DIR -GBX_PROJECT_BINARY_DIR -GBX_PROJECT_SOURCE_DIR +GBX_PKGCONFIG_INSTALL_DIR GBX_SHARE_INSTALL_DIR @endverbatim +.. or path relative to the install directory +@verbatim +GBX_BIN_INSTALL_SUFFIX +GBX_CMAKE_INSTALL_SUFFIX +GBX_CMAKEPKGCONFIG_INSTALL_SUFFIX +GBX_INCLUDE_INSTALL_SUFFIX +GBX_LIB_INSTALL_SUFFIX +GBX_PKGCONFIG_INSTALL_SUFFIX +GBX_SHARE_INSTALL_SUFFIX +@endverbatim */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2009-11-08 11:51:38
|
Revision: 457 http://gearbox.svn.sourceforge.net/gearbox/?rev=457&view=rev Author: borax00 Date: 2009-11-08 11:51:23 +0000 (Sun, 08 Nov 2009) Log Message: ----------- MR Changes Modified Paths: -------------- gearbox/trunk/doc/history.dox gearbox/trunk/src/gbxgarminacfr/driver.cpp gearbox/trunk/src/gbxgarminacfr/driver.h gearbox/trunk/src/gbxgarminacfr/nmea.cpp gearbox/trunk/src/gbxgarminacfr/nmea.h gearbox/trunk/src/gbxgarminacfr/test/test.cpp gearbox/trunk/src/gbxsickacfr/messages.cpp gearbox/trunk/src/gbxsickacfr/test/test.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverhealthchecks.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h gearbox/trunk/src/gbxsmartbatteryacfr/test/darttest/checksumtest.cpp gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp gearbox/trunk/src/gbxutilacfr/exceptions.cpp gearbox/trunk/src/gbxutilacfr/exceptions.h Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/doc/history.dox 2009-11-08 11:51:23 UTC (rev 457) @@ -46,6 +46,13 @@ @par Updated libraries +-libGbxSmartBatteryAcfr (tobi) + - improved robustness by encapsulating data of the oceanserversystem class and implementing access/set and check-for-empty functions + - improved healthcheck functions + - bug fix related to initialisation + - improved exception and error handling + - added a raw data record to the oceanserversystem data record useful for debugging + - libflexiport - The UDP port type now properly supports sending and receiving broadcast packets on all operating systems. (GeoffB) @@ -56,7 +63,7 @@ - Thread class: now derives from gbxutilacfr::Stoppable. No changes in user code are requried. (alexm) - Function checkedSleep() is defined in terms of the new light interface class gbxutilacfr::Stoppable. No changes in user code are required. (alexm) - - Implemented store::peek() (Alexb) + - Implemented store::peek() (AlexB) - libGbxUtilAcfr: - Status class: removed SubsystemStalled from the list of health types for a subsystem. The stall condition Modified: gearbox/trunk/src/gbxgarminacfr/driver.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/driver.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxgarminacfr/driver.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -23,16 +23,17 @@ #include "driver.h" using namespace std; -using namespace gbxgarminacfr; /////////////////////////////////////// +namespace gbxgarminacfr { + namespace { // Get the useful bits from a GGA message -GenericData* extractGgaData( gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) +GenericData* extractGgaData( const gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) { - GgaData* data = new GgaData; + std::auto_ptr<GgaData> data( new GgaData ); data->timeStampSec = timeSec; data->timeStampUsec = timeUsec; @@ -58,7 +59,7 @@ data->longitude = 0.0; data->altitude = 0.0; data->geoidalSeparation = 0.0; - return data; + return data.release(); case '1': data->fixType = Autonomous; break; @@ -84,18 +85,20 @@ data->longitude=dir*(deg+(min/60.0)); //altitude - data->altitude=atof(msg.getDataToken(Hgt).c_str()); + data->isAltitudeKnown = !msg.isDataTokenEmpty(Hgt); + if ( data->isAltitudeKnown ) + data->altitude=atof(msg.getDataToken(Hgt).c_str()); //geoidal Separation data->geoidalSeparation=atof(msg.getDataToken(GeoidHgt).c_str()); - return data; + return data.release(); } // VTG provides velocity and heading information -GenericData* extractVtgData( gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) +GenericData* extractVtgData( const gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) { - VtgData* data = new VtgData; + std::auto_ptr<VtgData> data( new VtgData ); data->timeStampSec = timeSec; data->timeStampUsec = timeUsec; @@ -104,15 +107,16 @@ enum VtgTokens{MsgType=0,HeadingTrue,T,HeadingMag,M,SpeedKnots, N,SpeedKPH,K,ModeInd}; - //Check for an empty string. Means that we are not moving - //When the message has empty fields tokeniser skips so we get the next field inline. - if( msg.getDataToken(HeadingTrue)[0] == 'T' ) { - data->headingTrue=0.0; - data->headingMagnetic=0.0; - data->speed=0.0; - // NOTE: not processing the rest! - return data; + //Check for an empty string. Means that we can't tell anything useful. + if ( msg.isDataTokenEmpty(HeadingTrue) ) + { + data->isValid = false; + data->headingTrue = 0.0; + data->headingMagnetic = 0.0; + data->speed = 0.0; + return data.release(); } + data->isValid = true; // true heading double headingRad = DEG2RAD(atof(msg.getDataToken(HeadingTrue).c_str())); @@ -128,16 +132,16 @@ data->speed=atof(msg.getDataToken(SpeedKPH).c_str()); data->speed*=(1000/3600.0); - return data; + return data.release(); } // RME message. This one is garmin specific... Give position error estimates // See doc.dox for a discussion of the position errors as reported here. // Essentially the EPE reported by the garmin is a 1 sigma error (RMS) or a // 68% confidence bounds. -GenericData* extractRmeData( gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) +GenericData* extractRmeData( const gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) { - RmeData* data = new RmeData; + std::auto_ptr<RmeData> data( new RmeData ); data->timeStampSec = timeSec; data->timeStampUsec = timeUsec; @@ -145,11 +149,33 @@ //Names for the RME message items enum RmeTokens{MsgType=0,HError,M1,VError,M2,EPE,M3}; + if ( msg.isDataTokenEmpty(HError) ) + { + // No valid information + data->isValid = false; + data->isVerticalPositionErrorValid = false; + data->horizontalPositionError = 0.0; + data->verticalPositionError = 0.0; + data->estimatedPositionError = 0.0; + return data.release(); + } + data->isValid = true; + data->horizontalPositionError = atof(msg.getDataToken(HError).c_str()); - data->verticalPositionError = atof(msg.getDataToken(VError).c_str()); + if ( msg.isDataTokenEmpty(VError) ) + { + data->isVerticalPositionErrorValid = false; + data->verticalPositionError = -1; + } + else + { + data->isVerticalPositionErrorValid = true; + data->verticalPositionError = atof(msg.getDataToken(VError).c_str()); + } + data->estimatedPositionError = atof(msg.getDataToken(EPE).c_str()); - return data; + return data.release(); } } @@ -172,9 +198,9 @@ Config::toString() const { std::stringstream ss; - ss << "Garmin driver config: " << - "\tdevice="<<device << - "\twill read sentences: GPGGA="<<readGga<<" GPVTG="<<readVtg<<" PGRME="<<readRme; + ss << "Garmin driver config: " << endl + << "\tdevice="<<device << endl + << "\twill read sentences: GPGGA="<<readGga<<" GPVTG="<<readVtg<<" PGRME="<<readRme; return ss.str(); } @@ -209,7 +235,15 @@ Driver::~Driver() { - disableDevice(); + // Don't throw from destructors... + try { + disableDevice(); + } + catch ( const std::exception &e ) + { + cout << "Driver::~Driver: exception while disabling: " << e.what() << endl; + } + catch ( ... ) {} } void @@ -240,6 +274,7 @@ gbxgpsutilacfr::NmeaMessage disableAllMsg( "$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( disableAllMsg.sentence() ); + // alexb: what is this sleep for? sleep(1); if ( config_.readGga ) { @@ -247,7 +282,6 @@ serial_->writeString( enableGgaMsg.sentence() ); } - if ( config_.readVtg ) { gbxgpsutilacfr::NmeaMessage enableVtgMsg( "$PGRMO,GPVTG,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( enableVtgMsg.sentence() ); @@ -258,6 +292,7 @@ serial_->writeString( enableRmeMsg.sentence() ); } + // alexb: what is this sleep for? sleep(1); } @@ -273,11 +308,7 @@ Driver::read() { std::auto_ptr<GenericData> genericData; - gbxgpsutilacfr::NmeaMessage nmeaMessage; - // Make sure that we clear our internal data structures - // alexm: is this necessary? should NmeaMessage do it for itself? - memset((void*)(&nmeaMessage) , 0 , sizeof(nmeaMessage)); int nmeaExceptionCount = 0; int nmeaFailChecksumCount = 0; @@ -330,7 +361,7 @@ //Put it into the message object and checksum the data try { // This throws if it cannot find the * to deliminate the checksum field - nmeaMessage.setSentence( serialData.c_str(), gbxgpsutilacfr::TestChecksum ); + nmeaMessage.setSentence( serialData, gbxgpsutilacfr::TestChecksum ); } catch ( const gbxgpsutilacfr::NmeaException& e ) { //Don't throw on isolated checksum problems @@ -384,7 +415,10 @@ else throw gbxutilacfr::Exception( ERROR_INFO, "got unexpected GPGGA message" ); genericData.reset( extractGgaData( nmeaMessage, now.tv_sec, now.tv_usec ) ); - break; + if ( genericData.get() ) + break; + else + continue; } else if ( MsgType == "$GPVTG" ) { if ( config_.readVtg ) @@ -392,7 +426,10 @@ else throw gbxutilacfr::Exception( ERROR_INFO, "got unexpected GPVTG message" ); genericData.reset( extractVtgData( nmeaMessage, now.tv_sec, now.tv_usec ) ); - break; + if ( genericData.get() ) + break; + else + continue; } else if ( MsgType == "$PGRME" ) { if ( config_.readRme ) @@ -400,7 +437,10 @@ else throw gbxutilacfr::Exception( ERROR_INFO, "got unexpected PGRME message" ); genericData.reset( extractRmeData( nmeaMessage, now.tv_sec, now.tv_usec ) ); - break; + if ( genericData.get() ) + break; + else + continue; } else if ( MsgType == "$PGRMO" ) { //This message is sent by us to control msg transmission and then echoed by GPS @@ -415,8 +455,64 @@ else throw gbxutilacfr::Exception( ERROR_INFO, ss.str() ); } + } + return genericData; +} +std::string toString( const FixType &f ) +{ + switch ( f ) + { + case Invalid: return "Invalid"; + case Autonomous: return "Autonomous"; + case Differential: return "Differential"; + default: return "??"; } +} - return genericData; +std::string toString( const GgaData &d ) +{ + stringstream ss; + ss << endl; + ss << " timeStampSec : " << d.timeStampSec << endl + << " timeStampUsec : " << d.timeStampUsec << endl + << " utcTimeHrs : " << d.utcTimeHrs << endl + << " utcTimeMin : " << d.utcTimeMin << endl + << " utcTimeSec : " << d.utcTimeSec << endl + << " latitude : " << d.latitude << endl + << " longitude : " << d.longitude << endl + << " isAltitudeKnown : " << d.isAltitudeKnown << endl + << " altitude : " << d.altitude << endl + << " fixType : " << d.fixType << endl + << " satellites : " << d.satellites << endl + << " horizontalDilutionOfPosition : " << d.horizontalDilutionOfPosition << endl + << " geoidalSeparation : " << d.geoidalSeparation; + return ss.str(); } +std::string toString( const VtgData &d ) +{ + stringstream ss; + ss << endl; + ss << " timeStampSec : " << d.timeStampSec << endl + << " timeStampUsec : " << d.timeStampUsec << endl + << " isValid : " << d.isValid << endl + << " headingTrue : " << d.headingTrue << endl + << " headingMagnetic : " << d.headingMagnetic << endl + << " speed : " << d.speed; + return ss.str(); +} +std::string toString( const RmeData &d ) +{ + stringstream ss; + ss << endl; + ss << " timeStampSec : " << d.timeStampSec << endl + << " timeStampUsec : " << d.timeStampUsec << endl + << " isValid : " << d.isValid << endl + << " horizontalPositionError : " << d.horizontalPositionError << endl + << " isVerticalPositionErrorValid : " << d.isVerticalPositionErrorValid << endl + << " verticalPositionError : " << d.verticalPositionError << endl + << " estimatedPositionError : " << d.estimatedPositionError; + return ss.str(); +} + +} Modified: gearbox/trunk/src/gbxgarminacfr/driver.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/driver.h 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxgarminacfr/driver.h 2009-11-08 11:51:23 UTC (rev 457) @@ -85,6 +85,7 @@ //! Differentially corrected Differential }; +std::string toString( const FixType &f ); //! Fix data structure. Note that when fixType is Invalid, all other data except the time stamps //! are meaningless. @@ -114,7 +115,9 @@ double latitude; //! Longitude [degrees] double longitude; - //! Altitude [metres above ellipsoid] + //! Altitude is meaningful if and only if isAltitudeKnown + bool isAltitudeKnown; + //! Altitude [metres above ellipsoid] (only meaningful if isAltitudeKnown) double altitude; //! Fix type. When fixType is Invalid, all other data except the time stamps @@ -130,6 +133,9 @@ //! Height of geoid (mean sea level) above WGS84 ellipsoid [metres] double geoidalSeparation; }; +std::string toString( const GgaData &d ); +inline std::ostream &operator<<( std::ostream &s, const GgaData &d ) +{ return s << toString(d); } //! Vector track and speed over ground data structure. class VtgData : public GenericData @@ -143,6 +149,10 @@ //! Time (according to the computer clock) when data was measured. //! Number of microseconds int timeStampUsec; + + //! When false, means that the GPS unit can't make a valid measurement + //! (so all data other than the timestamp is meaningless). + bool isValid; //! Heading/track/course with respect to true North [rad] double headingTrue; @@ -151,6 +161,9 @@ //! Horizontal velocity [metres/second] double speed; }; +std::string toString( const VtgData &d ); +inline std::ostream &operator<<( std::ostream &s, const VtgData &d ) +{ return s << toString(d); } //! Gps data structure class RmeData : public GenericData @@ -165,6 +178,14 @@ //! Number of microseconds int timeStampUsec; + //! When false, means that the GPS unit can't make a valid measurement + //! (so all data other than the timestamp is meaningless). + bool isValid; + + //! When false, means that the GPS unit can't tell us anything + //! about our vertical error + bool isVerticalPositionErrorValid; + //! Horizontal position error: one standard deviation [metres)] double horizontalPositionError; //! Vertical position error: one standard deviation [metres] @@ -173,6 +194,9 @@ //! Estimated position error. double estimatedPositionError; }; +std::string toString( const RmeData &d ); +inline std::ostream &operator<<( std::ostream &s, const RmeData &d ) +{ return s << toString(d); } /*! Garmin GPS driver. Modified: gearbox/trunk/src/gbxgarminacfr/nmea.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmea.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxgarminacfr/nmea.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -12,33 +12,34 @@ #include <string> #include <iostream> #include <assert.h> +#include <sstream> #include <gbxutilacfr/tokenise.h> -////////////////////////////// +// ////////////////////////////// -// Ensure we have strnlen -// eg. Solaris doesn't define strnlen in string.h, so define it here. -#if !HAVE_STRNLEN +// // Ensure we have strnlen +// // eg. Solaris doesn't define strnlen in string.h, so define it here. +// #if !HAVE_STRNLEN -#include <cstring> +// #include <cstring> -// inline the fucker to guard against multiple inclusion, without the -// hassle of a special lib. -inline size_t strnlen(const char *s, size_t maxlen) -{ - char *p; - if (s == NULL) { - return maxlen; - } - p = (char *)memchr(s, 0, maxlen); - if (p == NULL) { - return maxlen; - } - return ((p - s) + 1); -} -#endif +// // inline the fucker to guard against multiple inclusion, without the +// // hassle of a special lib. +// inline size_t strnlen(const char *s, size_t maxlen) +// { +// char *p; +// if (s == NULL) { +// return maxlen; +// } +// p = (char *)memchr(s, 0, maxlen); +// if (p == NULL) { +// return maxlen; +// } +// return ((p - s) + 1); +// } +// #endif -////////////////////////////// +// ////////////////////////////// #include "nmea.h" @@ -57,39 +58,30 @@ void NmeaMessage::init() { - haveSentence_ = false; - haveTokens_ = false; haveCheckSum_ = false; checkSumOK_ = false; // Now clear the internal data store - sentence_[0] = 0; + sentence_.clear(); dataTokens_.clear(); } - -NmeaMessage::NmeaMessage(const char *sentence, int testCheckSum) +NmeaMessage::NmeaMessage(const std::string &sentence, NmeaMessageOptions addOrTestCheckSum) { init(); - setSentence(sentence,testCheckSum); + setSentence(sentence,addOrTestCheckSum); } //Load the data as requested and test the checksum if we are asked to. void -NmeaMessage::setSentence(const char *data, int AddOrTestCheckSum) +NmeaMessage::setSentence(const std::string &data, NmeaMessageOptions addOrTestCheckSum) { init(); - - strncpy(sentence_,data, MAX_SENTENCE_LEN); - //terminate just in case, Note that we have a buffer which is - //MAX_SENTENCE_LEN + 1 long! - - sentence_[MAX_SENTENCE_LEN] = '\0'; - haveSentence_ = true; + sentence_ = data; - switch ( AddOrTestCheckSum ) + switch ( addOrTestCheckSum ) { case TestChecksum: { // This is for Rx'd data that we need to test for correct reception @@ -106,7 +98,7 @@ case DontTestOrAddChecksum: break; default: - assert( true && "unrecognized message option" ); + assert( false && "unrecognized message option" ); } } @@ -116,34 +108,36 @@ haveCheckSum_ = true; checkSumOK_ = false; - //First save the checksum chars from the existing message - char* ptr; - char chksum_HIB,chksum_LOB; - //First save the existing two checksum chars from the message //These are straight after the '*' character - ptr = strchr(sentence_, NMEAChecksumDelim); - if ( !ptr ) { -// cout<<"device: no checksum delimiter"<<endl; + const size_t starPos = sentence_.find( NMEAChecksumDelim ); + if ( starPos == std::string::npos ) + { + // cout<<"device: no checksum delimiter"<<endl; return false; } + + if ( starPos+2 >= sentence_.size() ) + { + // cout<<"device: no checksum after delimiter"<<endl; + return false; + } //save the high and low bytes of the checksum //Make sure they are in upper case! - chksum_HIB = (char)toupper(*(++ptr)); - chksum_LOB = (char)toupper(*(ptr + 1)); - + const int checksumPos = starPos+1; + const char chksum_HIB = (char)toupper(sentence_[checksumPos]); + const char chksum_LOB = (char)toupper(sentence_[checksumPos+1]); //invalidate the existing checksum - *ptr = *(ptr+1) = 'x'; - - //****NOTE** We leave the ptr pointing at the first chksum byte - + sentence_[checksumPos] = 'x'; + sentence_[checksumPos+1] = 'x'; + //Re-calculate our own copy of the checksum addCheckSum(); //Now compare our saved version with our new ones - if( (chksum_HIB == *ptr) && (chksum_LOB == *(ptr+1)) ) { + if( (chksum_HIB == sentence_[checksumPos]) && (chksum_LOB == sentence_[checksumPos+1]) ) { //all looked good! checkSumOK_ = true; return true; @@ -160,9 +154,9 @@ // the checksum, and that the checksum delimiter is there void NmeaMessage::addCheckSum() -{ - assert( haveSentence_ && "calling addCheckSum() without a sentence" ); - +{ + assert( haveSentence() && "calling addCheckSum() without a sentence" ); + haveCheckSum_ = true; //check that we have the '$' at the start @@ -172,12 +166,11 @@ unsigned char chkRunning = 0; + // we start from 1 to skip the leading '$' int loopCount; - unsigned char nextChar; - // we start from 1 to skip the leading '$' - for( loopCount=1; loopCount<MAX_SENTENCE_LEN; ++loopCount ) + for ( loopCount = 1; loopCount < (int)(sentence_.size()); loopCount++ ) { - nextChar = static_cast<unsigned char>(sentence_[loopCount]); + unsigned char nextChar = static_cast<unsigned char>(sentence_[loopCount]); // no delimiter uh oh if( (nextChar=='\r') || (nextChar=='\n') || (nextChar=='\0') ) { @@ -196,9 +189,14 @@ // Keep the running XOR total chkRunning ^= nextChar; } + + if ( loopCount+2 >= (int)(sentence_.size()) ) + { + throw NmeaException("addCheckSum(): no space for checksum of '*' not found."); + } //Put the byte values as upper case HEX back into the message - sprintf( sentence_ + loopCount + 1,"%02X", chkRunning ); + sprintf( &(sentence_[loopCount + 1]),"%02X", chkRunning ); } // Parse the data fields of our message... @@ -218,3 +216,39 @@ //keep track of what we have done. haveTokens_ = true; } + +bool +NmeaMessage::isDataTokenEmpty(int i) const +{ + if ( i >= (int)(dataTokens_.size()) ) + { + stringstream ss; + ss << "NmeaMessage::" << __func__ + << ": attempt to getDataToken("<<i<<") but only " << dataTokens_.size() << " exist in sentence: " + << sentence_; + throw NmeaException( ss.str() ); + } + return dataTokens_[i].empty(); +} + +const std::string & +NmeaMessage::getDataToken(int i) const +{ + if ( i >= (int)(dataTokens_.size()) ) + { + stringstream ss; + ss << "NmeaMessage::" << __func__ + << ": attempt to getDataToken("<<i<<") but only " << dataTokens_.size() << " exist in sentence: " + << sentence_; + throw NmeaException( ss.str() ); + } + if ( dataTokens_[i].empty() ) + { + stringstream ss; + ss << "NmeaMessage::" << __func__ + << ": attempt to getDataToken("<<i<<") but this token is empty in sentence: " + << sentence_; + throw NmeaException( ss.str() ); + } + return dataTokens_[i]; +} Modified: gearbox/trunk/src/gbxgarminacfr/nmea.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmea.h 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxgarminacfr/nmea.h 2009-11-08 11:51:23 UTC (rev 457) @@ -78,14 +78,14 @@ { public: NmeaMessage(); - NmeaMessage(const char *sentence, int testCheckSum=DontTestOrAddChecksum ); + NmeaMessage(const std::string &sentence, NmeaMessageOptions addOrTestCheckSum=DontTestOrAddChecksum ); // Set up the internal data for a sentence. // May throw NmeaException if TestChecksum is specified. - void setSentence(const char *data, int testCheckSum=DontTestOrAddChecksum ); + void setSentence(const std::string &data, NmeaMessageOptions addOrTestCheckSum=DontTestOrAddChecksum ); - // Do we only have the raw string? - bool haveSentence() const { return haveSentence_; }; + // Do we have the raw string? + bool haveSentence() const { return !sentence_.empty(); }; // Do we have parsed fields? bool haveTokens() const { return haveTokens_; }; @@ -101,11 +101,14 @@ bool testChecksumOk(); // Return the raw sentence string - const char* sentence() { return sentence_; }; + const std::string &sentence() const { return sentence_; }; - // Return a single data token as a string - std::string& getDataToken(int i) { return dataTokens_[i]; }; + // Return a single data token as a string. + // Throws an exception if that token is empty (see 'isDataTokenEmpty()') + const std::string &getDataToken(int i) const; + bool isDataTokenEmpty(int i) const; + // Return the number of fields int numDataTokens() const { return dataTokens_.size(); }; @@ -116,15 +119,14 @@ void init(); // May throw NmeaException. void addCheckSum(); - // Do we only have the raw string ? - bool haveSentence_; // Have we parsed data into tokens ? bool haveTokens_; // Have we a checksum and is it valid? bool haveCheckSum_; bool checkSumOK_; // The raw sentence, allow for terminator - char sentence_[MAX_SENTENCE_LEN+1]; +// char sentence_[MAX_SENTENCE_LEN+1]; + std::string sentence_; // The tokenised data std::vector<std::string> dataTokens_; }; Modified: gearbox/trunk/src/gbxgarminacfr/test/test.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/test/test.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxgarminacfr/test/test.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -32,22 +32,31 @@ // defaults string port = "/dev/ttyS0"; bool quiet = false; + int numReads = 30; + int debugLevel = 5; // Get some options from the command line - while ((opt = getopt(argc, argv, "p:q")) != -1) + while ((opt = getopt(argc, argv, "p:n:d:q")) != -1) { switch ( opt ) { case 'p': port = optarg; break; + case 'n': + numReads=atoi(optarg); + break; + case 'd': + debugLevel=atoi(optarg); + break; case 'q': quiet = true; break; default: cout << "Usage: " << argv[0] << " [-p port]" << endl << endl - << "-p port\tPort the device is connected to. E.g. /dev/ttyS0" - << "-q \tMakes normal operation quiet, only errors are traced." << endl; + << "-p port \tPort the device is connected to. E.g. /dev/ttyS0" << endl + << "-n numReads\tNumber of times to read from the device" << endl + << "-q \tMakes normal operation quiet, only errors are traced." << endl; return 1; } } @@ -66,17 +75,16 @@ cout << "Using configuration: " << config.toString() << endl; // Instantiate objects to handle messages from the driver - bool debug = 5; if ( quiet ) - debug = 0; - gbxutilacfr::TrivialTracer tracer( debug ); + debugLevel = 0; + gbxutilacfr::TrivialTracer tracer( debugLevel ); gbxutilacfr::TrivialStatus status( tracer ); // Instantiate the driver itself - gbxgarminacfr::Driver* device; + std::auto_ptr<gbxgarminacfr::Driver> device; try { - device = new gbxgarminacfr::Driver( config, tracer, status ); + device.reset( new gbxgarminacfr::Driver( config, tracer, status ) ); } catch ( const std::exception& e ) { @@ -88,7 +96,6 @@ std::auto_ptr<gbxgarminacfr::GenericData> data; // Read a few times - const int numReads = 30 + 10000000; for ( int i=0; i < numReads; i++ ) { try @@ -142,7 +149,5 @@ cout <<"Test: Failed to read data: "<<e.what()<<endl; } } - - delete device; return 0; } Modified: gearbox/trunk/src/gbxsickacfr/messages.cpp =================================================================== --- gearbox/trunk/src/gbxsickacfr/messages.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsickacfr/messages.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -893,6 +893,7 @@ if ( checksumFailed ) { IceUtil::Time t = IceUtil::Time::now(); + cout << "========== Checksum failed, timestamp: " << t.toDateTime() << endl; // cout << "WARN(messages.cpp): " << t.toDateTime() << ": Checksum failed at buf pos " <<bytesParsed << endl; // cout<<"TRACE(messages.cpp): checksum was over: " << toHexString( &(buffer[bytesParsed]), telegramLength ) << endl; bytesParsed++; Modified: gearbox/trunk/src/gbxsickacfr/test/test.cpp =================================================================== --- gearbox/trunk/src/gbxsickacfr/test/test.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsickacfr/test/test.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -12,7 +12,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> #include <iostream> #include <sstream> @@ -28,30 +27,35 @@ // int main( int argc, char **argv ) { - int opt; int baud = 38400; string port = "/dev/ttyS0"; int debug = 0; bool showScan = false; // Get some options from the command line - while ((opt = getopt(argc, argv, "p:b:vs")) != -1) + for ( int i=1; i < argc; i++ ) { - switch ( opt ) + if ( !strcmp(argv[i],"-p") && i < argc-1 ) { - case 'p': - port = optarg; - break; - case 'b': - baud = atoi( optarg ); - break; - case 'v': - debug = 5; - break; - case 's': + port = argv[i+1]; + i++; + } + else if ( !strcmp(argv[i],"-b") && i < argc-1 ) + { + baud = atoi(argv[i+1]); + i++; + } + else if ( !strcmp(argv[i],"-v") ) + { + debug = true; + } + else if ( !strcmp(argv[i],"-s") ) + { showScan = true; - break; - default: + } + else + { + cout << "Unknown option: " << argv[i] << endl; cout << "Usage: " << argv[0] << " [-p port] [-b baud] [-v(erbose)] [-s(how scan)]" << endl << endl << "-p port\tPort the laser scanner is connected to. E.g. /dev/ttyS0" << endl << "-b baud\tBaud rate to connect at (9600, 19200, 38400, or 500000)." << endl; Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -36,7 +36,7 @@ // read new data, this may throw reader_->read(data); - // if successful, reset counter and string + // successful read: reset counter and string exceptionCounter_ = 0; exceptionString_ = ""; @@ -54,8 +54,8 @@ exceptionCounter_++; stringstream ssEx; ssEx << e.what() << endl; - for (unsigned int i=0; i<data.rawRecord.size(); i++) - ssEx << data.rawRecord[i] << endl; + for (unsigned int i=0; i<data.rawRecord().size(); i++) + ssEx << data.rawRecord()[i] << endl; ssEx << endl; exceptionString_ = exceptionString_ + ssEx.str(); @@ -79,7 +79,8 @@ } // return updated internal storage - // if there was an exception on read, we just return the previous record + // if there was an exception on read which does not get re-thrown above, + // the internal storage will contain the previous record return data_; } Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.h =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.h 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.h 2009-11-08 11:51:23 UTC (rev 457) @@ -38,6 +38,7 @@ //! Reads data from OceanServer, incrementally updates internal storage //! Returns a reference to the internal storage //! May throw gbxutilacfr::Exception + //! May return an empty record ( check with isEmpty() ) const gbxsmartbatteryacfr::OceanServerSystem& getData(); private: Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverhealthchecks.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverhealthchecks.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverhealthchecks.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -18,12 +18,24 @@ { namespace { - + + bool isRecordEmpty( const OceanServerSystem &batteryData, + vector<string> &warnShort, + vector<string> &warnVerbose) + { + if ( !batteryData.isEmpty() ) + return false; + + warnVerbose.push_back("The OceanServerSystem data record was empty"); + warnShort.push_back("EMPTY RECORD"); + return true; + } + bool haveBattery( const OceanServerSystem &batteryData, vector<string> &warnShort, vector<string> &warnVerbose ) { - const vector<bool> &bats = batteryData.availableBatteries; + const vector<bool> &bats = batteryData.availableBatteries(); bool haveBattery = false; for (unsigned int i=0; i<bats.size(); i++) { @@ -58,10 +70,12 @@ std::vector<std::string> &warnVerbose, int expectedNumBatteries ) { + if ( isRecordEmpty(batteryData, warnShort, warnVerbose) ) return true; + bool haveWarning = false; int numBatteries = 0; - const vector<bool> &bats = batteryData.availableBatteries; + const vector<bool> &bats = batteryData.availableBatteries(); for (unsigned int i=0; i<bats.size(); i++) { @@ -72,10 +86,10 @@ if ( numBatteries!=expectedNumBatteries ) { stringstream ssWarnShort; - ssWarnShort << "ONLY " << numBatteries << " BATTERIES! "; + ssWarnShort << "HAVE " << numBatteries << ", EXP " << expectedNumBatteries << " BAT! "; warnShort.push_back(ssWarnShort.str()); stringstream ssWarnVerbose; - ssWarnVerbose << "Only found " << numBatteries << " battery modules (expected to see " << expectedNumBatteries << ")" << endl; + ssWarnVerbose << "Found " << numBatteries << " battery modules (expected to see " << expectedNumBatteries << ")" << endl; warnVerbose.push_back( ssWarnVerbose.str() ); haveWarning = true; } @@ -89,6 +103,8 @@ int numCyclesThreshhold, bool printRawRecord ) { + if ( isRecordEmpty(batteryData, warnShort, warnVerbose) ) return true; + bool haveWarning = false; map<int,SmartBattery>::const_iterator it; @@ -114,7 +130,7 @@ if (haveWarning && printRawRecord) { stringstream ssWarnVerbose; - ssWarnVerbose << "Latest raw record: " << endl << toString(batteryData.rawRecord) << endl; + ssWarnVerbose << "Latest raw record: " << endl << toString(batteryData.rawRecord()) << endl; warnVerbose.push_back(ssWarnVerbose.str()); } @@ -128,7 +144,9 @@ double chargeTempThreshhold, double dischargeTempThreshhold, bool printRawRecord ) -{ +{ + if ( isRecordEmpty(batteryData, warnShort, warnVerbose) ) return true; + bool haveWarning = false; map<int,SmartBattery>::const_iterator it; @@ -139,8 +157,8 @@ const SmartBattery &bat = batteryData.battery( batteryNumber ); if ( !bat.has(Temperature) ) continue; - assert( (int)batteryData.chargingStates.size() >= batteryNumber-1 ); - bool isCharging = batteryData.chargingStates[batteryNumber-1]; + assert( (int)batteryData.chargingStates().size() >= batteryNumber-1 ); + bool isCharging = batteryData.chargingStates()[batteryNumber-1]; double tempThreshhold = 0.0; if (isCharging) { @@ -165,7 +183,7 @@ if (haveWarning && printRawRecord) { stringstream ssWarnVerbose; - ssWarnVerbose << "Latest raw record: " << endl << toString(batteryData.rawRecord) << endl; + ssWarnVerbose << "Latest raw record: " << endl << toString(batteryData.rawRecord()) << endl; warnVerbose.push_back(ssWarnVerbose.str()); } @@ -178,6 +196,12 @@ int chargeWarnThreshhold, int chargeDeviationThreshold ) { + + if ( isRecordEmpty(batteryData, warnShort, warnVerbose) ) return true; + + // if the system is charging, don't bother issuing warnings + if ( isSystemOnCharge(batteryData) ) return false; + bool haveWarning = false; map<int,SmartBattery>::const_iterator it; @@ -189,7 +213,7 @@ if ( !bat.has(RelativeStateOfCharge) ) continue; int charge = bat.relativeStateOfCharge(); - const int avgCharge = batteryData.percentCharge; + const int avgCharge = batteryData.percentCharge(); // check whether battery charge is lower than the average if ( charge < (avgCharge - chargeDeviationThreshold) ) @@ -202,8 +226,7 @@ ssWarnVerbose << "Inconsistent charge! Battery no " << batteryNumber << "'s charge is " << charge << "% (average: " << avgCharge << "%)" << endl; warnVerbose.push_back(ssWarnVerbose.str()); } - - // check whether battery charge is below a threshhold + if (charge < chargeWarnThreshhold) { haveWarning = true; @@ -219,14 +242,17 @@ return haveWarning; } -bool checkModuleHealth( const OceanServerSystem &batteryData, +bool checkModuleHealth( const OceanServerSystem &batteryData, vector<string> &warnShort, vector<string> &warnVerbose ) { + + if ( isRecordEmpty(batteryData, warnShort, warnVerbose) ) return true; + bool haveWarning = false; // check the flags - const vector<bool> &badPower = batteryData.powerNoGoodStates; + const vector<bool> &badPower = batteryData.powerNoGoodStates(); for (unsigned int i=0; i<badPower.size(); i++) { if (badPower[i]==true) @@ -241,7 +267,7 @@ } } - const vector<bool> &chargeInhibit = batteryData.chargeInhibitedStates; + const vector<bool> &chargeInhibit = batteryData.chargeInhibitedStates(); for (unsigned int i=0; i<chargeInhibit.size(); i++) { if (chargeInhibit[i]==true) @@ -265,20 +291,29 @@ std::vector<std::string> &warnVerbose, bool printRawRecord ) { - if ( !haveBattery( batteryData, warnShort, warnVerbose ) ) return true; + if ( isRecordEmpty(batteryData, warnShort, warnVerbose) ) return true; - bool warnNumBatteries = checkNumberOfBatteries( batteryData, warnShort, warnVerbose, batteryConfig.expectedNumBatteries ); - bool warnModule = checkModuleHealth( batteryData, warnShort, warnVerbose ); - bool warnCycle = checkNumCycles( batteryData, warnShort, warnVerbose, batteryConfig.numCyclesThreshhold, false ); - bool warnTemp = checkTemperatures( batteryData, warnShort, warnVerbose, batteryConfig.chargeTempThreshhold, batteryConfig.dischargeTempThreshhold, false ); - bool warnCharge = checkCharges( batteryData, warnShort, warnVerbose, batteryConfig.chargeWarnThreshhold, batteryConfig.chargeDeviationThreshold ); + bool haveWarnings = false; + + if ( haveBattery( batteryData, warnShort, warnVerbose ) ) + { + bool warnNumBatteries = checkNumberOfBatteries( batteryData, warnShort, warnVerbose, batteryConfig.expectedNumBatteries ); + bool warnModule = checkModuleHealth( batteryData, warnShort, warnVerbose ); + bool warnCycle = checkNumCycles( batteryData, warnShort, warnVerbose, batteryConfig.numCyclesThreshhold, false ); + bool warnTemp = checkTemperatures( batteryData, warnShort, warnVerbose, batteryConfig.chargeTempThreshhold, batteryConfig.dischargeTempThreshhold, false ); + bool warnCharge = checkCharges( batteryData, warnShort, warnVerbose, batteryConfig.chargeWarnThreshhold, batteryConfig.chargeDeviationThreshold ); + + haveWarnings = warnNumBatteries || warnModule || warnCycle || warnTemp || warnCharge; + } + else + { + haveWarnings = true; + } - bool haveWarnings = warnNumBatteries || warnModule || warnCycle || warnTemp || warnCharge; - if (printRawRecord && haveWarnings ) { stringstream ssWarnVerbose; - ssWarnVerbose << "Latest raw record: " << endl << toString(batteryData.rawRecord) << endl; + ssWarnVerbose << "Latest raw record: " << endl << toString(batteryData.rawRecord()) << endl; warnVerbose.push_back(ssWarnVerbose.str()); } Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -34,16 +34,16 @@ for (it=keyValuePairs.begin(); it!=keyValuePairs.end(); it++) { if (it->first=="01") { - batterySystem.minToEmpty = readMinutes(it->second); + batterySystem.setMinToEmpty( readMinutes(it->second) ); } else if (it->first=="02") { // reserved, do nothing } else if (it->first=="03") { - batterySystem.messageToSystem = it->second; + batterySystem.setMessageToSystem( it->second ); } else if (it->first=="04") { - batterySystem.percentCharge = readPercentByte(it->second); + batterySystem.setPercentCharge( readPercentByte(it->second) ); } else { @@ -66,30 +66,30 @@ if (it->first=="01") { readFlags(it->second, states); - batterySystem.availableBatteries = states; + batterySystem.availableBatteries() = states; } else if (it->first=="02") { readFlags(it->second, states); - batterySystem.chargingStates = states; + batterySystem.chargingStates() = states; } else if (it->first=="03") { readFlags(it->second, states); - batterySystem.supplyingPowerStates = states; + batterySystem.supplyingPowerStates() = states; } else if (it->first=="04") { // reserved, do nothing } else if (it->first=="05") { readFlags(it->second, states); - batterySystem.chargePowerPresentStates = states; + batterySystem.chargePowerPresentStates() = states; } else if (it->first=="06") { readFlags(it->second, states); - batterySystem.powerNoGoodStates = states; + batterySystem.powerNoGoodStates() = states; } else if (it->first=="07") { readFlags(it->second, states); - batterySystem.chargeInhibitedStates = states; + batterySystem.chargeInhibitedStates() = states; } else { @@ -254,7 +254,7 @@ { // put the raw record into the batterySystem representation // useful for "higher-level" debugging: the caller can choose how to make use of this information - batterySystem.rawRecord = stringList; + batterySystem.rawRecord() = stringList; // // Debugging output Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -49,17 +49,18 @@ // // Non-member functions // + string toString( const OceanServerSystem &system ) { stringstream ss; - ss << "Charge: \t" << system.percentCharge << endl; - ss << "Minutes to empty:\t" << system.minToEmpty << endl; - ss << "Available batt.: \t" << toString( system.availableBatteries ) << endl; - ss << "Charging: \t" << toString( system.chargingStates ) << endl; - ss << "Supplying power: \t" << toString( system.supplyingPowerStates ) << endl; - ss << "Charge power: \t" << toString( system.chargePowerPresentStates ) << endl; - ss << "Power no good: \t" << toString( system.powerNoGoodStates ) << endl; - ss << "Charge inhibited:\t" << toString( system.chargeInhibitedStates ) << endl; + ss << "Charge: \t" << system.percentCharge() << endl; + ss << "Minutes to empty:\t" << system.minToEmpty() << endl; + ss << "Available batt.: \t" << toString( system.availableBatteries() ) << endl; + ss << "Charging: \t" << toString( system.chargingStates() ) << endl; + ss << "Supplying power: \t" << toString( system.supplyingPowerStates() ) << endl; + ss << "Charge power: \t" << toString( system.chargePowerPresentStates() ) << endl; + ss << "Power no good: \t" << toString( system.powerNoGoodStates() ) << endl; + ss << "Charge inhibited:\t" << toString( system.chargeInhibitedStates() ) << endl; map<int,SmartBattery>::const_iterator it; for (it=system.batteries().begin(); it!=system.batteries().end(); it++) @@ -74,14 +75,14 @@ string toLogString( const OceanServerSystem &system ) { stringstream ss; - ss << system.percentCharge << " "; - ss << system.minToEmpty << " "; - ss << toLogString( system.availableBatteries ) << " "; - ss << toLogString( system.chargingStates ) << " "; - ss << toLogString( system.supplyingPowerStates ) << " "; - ss << toLogString( system.chargePowerPresentStates ) << " "; - ss << toLogString( system.powerNoGoodStates ) << " "; - ss << toLogString( system.chargeInhibitedStates ) << endl; + ss << system.percentCharge() << " "; + ss << system.minToEmpty() << " "; + ss << toLogString( system.availableBatteries() ) << " "; + ss << toLogString( system.chargingStates() ) << " "; + ss << toLogString( system.supplyingPowerStates() ) << " "; + ss << toLogString( system.chargePowerPresentStates() ) << " "; + ss << toLogString( system.powerNoGoodStates() ) << " "; + ss << toLogString( system.chargeInhibitedStates() ) << endl; ss << system.batteries().size(); @@ -97,19 +98,19 @@ void updateWithNewData( const OceanServerSystem &from, OceanServerSystem &to ) { - to.rawRecord = from.rawRecord; + to.rawRecord() = from.rawRecord(); typedef map<int,SmartBattery>::const_iterator BatIt; - to.availableBatteries = from.availableBatteries; - to.percentCharge = from.percentCharge; - to.minToEmpty = from.minToEmpty; - to.messageToSystem = from.messageToSystem; - to.chargingStates = from.chargingStates; - to.supplyingPowerStates = from.supplyingPowerStates; - to.chargePowerPresentStates = from.chargePowerPresentStates; - to.powerNoGoodStates = from.powerNoGoodStates; - to.chargeInhibitedStates = from.chargeInhibitedStates; + to.setPercentCharge( from.percentCharge() ); + to.setMinToEmpty( from.minToEmpty() ); + to.setMessageToSystem( from.messageToSystem() ); + to.availableBatteries() = from.availableBatteries(); + to.chargingStates() = from.chargingStates(); + to.supplyingPowerStates() = from.supplyingPowerStates(); + to.chargePowerPresentStates() = from.chargePowerPresentStates(); + to.powerNoGoodStates() = from.powerNoGoodStates(); + to.chargeInhibitedStates() = from.chargeInhibitedStates(); for (BatIt it=from.batteries().begin(); it!=from.batteries().end(); it++) { @@ -177,23 +178,35 @@ } +bool isSystemOnCharge( const gbxsmartbatteryacfr::OceanServerSystem &batterySystem ) +{ + for (unsigned int i=0; i<batterySystem.chargingStates().size(); ++i) + { + if (batterySystem.chargingStates()[i]==true) + return true; + } + return false; +} + + // // Member functions // OceanServerSystem::OceanServerSystem() - : percentCharge(0), - minToEmpty(0), - messageToSystem("") + : isEmpty_(true), + percentCharge_(0), + minToEmpty_(0), + messageToSystem_("") { // fixed number of slots for oceanserver system const int NUM_BATTERY_SLOTS = 8; - availableBatteries.resize(NUM_BATTERY_SLOTS); - chargingStates.resize(NUM_BATTERY_SLOTS); - supplyingPowerStates.resize(NUM_BATTERY_SLOTS); - chargePowerPresentStates.resize(NUM_BATTERY_SLOTS); - powerNoGoodStates.resize(NUM_BATTERY_SLOTS); - chargeInhibitedStates.resize(NUM_BATTERY_SLOTS); + availableBatteries_.resize(NUM_BATTERY_SLOTS); + chargingStates_.resize(NUM_BATTERY_SLOTS); + supplyingPowerStates_.resize(NUM_BATTERY_SLOTS); + chargePowerPresentStates_.resize(NUM_BATTERY_SLOTS); + powerNoGoodStates_.resize(NUM_BATTERY_SLOTS); + chargeInhibitedStates_.resize(NUM_BATTERY_SLOTS); } // read access to all batteries @@ -207,6 +220,8 @@ SmartBattery& OceanServerSystem::battery( unsigned int batteryNumber ) { + isEmpty_=false; + map<int,SmartBattery>::iterator it = batteries_.find(batteryNumber); if ( it==batteries_.end() ) { Modified: gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h 2009-11-08 11:51:23 UTC (rev 457) @@ -26,9 +26,12 @@ class OceanServerSystem { public: - + + //! Initialises all data in OceanServerSystem class OceanServerSystem(); - ~OceanServerSystem() {}; + + //! Returns true if no valid data has been set + bool isEmpty() const { return isEmpty_; }; //! Read access to all batteries const std::map<int,SmartBattery>& batteries() const; @@ -42,24 +45,69 @@ //! Erase a battery void eraseBattery( unsigned int batteryNumber ); - //! Average battery values - int percentCharge; - int minToEmpty; - std::string messageToSystem; + //! Set charge in % + void setPercentCharge(int percentCharge) { isEmpty_=false; percentCharge_ = percentCharge; }; + //! Access charget in % + int percentCharge() const { return percentCharge_; }; + //! Set minutes to empty + void setMinToEmpty(int minToEmpty) { isEmpty_=false; minToEmpty_ = minToEmpty; }; + //! Access minutes-to-empty + int minToEmpty() const { return minToEmpty_; }; + //! Set message-to-system string + void setMessageToSystem(const std::string &messageToSystem) { isEmpty_=false; messageToSystem_ = messageToSystem; }; + //! Access message-to-system string + std::string messageToSystem() const { return messageToSystem_; }; - //! Battery module states. Each vector is always of size 8 because OceanServer's Battery - //! Management Modules have a maximum of 8 slots (either 2, 4, or 8 dependent on the model) - std::vector<bool> availableBatteries; - std::vector<bool> chargingStates; - std::vector<bool> supplyingPowerStates; - std::vector<bool> chargePowerPresentStates; - std::vector<bool> powerNoGoodStates; - std::vector<bool> chargeInhibitedStates; + //! Access availableBatteries flags + const std::vector<bool> &availableBatteries() const { return availableBatteries_; }; + //! Set availableBatteries flags + std::vector<bool> &availableBatteries() { isEmpty_=false; return availableBatteries_; }; + //! Access chargingStates flags + const std::vector<bool> &chargingStates() const { return chargingStates_; }; + //! Set chargingStates flags + std::vector<bool> &chargingStates() { isEmpty_=false; return chargingStates_; }; + //! Access supplyingPowerStates flags + const std::vector<bool> &supplyingPowerStates() const { return supplyingPowerStates_; }; + //! Set supplyingPowerStates flags + std::vector<bool> &supplyingPowerStates() { isEmpty_=false; return supplyingPowerStates_; }; + //! Access chargePowerPresentStates flags + const std::vector<bool> &chargePowerPresentStates() const { return chargePowerPresentStates_; }; + //! Set chargePowerPresentStates flags + std::vector<bool> &chargePowerPresentStates() { isEmpty_=false; return chargePowerPresentStates_; }; + //! Access powerNoGoodStates flags + const std::vector<bool> &powerNoGoodStates() const { return powerNoGoodStates_; }; + //! Set powerNoGoodStates flags + std::vector<bool> &powerNoGoodStates() { isEmpty_=false; return powerNoGoodStates_; }; + //! Access chargeInhibitedStates flags + const std::vector<bool> &chargeInhibitedStates() const { return chargeInhibitedStates_; } + //! Set chargeInhibitedStates flags + std::vector<bool> &chargeInhibitedStates() { isEmpty_=false; return chargeInhibitedStates_; } - //! the latest raw record, useful for debugging - std::vector<std::string> rawRecord; + //! Access the latest raw record, useful for debugging + const std::vector<std::string> &rawRecord() const { return rawRecord_; }; + //! Set the latest raw record + std::vector<std::string> &rawRecord() { isEmpty_=false; return rawRecord_; }; private: + + bool isEmpty_; + + // Average battery values + int percentCharge_; + int minToEmpty_; + std::string messageToSystem_; + + // Battery module states. Each vector is always of size 8 because OceanServer's Battery + // Management Modules have a maximum of 8 slots (either 2, 4, or 8 dependent on the model) + std::vector<bool> availableBatteries_; + std::vector<bool> chargingStates_; + std::vector<bool> supplyingPowerStates_; + std::vector<bool> chargePowerPresentStates_; + std::vector<bool> powerNoGoodStates_; + std::vector<bool> chargeInhibitedStates_; + + // the latest raw record, useful for debugging + std::vector<std::string> rawRecord_; // key: slot number, data: a single smart battery module std::map<int,SmartBattery> batteries_; @@ -78,6 +126,9 @@ //! The reaping capability makes sure that battery modules which are no longer connected don't persist. void updateWithNewData( const OceanServerSystem &from, OceanServerSystem &to ); + +//! Returns true if at least one of the battery modules is on charge otherwise false +bool isSystemOnCharge( const OceanServerSystem &batterySystem ); } // namespace Modified: gearbox/trunk/src/gbxsmartbatteryacfr/test/darttest/checksumtest.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/test/darttest/checksumtest.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/test/darttest/checksumtest.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -76,7 +76,7 @@ string checksumStr = ss.str(); for (unsigned int i=0; i<checksumStr.size(); i++) - checksumStr[i] = toupper( checksumStr[i] ); + checksumStr[i] = (char)(toupper( checksumStr[i] )); cout << "Expected checksum result is:\t" << resultHex << endl; cout << "Computed checksum result is:\t" << checksumStr << endl << endl; Modified: gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -58,10 +58,15 @@ while (true) { - cout << "TRACE(test): Reading record " << numRecords << endl; + cout << "Reading record " << numRecords << endl; numRecords++; gbxsmartbatteryacfr::OceanServerSystem data = oceanserver.getData(); + if ( data.isEmpty() ) + { + cout << "Data was empty. No worries, keep trying to read." << endl; + continue; + } vector<string> shortWarning; vector<string> verboseWarning; const bool printRawRecord = true; Modified: gearbox/trunk/src/gbxutilacfr/exceptions.cpp =================================================================== --- gearbox/trunk/src/gbxutilacfr/exceptions.cpp 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxutilacfr/exceptions.cpp 2009-11-08 11:51:23 UTC (rev 457) @@ -25,7 +25,7 @@ } const char * -Exception::basename( const char *s ) +Exception::basename( const char *s ) const { #ifndef WIN32 return strrchr( s, '/' )+1; @@ -35,7 +35,7 @@ }; std::string -Exception::toMessageString( const char *file, const char *line, const std::string &message ) +Exception::toMessageString( const char *file, const char *line, const std::string &message ) const { std::string msg = "\n *** ERROR("; // not to confuse our local basename() with gbxutilacfr::basename() Modified: gearbox/trunk/src/gbxutilacfr/exceptions.h =================================================================== --- gearbox/trunk/src/gbxutilacfr/exceptions.h 2009-11-07 04:25:00 UTC (rev 456) +++ gearbox/trunk/src/gbxutilacfr/exceptions.h 2009-11-08 11:51:23 UTC (rev 457) @@ -72,12 +72,12 @@ virtual const char* what() const throw() { return message_.c_str(); } protected: - std::string toMessageString( const char *file, const char *line, const std::string &message ); + std::string toMessageString( const char *file, const char *line, const std::string &message ) const; std::string message_; private: - const char *basename( const char *s ); + const char *basename( const char *s ) const; }; //! This exception is raised when something is wrong with the hardware. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rus...@us...> - 2009-11-12 04:21:38
|
Revision: 465 http://gearbox.svn.sourceforge.net/gearbox/?rev=465&view=rev Author: russo2503v Date: 2009-11-12 04:21:28 +0000 (Thu, 12 Nov 2009) Log Message: ----------- added new variable GBX_DISABLE_ALL to override default build option for all targets Modified Paths: -------------- gearbox/trunk/cmake/DependencyUtils.cmake gearbox/trunk/doc/buildsys.dox Modified: gearbox/trunk/cmake/DependencyUtils.cmake =================================================================== --- gearbox/trunk/cmake/DependencyUtils.cmake 2009-11-12 04:19:59 UTC (rev 464) +++ gearbox/trunk/cmake/DependencyUtils.cmake 2009-11-12 04:21:28 UTC (rev 465) @@ -37,7 +37,7 @@ endmacro( GBX_UTIL_MAKE_OPTION_NAME option_name module_name ) # -# GBX_REQUIRE_OPTION( cumulative_var [EXE | LIB] module_name default_option_value [option_name] [OPTION DESCRIPTION] ) +# GBX_REQUIRE_OPTION( cumulative_var [EXE | LIB] module_name devel_option_value [option_name] [OPTION DESCRIPTION] ) # # E.g. # Initialize a variable first @@ -47,25 +47,34 @@ # This does the same thing # GBX_REQUIRE_OPTION ( build EXE localiser ON BUILD_LOCALISER ) # -macro( GBX_REQUIRE_OPTION cumulative_var module_type module_name default_option_value ) +macro( GBX_REQUIRE_OPTION cumulative_var module_type module_name devel_option_value ) GBX_UTIL_CHECK_MODULE_TYPE( ${module_type} is_exe is_lib ) if( ${ARGC} GREATER 5 ) set( option_name ${ARGV6} ) - else( ${ARGC} GREATER 5 ) + else() GBX_UTIL_MAKE_OPTION_NAME( option_name ${module_type} ${module_name} ) - endif( ${ARGC} GREATER 5 ) + endif() if( ${ARGC} GREATER 6 ) set( option_descr ${ARGV7} ) - else( ${ARGC} GREATER 6 ) + else() set( option_descr "disabled by user, use ccmake to enable" ) - endif( ${ARGC} GREATER 6 ) + endif() + # only affects the default option for this target + # individual targets can still be enabled + if( GBX_DISABLE_ALL ) + set( default_option_value OFF ) + set( option_descr "disabled by GBX_DISABLE_ALL, use ccmake to enable" ) + else() + set( default_option_value ${devel_option_value} ) + endif() + # debug # message( STATUS -# "GBX_REQUIRE_OPTION (CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, default_option_value=${default_option_value}, OPT_NAME=${option_name}, OPT_DESC=${option_descr})" ) +# "GBX_REQUIRE_OPTION (CUM_VAR=${cumulative_var}, MOD_TYPE=${module_type}, MOD_NAME=${module_name}, devel_option_value=${devel_option_value}, OPT_NAME=${option_name}, OPT_DESC=${option_descr})" ) # set up the option if( is_exe ) @@ -140,15 +149,15 @@ if( ${cumulative_var} ) GBX_UTIL_CHECK_MODULE_TYPE( ${module_type} is_exe is_lib ) - + if( ${ARGC} GREATER 5 ) set( reason ${ARGV6} ) else( ${ARGC} GREATER 5 ) set( reason "${target_name} is not being built" ) endif( ${ARGC} GREATER 5 ) - + GET_TARGET_PROPERTY( target_location ${target_name} LOCATION ) - + # must dereference both var and option names once (!) and IF will evaluate their values if( NOT target_location ) set( ${cumulative_var} FALSE ) Modified: gearbox/trunk/doc/buildsys.dox =================================================================== --- gearbox/trunk/doc/buildsys.dox 2009-11-12 04:19:59 UTC (rev 464) +++ gearbox/trunk/doc/buildsys.dox 2009-11-12 04:21:28 UTC (rev 465) @@ -97,9 +97,9 @@ Any text following "#" is a comment. Use them to explain uncommon usage. This GearBox macro checks for user input into the build process. It is actually a shortcut which does several things: -- Defines a CMake cache variable called @c BUILD_LIB_GBXADVANCED which can be used a user-controlled switch for turning compilation of this library ON and OFF. You will see this option when you run the @c ccmake tool. The option variable is defined the very first time CMake is run, and it is assigned the specified default value (ON). -- Every time CMake runs, it checks the current value of the @c BUILD_LIB_GBXADVANCED variable. If the user configured it FALSE, then the value of @c build variable will also become FALSE. -- If it is decided that the library will not be built due to user input a corresponding entry will be added to a global list and the name of the library will be printed out at the end of the CMake process under the "Will NOT build..." heading. +- Defines a CMake cache variable called @c ENABLE_LIB_GBXADVANCED which can be used a user-controlled switch for turning compilation of this library ON and OFF. You will see this option when you run the @c ccmake tool. The option variable is defined the very first time CMake is run, and it is assigned the specified default value (ON in this case). +- Every time CMake runs, it checks the current value of the @c ENABLE_LIB_GBXADVANCED variable. If the user has configured it to OFF, then the value of @c build variable will become OFF (aka FALSE). +- If it is decided that the library will not be built due to user input, a corresponding entry will be added to a global list and the name of the library will be printed out at the end of the CMake process under the "Will NOT build..." heading. Notice that to evaluate the variable you have to inclose it in braces and add a dollar sign, i.e. @c ${lib_name}. Without this, CMake would just treat it as text. (Similar to the UNIX shells). @@ -110,6 +110,8 @@ @endverbatim The last two parameters are optional and have sensible defaults. Nothing else in the build depends on these variables so it's safe to specify them. +It is sometimes useful to disable compilation of all targets and then selectively enable a few. To do this set GBX_DISABLE_ALL to ON. In this case, all default compilation settings for all targets are set to OFF. It is still possible to individually enable targets with e.g. ENABLE_LIB_GBXADVANCED=ON. For GBX_DISABLE_ALL to take effect, make sure you clear CMake cache first, by deleting CMakeCache.txt file. + @verbatim GBX_REQUIRE_VAR( build LIB ${lib_name} GBX_OS_LINUX "only Linux OS is supported" ) @endverbatim This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gb...@us...> - 2009-12-15 02:04:12
|
Revision: 478 http://gearbox.svn.sourceforge.net/gearbox/?rev=478&view=rev Author: gbiggs Date: 2009-12-15 02:03:56 +0000 (Tue, 15 Dec 2009) Log Message: ----------- Fixed pkg-config file generation, added missing .pc files. Modified Paths: -------------- gearbox/trunk/cmake/TargetUtils.cmake gearbox/trunk/cmake/pkgconfig.in gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt gearbox/trunk/src/gbxutilacfr/CMakeLists.txt Modified: gearbox/trunk/cmake/TargetUtils.cmake =================================================================== --- gearbox/trunk/cmake/TargetUtils.cmake 2009-12-15 01:17:34 UTC (rev 477) +++ gearbox/trunk/cmake/TargetUtils.cmake 2009-12-15 02:03:56 UTC (rev 478) @@ -186,7 +186,7 @@ set( PKG_DESC ${desc} ) set( PKG_CFLAGS ${cflags} ) set( PKG_LIBFLAGS ${libflags} ) - set( PKG_EXTERNAL_DEPS ${${ext_deps}} ) + LIST_TO_STRING( PKG_EXTERNAL_DEPS "${${ext_deps}}" ) set( PKG_INTERNAL_DEPS "" ) set( PKG_VERSION ${version} ) if( ${int_deps} ) @@ -412,3 +412,13 @@ set( LICENSE_LIST "" CACHE INTERNAL "Global list of directories and their licenses" FORCE ) endmacro( GBX_RESET_ALL_TARGET_LISTS ) + +# +# Macro to turn a list into a string (why doesn't CMake have this built-in?) +# +MACRO (LIST_TO_STRING _string _list) + SET (${_string}) + FOREACH (_item ${_list}) + SET (${_string} "${${_string}} ${_item}") + ENDFOREACH (_item) +ENDMACRO (LIST_TO_STRING) Modified: gearbox/trunk/cmake/pkgconfig.in =================================================================== --- gearbox/trunk/cmake/pkgconfig.in 2009-12-15 01:17:34 UTC (rev 477) +++ gearbox/trunk/cmake/pkgconfig.in 2009-12-15 02:03:56 UTC (rev 478) @@ -1,8 +1,13 @@ # This file was generated by CMake for @PROJECT_NAME@ library @PKG_NAME@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@GBX_LIB_INSTALL_SUFFIX@ +includedir=${prefix}/@GBX_INCLUDE_INSTALL_SUFFIX@ Name: @PKG_NAME@ Description: @PKG_DESC@ Version: @PKG_VERSION@ Requires: @PKG_EXTERNAL_DEPS@ -Libs: -L@GBX_LIB_INSTALL_DIR@ @PKG_LIBFLAGS@ -l@PKG_NAME@ @PKG_INTERNAL_DEPS@ -Cflags: -I@GBX_INCLUDE_INSTALL_DIR@ @PKG_CFLAGS@ +Libs: -L${libdir} @PKG_LIBFLAGS@ -l@PKG_NAME@ @PKG_INTERNAL_DEPS@ +Cflags: -I${includedir} @PKG_CFLAGS@ + Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt 2009-12-15 01:17:34 UTC (rev 477) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/CMakeLists.txt 2009-12-15 02:03:56 UTC (rev 478) @@ -1,5 +1,6 @@ set( lib_name GbxNovatelUtilAcfr ) set( lib_version 1.0.0 ) +set( lib_desc "Utilities for GbxNovatelAcfr" ) GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) @@ -28,6 +29,7 @@ GBX_ADD_LIBRARY( ${lib_name} DEFAULT ${lib_version} ${srcs} ) target_link_libraries( ${lib_name} ${dep_libs} ) + GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} dep_libs "" "" "" ${lib_version} ) GBX_ADD_HEADERS( gbxnovatelacfr/gbxnovatelutilacfr ${hdrs} ) Modified: gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt 2009-12-15 01:17:34 UTC (rev 477) +++ gearbox/trunk/src/gbxserialacfr/lockfile/CMakeLists.txt 2009-12-15 02:03:56 UTC (rev 478) @@ -1,5 +1,6 @@ set( lib_name GbxLockFileAcfr ) set( lib_version 1.0.0 ) +set( lib_desc "Create lock files in /var/lock to control resource access. Part of GearBox." ) GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) @@ -17,6 +18,7 @@ GBX_ADD_LIBRARY( ${lib_name} DEFAULT ${lib_version} ${srcs} ) target_link_libraries( ${lib_name} ${dep_libs} ) + GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} "" "" "" "" ${lib_version} ) GBX_ADD_HEADERS( gbxserialacfr/lockfile ${hdrs} ) Modified: gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2009-12-15 01:17:34 UTC (rev 477) +++ gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/CMakeLists.txt 2009-12-15 02:03:56 UTC (rev 478) @@ -1,5 +1,6 @@ set( lib_name GbxIceUtilAcfr ) set( lib_version 1.0.0 ) +set( lib_desc "Ice utilities for GbxSickAcfr" ) GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) @@ -26,6 +27,7 @@ GBX_ADD_LIBRARY( ${lib_name} DEFAULT ${lib_version} ${srcs} ) target_link_libraries( ${lib_name} ${dep_libs} ) + GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} dep_libs "" "" "" ${lib_version} ) GBX_ADD_HEADERS( gbxsickacfr/gbxiceutilacfr ${hdrs} ) Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt 2009-12-15 01:17:34 UTC (rev 477) +++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/CMakeLists.txt 2009-12-15 02:03:56 UTC (rev 478) @@ -1,5 +1,6 @@ set( lib_name GbxSerialDeviceAcfr ) set( lib_version 1.0.0 ) +set( lib_desc "Serial port handler for GbxSickAcfr." ) GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) @@ -20,6 +21,7 @@ GBX_ADD_LIBRARY( ${lib_name} DEFAULT ${lib_version} ${srcs} ) target_link_libraries( ${lib_name} ${dep_libs} ) + GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} dep_libs "" "" "" ${lib_version} ) GBX_ADD_HEADERS( gbxsickacfr/gbxserialdeviceacfr ${hdrs} ) Modified: gearbox/trunk/src/gbxutilacfr/CMakeLists.txt =================================================================== --- gearbox/trunk/src/gbxutilacfr/CMakeLists.txt 2009-12-15 01:17:34 UTC (rev 477) +++ gearbox/trunk/src/gbxutilacfr/CMakeLists.txt 2009-12-15 02:03:56 UTC (rev 478) @@ -1,5 +1,6 @@ set( lib_name GbxUtilAcfr ) set( lib_version 1.0.0 ) +set( lib_desc "Utilities including status tracing and exceptions. Part of GearBox." ) GBX_ADD_LICENSE( LGPL2+ ) set( build TRUE ) @@ -23,6 +24,7 @@ include_directories( ${PROJECT_BINARY_DIR} ) GBX_ADD_LIBRARY( ${lib_name} DEFAULT ${lib_version} ${srcs} ) + GBX_ADD_PKGCONFIG( ${lib_name} ${lib_desc} "" "" "" "" ${lib_version} ) GBX_ADD_HEADERS( gbxutilacfr ${hdrs} ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2010-02-01 03:55:22
|
Revision: 484 http://gearbox.svn.sourceforge.net/gearbox/?rev=484&view=rev Author: borax00 Date: 2010-02-01 03:55:11 +0000 (Mon, 01 Feb 2010) Log Message: ----------- MR Changes Modified Paths: -------------- gearbox/trunk/cmake/DependencyUtils.cmake gearbox/trunk/cmake/TargetUtils.cmake gearbox/trunk/cmake/internal/gearbox-config-internal.cmake gearbox/trunk/doc/history.dox gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp Modified: gearbox/trunk/cmake/DependencyUtils.cmake =================================================================== --- gearbox/trunk/cmake/DependencyUtils.cmake 2010-01-28 02:49:29 UTC (rev 483) +++ gearbox/trunk/cmake/DependencyUtils.cmake 2010-02-01 03:55:11 UTC (rev 484) @@ -149,26 +149,22 @@ if( ${cumulative_var} ) GBX_UTIL_CHECK_MODULE_TYPE( ${module_type} is_exe is_lib ) - + if( ${ARGC} GREATER 5 ) set( reason ${ARGV6} ) else( ${ARGC} GREATER 5 ) set( reason "${target_name} is not being built" ) endif( ${ARGC} GREATER 5 ) - - # TODO: should simply use this signature: if(NOT TARGET target_name) - GET_TARGET_PROPERTY( target_location ${target_name} LOCATION ) - - # must dereference both var and option names once (!) and IF will evaluate their values - if( NOT target_location ) + + if( NOT TARGET ${target_name} ) set( ${cumulative_var} FALSE ) GBX_UTIL_MAKE_OPTION_NAME( option_name ${module_type} ${module_name} ) if( is_exe ) GBX_NOT_ADD_EXECUTABLE( ${module_name} ${reason} ) else( is_exe ) - GBX_NOT_add_library( ${module_name} ${reason} ) + GBX_NOT_ADD_LIBRARY( ${module_name} ${reason} ) endif( is_exe ) - endif( NOT target_location ) + endif( NOT TARGET ${target_name} ) endif( ${cumulative_var} ) Modified: gearbox/trunk/cmake/TargetUtils.cmake =================================================================== --- gearbox/trunk/cmake/TargetUtils.cmake 2010-01-28 02:49:29 UTC (rev 483) +++ gearbox/trunk/cmake/TargetUtils.cmake 2010-02-01 03:55:11 UTC (rev 484) @@ -108,9 +108,32 @@ set( libTypeDesc "static" ) endif( libType STREQUAL SHARED ) message( STATUS "Planning to build ${libTypeDesc} library: ${name}-${soversion}" ) -endmacro( GBX_ADD_LIBRARY name ) +endmacro( GBX_ADD_LIBRARY ) # +# Special macro for handling dependencies on header-only libraries. +# Internally creates a dummy target which other libraries can depend on. +# This is helpful if the header-only library has external dependencies. +# The header-only library can check its dependencies once and all libraries +# can use internal dependency checking mechanism from then on. +# +macro( GBX_ADD_HEADER_ONLY_LIBRARY name ) + if( COMMAND cmake_policy ) + cmake_policy( SET CMP0003 NEW ) + endif( COMMAND cmake_policy ) + +# message( STATUS "DEBUG: adding header-only library '${name}'" ) + + add_custom_target( ${name} ) + + set( templist ${LIB_LIST} ) + list( APPEND templist ${name} ) + set( LIB_LIST ${templist} CACHE INTERNAL "Global list of libraries to build" FORCE ) + + message( STATUS "Considering header-only library as 'built': ${name}" ) +endmacro( GBX_ADD_HEADER_ONLY_LIBRARY ) + +# # GBX_ADD_HEADERS( install_subdir FILE0 [FILE1 FILE2 ...] ) # # Specialization of install(FILES ...) to install header files. Modified: gearbox/trunk/cmake/internal/gearbox-config-internal.cmake =================================================================== --- gearbox/trunk/cmake/internal/gearbox-config-internal.cmake 2010-01-28 02:49:29 UTC (rev 483) +++ gearbox/trunk/cmake/internal/gearbox-config-internal.cmake 2010-02-01 03:55:11 UTC (rev 484) @@ -11,5 +11,7 @@ set( GEARBOX_USE_FILE "${GEARBOX_CMAKE_DIR}/gearbox-use-file.cmake" ) -# this is where Gearbox libs will be installed -set( GEARBOX_LINK_DIR ${CMAKE_INSTALL_PREFIX}/${GBX_LIB_INSTALL_DIR} ) +# this is where Gearbox libs will be installed. +# we cannot use GBX_LIB_INSTALL_DIR here because this script is loaded from another +# project (it's only used under special super-project configuration) +set( GEARBOX_LINK_DIR ${CMAKE_INSTALL_PREFIX}/lib/gearbox ) Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2010-01-28 02:49:29 UTC (rev 483) +++ gearbox/trunk/doc/history.dox 2010-02-01 03:55:11 UTC (rev 484) @@ -21,6 +21,15 @@ Developers: as you make substantial changes in the code (add features, fix bugs, etc.), add an item in the section on changes. When the next version is released, this list will be copied into the release notes. +POST 9.11 CHANGES + +@par Project wide + +- Build system + - GBX_REQUIRE_LIB macro now uses a direct check for target existence. + - new GBX_ADD_HEADER_ONLY_LIBRARY macro for handling dependencies on header-only libraries. + + @section gbx_doc_history_todo To-Do List for Next Release None. Modified: gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp =================================================================== --- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2010-01-28 02:49:29 UTC (rev 483) +++ gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp 2010-02-01 03:55:11 UTC (rev 484) @@ -25,6 +25,13 @@ void removeParsedData( std::vector<char> &buffer, int numBytesParsed ) { + if ( numBytesParsed > (int)(buffer.size()) ) + { + stringstream ss; + ss << "Huh? numBytesParsed("<<numBytesParsed<<") is bigger than buffer.size()("<<buffer.size()<<")"; + throw gbxutilacfr::Exception( ERROR_INFO, ss.str() ); + } + if ( numBytesParsed > 0 ) { int numBytesBeyond = buffer.size()-numBytesParsed; @@ -32,6 +39,7 @@ { memmove( &(buffer[0]), &(buffer[numBytesParsed]), numBytesBeyond*sizeof(char) ); } + assert( numBytesBeyond >= 0 ); buffer.resize( numBytesBeyond ); } } @@ -228,7 +236,6 @@ tracer_.warning( ss.str() ); throw; } - removeParsedData( buffer_, numBytesParsed ); if ( gotMessage ) Modified: gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp =================================================================== --- gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp 2010-01-28 02:49:29 UTC (rev 483) +++ gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp 2010-02-01 03:55:11 UTC (rev 484) @@ -16,6 +16,17 @@ } +string checkMinToEmpty( const gbxsmartbatteryacfr::OceanServerSystem &data ) +{ + if ( data.minToEmpty()<1 ) + { + stringstream ss; + ss << "*********** YES: MinToEmpty is close to zero: " << data.minToEmpty(); + return ss.str(); + } + else + return "NO"; +} int main( int argc, char **argv ) { @@ -47,7 +58,7 @@ try { gbxsmartbatteryacfr::BatteryHealthWarningConfig config; - config.expectedNumBatteries = 2; + config.expectedNumBatteries = 1; config.numCyclesThreshhold = 300; config.chargeTempThreshhold = 40.0; config.dischargeTempThreshhold = 45.0; @@ -58,7 +69,8 @@ while (true) { - cout << "Reading record " << numRecords << endl; + cout << "========================================================" << endl + << "Reading record " << numRecords << endl; numRecords++; gbxsmartbatteryacfr::OceanServerSystem data = oceanserver.getData(); @@ -67,9 +79,16 @@ cout << "Data was empty. No worries, keep trying to read." << endl; continue; } + + cout << gbxsmartbatteryacfr::toString( data ) << endl + << "minToEmpty<1?: " << checkMinToEmpty(data) << endl + << "isSystemOnCharge?: " << isSystemOnCharge(data) << endl + << "raw record: " << endl + << toString(data.rawRecord()) << endl; + vector<string> shortWarning; vector<string> verboseWarning; - const bool printRawRecord = true; + const bool printRawRecord = false; bool haveWarnings = conductAllHealthChecks( data, config, shortWarning, verboseWarning, printRawRecord ); if (haveWarnings) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2010-03-18 07:54:25
|
Revision: 488 http://gearbox.svn.sourceforge.net/gearbox/?rev=488&view=rev Author: borax00 Date: 2010-03-18 07:54:14 +0000 (Thu, 18 Mar 2010) Log Message: ----------- MR Changes Modified Paths: -------------- gearbox/trunk/doc/history.dox gearbox/trunk/src/gbxgarminacfr/driver.cpp gearbox/trunk/src/gbxgarminacfr/driver.h gearbox/trunk/src/gbxgarminacfr/test/test.cpp gearbox/trunk/src/gbxsickacfr/driver.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp gearbox/trunk/src/gbxsmartbatteryacfr/CMakeLists.txt gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverhealthchecks.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h gearbox/trunk/src/gbxsmartbatteryacfr/smartbattery.h gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp gearbox/trunk/src/gbxsmartbatteryacfr/test/shorttest.cpp gearbox/trunk/src/gbxutilacfr/exceptions.cpp gearbox/trunk/src/gbxutilacfr/status.cpp gearbox/trunk/src/gbxutilacfr/status.h gearbox/trunk/src/gbxutilacfr/subhealth.h gearbox/trunk/src/gbxutilacfr/substatus.h gearbox/trunk/src/gbxutilacfr/test/trivialstatustest.cpp gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp gearbox/trunk/src/gbxutilacfr/trivialstatus.h Added Paths: ----------- gearbox/trunk/src/gbxgarminacfr/nmeamessages.cpp gearbox/trunk/src/gbxgarminacfr/nmeamessages.h gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp gearbox/trunk/src/gbxgarminacfr/nmeasentence.h Removed Paths: ------------- gearbox/trunk/src/gbxgarminacfr/nmea.cpp gearbox/trunk/src/gbxgarminacfr/nmea.h Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2010-03-17 06:19:56 UTC (rev 487) +++ gearbox/trunk/doc/history.dox 2010-03-18 07:54:14 UTC (rev 488) @@ -21,15 +21,6 @@ Developers: as you make substantial changes in the code (add features, fix bugs, etc.), add an item in the section on changes. When the next version is released, this list will be copied into the release notes. -POST 9.11 CHANGES - -@par Project wide - -- Build system - - GBX_REQUIRE_LIB macro now uses a direct check for target existence. - - new GBX_ADD_HEADER_ONLY_LIBRARY macro for handling dependencies on header-only libraries. - - @section gbx_doc_history_todo To-Do List for Next Release None. @@ -38,10 +29,24 @@ @par Project wide +- Build system + - GBX_REQUIRE_LIB macro now uses a direct check for target existence. + - new GBX_ADD_HEADER_ONLY_LIBRARY macro for handling dependencies on header-only libraries. + @par New libraries @par Updated libraries +- libGbxUtilAcfr + - Status class: + - functions for changing the state, initialising(), working(), finalising(), no longer + change the message. A separate call to one of the health-related function is needed if a change is + required. + - Renamed health SubsystemFault to SubsystemCritical, and function fault() to critical(). + - defined enums for component state and health. + - added a function to access the component status. + - removed functions to specify "infrastructure state" which is now expected to be an optional subsystem. + @par Retired libraries @section gbx_doc_history_911 Changes in Release 9.11 @@ -55,6 +60,9 @@ @par Updated libraries +- libGbxSmartBatteryAcfr (tobi) + - Oceanserver class now has its own thread which reads continuously from the hardware + - libGbxNovatelAcfr: - Bugfix: matched GPS status/solution enums to Novatel's internal types, there were gaps due to reserved values before. Note: this will create mismatches with old log-files (not data, status/solution-type only)! (MichaelM, patch by Ian Mahon) Modified: gearbox/trunk/src/gbxgarminacfr/driver.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/driver.cpp 2010-03-17 06:19:56 UTC (rev 487) +++ gearbox/trunk/src/gbxgarminacfr/driver.cpp 2010-03-18 07:54:14 UTC (rev 488) @@ -12,14 +12,13 @@ #include <iostream> #include <sstream> #include <gbxutilacfr/gbxutilacfr.h> -#include "nmea.h" +#include "nmeasentence.h" #include <cstdlib> #include <cstring> #include <sys/time.h> #include <time.h> #include <errno.h> #include <stdio.h> - #include "driver.h" using namespace std; @@ -28,243 +27,27 @@ namespace gbxgarminacfr { -namespace { - -// Get the useful bits from a GGA message -GenericData* extractGgaData( const gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) +bool +Config::isValid( std::string &reason ) const { - std::auto_ptr<GgaData> data( new GgaData ); - - data->timeStampSec = timeSec; - data->timeStampUsec = timeUsec; - - //Names for the tokens in the GGA message - enum GgaTokens{MsgType=0,UTC,Lat,LatDir,Lon,LonDir,FixType, - NSatsUsed,HDOP,Hgt,M1,GeoidHgt,M2,DiffAge,DiffId}; - - //UTC time - sscanf(msg.getDataToken(UTC).c_str(),"%02d%02d%lf", - &data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec ); - - //number of satellites in use - data->satellites = atoi(msg.getDataToken(NSatsUsed).c_str()); - - // fix type - switch ( msg.getDataToken(FixType)[0] ) + if ( device.empty() ) { - case '0': - data->fixType = Invalid; - // NOTE: not processing the rest! - data->latitude = 0.0; - data->longitude = 0.0; - data->altitude = 0.0; - data->geoidalSeparation = 0.0; - return data.release(); - case '1': - data->fixType = Autonomous; - break; - case '2': - data->fixType = Differential; - break; - default : - throw gbxutilacfr::Exception( ERROR_INFO, "GGA sentence contains unknown GPS fix type: '"+msg.getDataToken(FixType)+"'" ); + reason = "device not set"; + return false; } - - //position - int deg; - double min; - double dir; - - //latitude - sscanf(msg.getDataToken(Lat).c_str(),"%02d%lf",°,&min); - dir = (*msg.getDataToken(LatDir).c_str()=='N') ? 1.0 : -1.0; - data->latitude=dir*(deg+(min/60.0)); - //longitude - sscanf(msg.getDataToken(Lon).c_str(),"%03d%lf",°,&min); - dir = (*msg.getDataToken(LonDir).c_str()=='E') ? 1.0 : -1.0; - data->longitude=dir*(deg+(min/60.0)); - - //altitude - data->isAltitudeKnown = !msg.isDataTokenEmpty(Hgt); - if ( data->isAltitudeKnown ) - data->altitude=atof(msg.getDataToken(Hgt).c_str()); - - //geoidal Separation - data->geoidalSeparation=atof(msg.getDataToken(GeoidHgt).c_str()); - return data.release(); -} - -// VTG provides velocity and heading information -GenericData* extractVtgData( const gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) -{ - std::auto_ptr<VtgData> data( new VtgData ); - - data->timeStampSec = timeSec; - data->timeStampUsec = timeUsec; - - //Names for the VTG message items - enum VtgTokens{MsgType=0,HeadingTrue,T,HeadingMag,M,SpeedKnots, - N,SpeedKPH,K,ModeInd}; - - //Check for an empty string. Means that we can't tell anything useful. - if ( msg.isDataTokenEmpty(HeadingTrue) ) + if ( !( readGga || readVtg || readRme || readRmc ) ) { - data->isValid = false; - data->headingTrue = 0.0; - data->headingMagnetic = 0.0; - data->speed = 0.0; - return data.release(); + reason = "not configured to read any message types"; + return false; } - data->isValid = true; - // true heading - double headingRad = DEG2RAD(atof(msg.getDataToken(HeadingTrue).c_str())); - NORMALISE_ANGLE( headingRad ); - data->headingTrue=headingRad; - - // magnetic heading - headingRad = DEG2RAD(atof(msg.getDataToken(HeadingMag).c_str())); - NORMALISE_ANGLE( headingRad ); - data->headingMagnetic=headingRad; - - //speed - converted to m/s - data->speed=atof(msg.getDataToken(SpeedKPH).c_str()); - data->speed*=(1000/3600.0); - - return data.release(); -} - -// RME message. This one is garmin specific... Give position error estimates -// See doc.dox for a discussion of the position errors as reported here. -// Essentially the EPE reported by the garmin is a 1 sigma error (RMS) or a -// 68% confidence bounds. -GenericData* extractRmeData( const gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) -{ - std::auto_ptr<RmeData> data( new RmeData ); - - data->timeStampSec = timeSec; - data->timeStampUsec = timeUsec; - - //Names for the RME message items - enum RmeTokens{MsgType=0,HError,M1,VError,M2,EPE,M3}; - - if ( msg.isDataTokenEmpty(HError) ) + if ( protocol != "Garmin" && protocol != "NMEA" ) { - // No valid information - data->isValid = false; - data->isVerticalPositionErrorValid = false; - data->horizontalPositionError = 0.0; - data->verticalPositionError = 0.0; - data->estimatedPositionError = 0.0; - return data.release(); + reason = "invalid protocol"; + return false; } - data->isValid = true; - data->horizontalPositionError = atof(msg.getDataToken(HError).c_str()); - - if ( msg.isDataTokenEmpty(VError) ) - { - data->isVerticalPositionErrorValid = false; - data->verticalPositionError = -1; - } - else - { - data->isVerticalPositionErrorValid = true; - data->verticalPositionError = atof(msg.getDataToken(VError).c_str()); - } - - data->estimatedPositionError = atof(msg.getDataToken(EPE).c_str()); - return data.release(); -} - -// RMC provides a combination of GGA and VTG data -GenericData* extractRmcData( const gbxgpsutilacfr::NmeaMessage& msg, int timeSec, int timeUsec ) -{ - std::auto_ptr<RmcData> data( new RmcData ); - - data->timeStampSec = timeSec; - data->timeStampUsec = timeUsec; - - //Names for the RMC message items - enum RmcTokens{MsgType=0,UTC,Status,Lat,LatDir,Lon,LonDir,SpeedKnots, - HeadingTrue,DiffAge,MagneticVar,MagneticDir,ModeInd}; - - //Check for an empty string. Means that we can't tell anything useful. - if ( msg.isDataTokenEmpty(HeadingTrue) ) - { - data->isValid = false; - data->headingTrue = 0.0; - data->headingMagnetic = 0.0; - data->speed = 0.0; - return data.release(); - } - data->isValid = true; - - //UTC time - sscanf(msg.getDataToken(UTC).c_str(),"%02d%02d%lf", - &data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec ); - - //position - int deg; - double min; - double dir; - - //latitude - sscanf(msg.getDataToken(Lat).c_str(),"%02d%lf",°,&min); - dir = (*msg.getDataToken(LatDir).c_str()=='N') ? 1.0 : -1.0; - data->latitude=dir*(deg+(min/60.0)); - //longitude - sscanf(msg.getDataToken(Lon).c_str(),"%03d%lf",°,&min); - dir = (*msg.getDataToken(LonDir).c_str()=='E') ? 1.0 : -1.0; - data->longitude=dir*(deg+(min/60.0)); - - // true heading - double headingRad = DEG2RAD(atof(msg.getDataToken(HeadingTrue).c_str())); - NORMALISE_ANGLE( headingRad ); - data->headingTrue=headingRad; - - // magnetic heading - double headingVar; - try { - // Magnetic deviation from true - headingVar = DEG2RAD(atof(msg.getDataToken(MagneticVar).c_str())); - // Direction of magnetic deviation - if (*msg.getDataToken(MagneticDir).c_str() == 'E') - headingRad -= headingVar; - else - headingRad += headingVar; - } - catch ( const gbxgpsutilacfr::NmeaException& e ) { - // If this occurs, cannot get magnetic heading. Set it to 0. - headingRad = 0.0; - } - NORMALISE_ANGLE( headingRad ); - data->headingMagnetic=headingRad; - - //speed - converted from knots to m/s - data->speed=atof(msg.getDataToken(SpeedKnots).c_str()); - // knots to kph - data->speed*=1.852; - // kph to m/s - data->speed*=(1000/3600.0); - - return data.release(); -} - -} - -/////////////////////////////////////// - -bool -Config::isValid() const -{ - if ( device.empty() ) - return false; - - if ( !( readGga || readVtg || readRme ) ) - return false; - return true; } @@ -274,23 +57,26 @@ std::stringstream ss; ss << "Garmin driver config: " << endl << "\tdevice="<<device << endl + << "\tprotocol="<<protocol << endl << "\twill read sentences: GPGGA="<<readGga<<" GPVTG="<<readVtg<<" PGRME="<<readRme<<" GPRMC="<<readRmc; return ss.str(); } /////////////////////////////////////// -Driver::Driver( const Config &config, - gbxutilacfr::Tracer &tracer, - gbxutilacfr::Status &status ) : +Driver::Driver( const Config &config, + gbxutilacfr::Tracer &tracer, + gbxutilacfr::Status &status, + int serialDebugLevel ) : config_(config), tracer_(tracer), status_(status) { - if ( !config_.isValid() ) + std::string reason; + if ( !config_.isValid(reason) ) { stringstream ss; - ss << "Invalid config: " << config_.toString(); + ss << "Invalid config: " << reason << endl << config_.toString(); throw gbxutilacfr::Exception( ERROR_INFO, ss.str() ); } @@ -302,8 +88,10 @@ int baud = 4800; // the first 5 initialization messages come in 1 sec. Therefore, 2 secs should be conservative. - serial_.reset( new gbxserialacfr::Serial( config_.device, baud, gbxserialacfr::Serial::Timeout(2,0) ) ); - + serial_.reset( new gbxserialacfr::Serial( config_.device, + baud, + gbxserialacfr::Serial::Timeout(2, 0), + serialDebugLevel ) ); init(); } @@ -346,37 +134,37 @@ // Non-Garmin devices do not support message enabling and disabling if (config_.protocol != "Garmin") return; - //Create the messages that we are going to send and add the checksums - //Note that the checksum field is filled with 'x's before we start + // Create the messages that we are going to send and add the checksums + // Note that the checksum field is filled with 'x's before we start //First disables all output messages then enable selected ones only. tracer_.debug( "Driver::enableDevice(): calling disableAllMsg", 10 ); - gbxgpsutilacfr::NmeaMessage disableAllMsg( "$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum ); + gbxgpsutilacfr::NmeaSentence disableAllMsg( "$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( disableAllMsg.sentence() ); // alexb: what is this sleep for? - sleep(1); + //sleep(1); if ( config_.readGga ) { tracer_.debug( "Driver::enableDevice(): calling enableGgaMsg", 10 ); - gbxgpsutilacfr::NmeaMessage enableGgaMsg( "$PGRMO,GPGGA,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); + gbxgpsutilacfr::NmeaSentence enableGgaMsg( "$PGRMO,GPGGA,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( enableGgaMsg.sentence() ); } if ( config_.readVtg ) { tracer_.debug( "Driver::enableDevice(): calling enableVtgMsg", 10 ); - gbxgpsutilacfr::NmeaMessage enableVtgMsg( "$PGRMO,GPVTG,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); + gbxgpsutilacfr::NmeaSentence enableVtgMsg( "$PGRMO,GPVTG,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( enableVtgMsg.sentence() ); } if ( config_.readRme ) { tracer_.debug( "Driver::enableDevice(): calling enableRmeMsg", 10 ); - gbxgpsutilacfr::NmeaMessage enableRmeMsg( "$PGRMO,PGRME,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); + gbxgpsutilacfr::NmeaSentence enableRmeMsg( "$PGRMO,PGRME,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( enableRmeMsg.sentence() ); } if ( config_.readRmc ) { tracer_.debug( "Driver::enableDevice(): calling enableRmcMsg", 10 ); - gbxgpsutilacfr::NmeaMessage enableRmcMsg( "$PGRMO,GPRMC,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); + gbxgpsutilacfr::NmeaSentence enableRmcMsg( "$PGRMO,GPRMC,1*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( enableRmcMsg.sentence() ); } @@ -388,7 +176,7 @@ Driver::disableDevice() { // Simply send the no messages command! - gbxgpsutilacfr::NmeaMessage disableAllMsg( "$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum ); + gbxgpsutilacfr::NmeaSentence disableAllMsg( "$PGRMO,,2*xx\r\n",gbxgpsutilacfr::AddChecksum ); serial_->writeString( disableAllMsg.sentence() ); } @@ -396,7 +184,7 @@ Driver::read() { std::auto_ptr<GenericData> genericData; - gbxgpsutilacfr::NmeaMessage nmeaMessage; + gbxgpsutilacfr::NmeaSentence nmeaMessage; int nmeaExceptionCount = 0; int nmeaFailChecksumCount = 0; @@ -434,18 +222,6 @@ assert( *(serialData.end()-1) == '\n' && "Driver: Serial data did not end in '\n'" ); serialData.erase( serialData.end()-1 ); - // dealing with unexplained cntrl characters in the message -/* - for ( string::iterator it=serialData.begin(); it!=serialData.end(); ++it ) { - if ( iscntrl( *it ) ) { - // debug - cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<" before='"<<serialData<<"'"<<endl; - cout<<now.tv_sec<<" "<<now.tv_usec<<" removing control char="<<std::hex<<(unsigned int)*it<<std::dec<<endl; - it = serialData.erase( it ); - cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<" after='"<<serialData<<"'"<<endl; - } - } -*/ //Put it into the message object and checksum the data try { // This throws if it cannot find the * to deliminate the checksum field @@ -463,19 +239,13 @@ } nmeaExceptionCount = 0; - // debug -// if ( nmeaFailChecksumCount>0 ) -// cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<nmeaFailChecksumCount<<" the sentence AFTER, raw='"<<serialData<<"'"<<endl<<endl; - // Only populate the data structures if our message passes the checksum! const int nmeaFailChecksumMaxCount = 10; if ( !nmeaMessage.haveValidChecksum() ) { // Dont throw an exception on the first failed checksum. if ( nmeaFailChecksumCount++ < nmeaFailChecksumMaxCount ) { -// tracer_.warning("Gps driver: Single message failed checksum. Not throwing an exception yet!" ); // debug cout<<now.tv_sec<<" "<<now.tv_usec<<" "<<nmeaFailChecksumCount<<endl; -// <<" sentence='"<<nmeaMessage.sentence()<<"' raw='"<<serialData<<"'"<<endl; continue; } else { @@ -486,7 +256,7 @@ } nmeaFailChecksumCount = 0; - //First split up the data fields in the string we have read. + // First split up the data fields in the string we have read. nmeaMessage.parseTokens(); // We should not get any messages with failed checksums, but just in case @@ -548,7 +318,7 @@ } else { stringstream ss; ss << "Message type unknown " << MsgType <<endl; - // if we get here the msg is unknown + // if we get here the MsgType is unknown if ( config_.ignoreUnknown ) tracer_.debug( ss.str() ); else Modified: gearbox/trunk/src/gbxgarminacfr/driver.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/driver.h 2010-03-17 06:19:56 UTC (rev 487) +++ gearbox/trunk/src/gbxgarminacfr/driver.h 2010-03-18 07:54:14 UTC (rev 488) @@ -15,6 +15,7 @@ #include <gbxutilacfr/tracer.h> #include <gbxutilacfr/status.h> #include <memory> +#include <gbxgarminacfr/nmeamessages.h> namespace gbxgarminacfr { @@ -23,6 +24,7 @@ { public: Config() : + protocol("Garmin"), readGga(true), readVtg(true), readRme(true), @@ -30,9 +32,7 @@ ignoreUnknown(false) {}; //! Returns true if the configuration is sane. Checks include: - //! - a non-empty device name - //! - at least one read-sentence flag set to TRUE - bool isValid() const; + bool isValid( std::string &reason ) const; //! Returns human-readable configuration description. std::string toString() const; @@ -58,200 +58,6 @@ bool ignoreUnknown; }; -//! Possible types GenericData can contain -enum DataType -{ - //! Contents of PGGGA message. - GpGga, - //! Contents of PGVTG message. - GpVtg, - //! Contents of PGRME message. - PgRme, - //! Contents of GPRMC message. - GpRmc -}; - -//! Generic data type returned by a read -class GenericData -{ -public: - virtual ~GenericData() {}; - //! Returns data type. - virtual DataType type() const=0; - -private: -}; - -//! GPS fix types. -enum FixType -{ - //! Invalid or not available - Invalid, - //! Autonomous position - //! (This is the normal case for non-differential GPS) - Autonomous, - //! Differentially corrected - Differential -}; -std::string toString( const FixType &f ); - -//! Fix data structure. Note that when fixType is Invalid, all other data except the time stamps -//! are meaningless. -struct GgaData : public GenericData -{ -public: - DataType type() const { return GpGga; } - - //! Time (according to the computer clock) when data was measured. - //! Number of seconds - int timeStampSec; - //! Time (according to the computer clock) when data was measured. - //! Number of microseconds - int timeStampUsec; - - //! UTC time (according to the GPS device), reference is Greenwich. - //! Hour [0..23] - int utcTimeHrs; - //! UTC time (according to the GPS device), reference is Greenwich. - //! Minutes [0..59] - int utcTimeMin; - //! UTC time (according to the GPS device), reference is Greenwich. - //! Seconds [0.0..59.9999(9)] - double utcTimeSec; - - //! Latitude [degrees] - double latitude; - //! Longitude [degrees] - double longitude; - //! Altitude is meaningful if and only if isAltitudeKnown - bool isAltitudeKnown; - //! Altitude [metres above ellipsoid] (only meaningful if isAltitudeKnown) - double altitude; - - //! Fix type. When fixType is Invalid, all other data except the time stamps - //! are meaningless. - FixType fixType; - - //! Number of satellites - int satellites; - - //! Horizontal dilution of position [metres] - double horizontalDilutionOfPosition; - - //! Height of geoid (mean sea level) above WGS84 ellipsoid [metres] - double geoidalSeparation; -}; -std::string toString( const GgaData &d ); -inline std::ostream &operator<<( std::ostream &s, const GgaData &d ) -{ return s << toString(d); } - -//! Vector track and speed over ground data structure. -class VtgData : public GenericData -{ -public: - DataType type() const { return GpVtg; } - - //! Time (according to the computer clock) when data was measured. - //! Number of seconds - int timeStampSec; - //! Time (according to the computer clock) when data was measured. - //! Number of microseconds - int timeStampUsec; - - //! When false, means that the GPS unit can't make a valid measurement - //! (so all data other than the timestamp is meaningless). - bool isValid; - - //! Heading/track/course with respect to true North [rad] - double headingTrue; - //! Heading/track/course with respect to magnetic North [rad] - double headingMagnetic; - //! Horizontal velocity [metres/second] - double speed; -}; -std::string toString( const VtgData &d ); -inline std::ostream &operator<<( std::ostream &s, const VtgData &d ) -{ return s << toString(d); } - -//! Gps data structure -//! (This one is Garmin-specific) -class RmeData : public GenericData -{ -public: - DataType type() const { return PgRme; } - - //! Time (according to the computer clock) when data was measured. - //! Number of seconds - int timeStampSec; - //! Time (according to the computer clock) when data was measured. - //! Number of microseconds - int timeStampUsec; - - //! When false, means that the GPS unit can't make a valid measurement - //! (so all data other than the timestamp is meaningless). - bool isValid; - - //! When false, means that the GPS unit can't tell us anything - //! about our vertical error - bool isVerticalPositionErrorValid; - - //! Horizontal position error: one standard deviation [metres)] - double horizontalPositionError; - //! Vertical position error: one standard deviation [metres] - double verticalPositionError; - - //! Estimated position error. - double estimatedPositionError; -}; -std::string toString( const RmeData &d ); -inline std::ostream &operator<<( std::ostream &s, const RmeData &d ) -{ return s << toString(d); } - -//! Gps data structure -class RmcData : public GenericData -{ -public: - DataType type() const { return GpRmc; } - - //! Time (according to the computer clock) when data was measured. - //! Number of seconds - int timeStampSec; - //! Time (according to the computer clock) when data was measured. - //! Number of microseconds - int timeStampUsec; - - //! UTC time (according to the GPS device), reference is Greenwich. - //! Hour [0..23] - int utcTimeHrs; - //! UTC time (according to the GPS device), reference is Greenwich. - //! Minutes [0..59] - int utcTimeMin; - //! UTC time (according to the GPS device), reference is Greenwich. - //! Seconds [0.0..59.9999(9)] - double utcTimeSec; - - //! Latitude [degrees] - double latitude; - //! Longitude [degrees] - double longitude; - - //! When false, means that the GPS unit can't make a valid measurement - //! (so all data other than the timestamp is meaningless). - bool isValid; - - //! Heading/track/course with respect to true North [rad] - double headingTrue; - //! Heading/track/course with respect to magnetic North [rad] - double headingMagnetic; - //! Horizontal velocity [metres/second] - double speed; -}; -std::string toString( const RmcData &d ); -inline std::ostream &operator<<( std::ostream &s, const RmcData &d ) -{ return s << toString(d); } - - - /*! Garmin GPS driver. @@ -260,10 +66,14 @@ This standard dictates a transfer rate of 4800 baud. This driver can read only the following messages (sentences): -- GPGGA fix data -- PGRME (estimated error) - not sent if set to 0183 1.5 (garmin-specific) -- GPVTG vector track and speed over ground -- GPRMC +- GPGGA: fix data +- PGRME: (estimated error) - not sent if set to 0183 1.5 (garmin-specific) +- GPVTG: vector track and speed over ground +- GPRMC: known as the "Recommended Minimum" sentence, is the most + common sentence transmitted by GPS devices. This one sentence + contains nearly everything a GPS application needs: latitude, + longitude, speed, bearing, satellite-derived time, fix status + and magnetic variation. Processing of individual messages can be disabled in the Config structure. @@ -284,9 +94,10 @@ //! gbxutilacfr::Tracer and gbxutilacfr::Status allow //! (human-readable and machine-readable respectively) external //! monitorining of the driver's internal state. - Driver( const Config& config, - gbxutilacfr::Tracer& tracer, - gbxutilacfr::Status& status ); + Driver( const Config &config, + gbxutilacfr::Tracer &tracer, + gbxutilacfr::Status &status, + int serialDebugLevel = 0 ); ~Driver(); Deleted: gearbox/trunk/src/gbxgarminacfr/nmea.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmea.cpp 2010-03-17 06:19:56 UTC (rev 487) +++ gearbox/trunk/src/gbxgarminacfr/nmea.cpp 2010-03-18 07:54:14 UTC (rev 488) @@ -1,254 +0,0 @@ -/* - * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics - * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks, Alexei Makarenko, Tobias Kaupp - * - * This distribution is licensed to you under the terms described in - * the LICENSE file included in this distribution. - * - */ - -#include <stdio.h> -#include <string> -#include <iostream> -#include <assert.h> -#include <sstream> -#include <gbxutilacfr/tokenise.h> - -// ////////////////////////////// - -// // Ensure we have strnlen -// // eg. Solaris doesn't define strnlen in string.h, so define it here. -// #if !HAVE_STRNLEN - -// #include <cstring> - -// // inline the fucker to guard against multiple inclusion, without the -// // hassle of a special lib. -// inline size_t strnlen(const char *s, size_t maxlen) -// { -// char *p; -// if (s == NULL) { -// return maxlen; -// } -// p = (char *)memchr(s, 0, maxlen); -// if (p == NULL) { -// return maxlen; -// } -// return ((p - s) + 1); -// } -// #endif - -// ////////////////////////////// - -#include "nmea.h" - -using namespace std; -using namespace gbxgpsutilacfr; - -const char NMEAStartOfSentence = '$'; -const char NMEAChecksumDelim = '*'; - - -//The blank constructor -NmeaMessage::NmeaMessage() -{ - init(); -} - -void NmeaMessage::init() -{ - haveCheckSum_ = false; - checkSumOK_ = false; - - // Now clear the internal data store - sentence_.clear(); - dataTokens_.clear(); -} - -NmeaMessage::NmeaMessage(const std::string &sentence, NmeaMessageOptions addOrTestCheckSum) -{ - init(); - setSentence(sentence,addOrTestCheckSum); -} - - -//Load the data as requested and test the checksum if we are asked to. -void -NmeaMessage::setSentence(const std::string &data, NmeaMessageOptions addOrTestCheckSum) -{ - init(); - - sentence_ = data; - - switch ( addOrTestCheckSum ) - { - case TestChecksum: { - // This is for Rx'd data that we need to test for correct reception - // (internally it will also call addCheckSum()) - testChecksumOk(); - break; - } - case AddChecksum: { - // This is for Tx data that needs to checksummed before sending - addCheckSum(); - checkSumOK_ = true; - break; - } - case DontTestOrAddChecksum: - break; - default: - assert( false && "unrecognized message option" ); - } -} - -bool -NmeaMessage::testChecksumOk() -{ - haveCheckSum_ = true; - checkSumOK_ = false; - - //First save the existing two checksum chars from the message - //These are straight after the '*' character - const size_t starPos = sentence_.find( NMEAChecksumDelim ); - if ( starPos == std::string::npos ) - { - // cout<<"device: no checksum delimiter"<<endl; - return false; - } - - if ( starPos+2 >= sentence_.size() ) - { - // cout<<"device: no checksum after delimiter"<<endl; - return false; - } - - //save the high and low bytes of the checksum - //Make sure they are in upper case! - const int checksumPos = starPos+1; - const char chksum_HIB = (char)toupper(sentence_[checksumPos]); - const char chksum_LOB = (char)toupper(sentence_[checksumPos+1]); - - //invalidate the existing checksum - sentence_[checksumPos] = 'x'; - sentence_[checksumPos+1] = 'x'; - - //Re-calculate our own copy of the checksum - addCheckSum(); - - //Now compare our saved version with our new ones - if( (chksum_HIB == sentence_[checksumPos]) && (chksum_LOB == sentence_[checksumPos+1]) ) { - //all looked good! - checkSumOK_ = true; - return true; - } - - //failed the checksum! -// cout<<"device: '"<<chksum_HIB<<chksum_LOB <<"' ("<<std::hex<<(unsigned int)chksum_HIB<<","<<(unsigned int)chksum_LOB<<std::dec<<") " -// <<"driver: '"<<*ptr<<*(ptr+1)<<"'" <<"' ("<<std::hex<<(unsigned int)*ptr<<","<<(unsigned int)*(ptr+1)<<std::dec<<") "<<endl; - return false; -} - -// Add the checksum chars to an existing message -// NOTE: this assumes that there is allready space in the message for -// the checksum, and that the checksum delimiter is there -void -NmeaMessage::addCheckSum() -{ - assert( haveSentence() && "calling addCheckSum() without a sentence" ); - - haveCheckSum_ = true; - - //check that we have the '$' at the start - if ( sentence_[0]!= NMEAStartOfSentence ) { - throw NmeaException("cannot calculate checksum, missing leading '$'"); - } - - unsigned char chkRunning = 0; - - // we start from 1 to skip the leading '$' - int loopCount; - for ( loopCount = 1; loopCount < (int)(sentence_.size()); loopCount++ ) - { - unsigned char nextChar = static_cast<unsigned char>(sentence_[loopCount]); - - // no delimiter uh oh - if( (nextChar=='\r') || (nextChar=='\n') || (nextChar=='\0') ) { - throw NmeaException("cannot calculate checksum, missing final '*'"); - } - - // goodie we found it (the '*' is not included into the checksum) - if ( nextChar==NMEAChecksumDelim ) { - break; - } - - // alexm: gcc-4.3 is very strict with the next line. - // not sure what to do about it yet. - // http://gcc.gnu.org/ml/gcc/2008-05/msg00363.html - - // Keep the running XOR total - chkRunning ^= nextChar; - } - - if ( loopCount+2 >= (int)(sentence_.size()) ) - { - throw NmeaException("addCheckSum(): no space for checksum of '*' not found."); - } - - //Put the byte values as upper case HEX back into the message - sprintf( &(sentence_[loopCount + 1]),"%02X", chkRunning ); -} - -// Parse the data fields of our message... -void -NmeaMessage::parseTokens() -{ - //We should not attempt to be parsing a message twice... - assert( numDataTokens()==0 && "calling parseTokens() with tokens" ); - - //Split the message at the commas - //TODO cope with missing fields - dataTokens_ = gbxutilacfr::tokenise(sentence_, ","); - - //Now discard the $ and the * from the first and last tokens... - //TODO : - dataTokens_[0] = - - //keep track of what we have done. - haveTokens_ = true; -} - -bool -NmeaMessage::isDataTokenEmpty(int i) const -{ - if ( i >= (int)(dataTokens_.size()) ) - { - stringstream ss; - ss << "NmeaMessage::" << __func__ - << ": attempt to getDataToken("<<i<<") but only " << dataTokens_.size() << " exist in sentence: " - << sentence_; - throw NmeaException( ss.str() ); - } - return dataTokens_[i].empty(); -} - -const std::string & -NmeaMessage::getDataToken(int i) const -{ - if ( i >= (int)(dataTokens_.size()) ) - { - stringstream ss; - ss << "NmeaMessage::" << __func__ - << ": attempt to getDataToken("<<i<<") but only " << dataTokens_.size() << " exist in sentence: " - << sentence_; - throw NmeaException( ss.str() ); - } - if ( dataTokens_[i].empty() ) - { - stringstream ss; - ss << "NmeaMessage::" << __func__ - << ": attempt to getDataToken("<<i<<") but this token is empty in sentence: " - << sentence_; - throw NmeaException( ss.str() ); - } - return dataTokens_[i]; -} Deleted: gearbox/trunk/src/gbxgarminacfr/nmea.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmea.h 2010-03-17 06:19:56 UTC (rev 487) +++ gearbox/trunk/src/gbxgarminacfr/nmea.h 2010-03-18 07:54:14 UTC (rev 488) @@ -1,136 +0,0 @@ -/* - * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics - * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer - * - * This distribution is licensed to you under the terms described in - * the LICENSE file included in this distribution. - * - */ - -#ifndef GBXGPSUTILACFR_NMEA_H -#define GBXGPSUTILACFR_NMEA_H - -#include <vector> -#include <string> - -/* - -for further info: - -http://www.kh-gps.de/nmea-faq.htm -http://vancouver-webpages.com/peter/nmeafaq.txt - -NMEA-0183 sentence - -$aaccc,c--c*hh<CR><LF> -|| || || | -|| || || \________ <CR><LF> - End of sentence (0xOD 0xOA) -|| || |\__________ hh - Checksum field hexadecimal [optional] -|| || \___________ * - Checksum delimiter (0x2A) [optional] -|| |\_______________ c--c - Data sentence block -|| \________________ , - Field delimiter (0x2c) -|\_____________________ aaccc - Address field/Command -\______________________ $ - Start of sentence - - The optional checksum field consists of a "*" and two hex digits - representing the exclusive OR of all characters between, but not - including, the "$" and "*". A checksum is required on some - sentences. - -*/ - -namespace gbxgpsutilacfr { - - -// class SOEXPORT NmeaException : public std::exception -class NmeaException : public std::exception -{ -public: - NmeaException(const char *message) - : message_(message) {} - - NmeaException(const std::string &message) - : message_(message) {} - - virtual ~NmeaException() throw() {} - - virtual const char* what() const throw() { return message_.c_str(); } - -protected: - std::string message_; -}; - - -#define MAX_SENTENCE_LEN 256 - -// When using class to send data, need to add checksum, when reciving data need to test checksum -// Checksums are usually optional -enum NmeaMessageOptions -{ - TestChecksum, - AddChecksum, - DontTestOrAddChecksum -}; - -// class SOEXPORT NmeaMessage{ -class NmeaMessage -{ -public: - NmeaMessage(); - NmeaMessage(const std::string &sentence, NmeaMessageOptions addOrTestCheckSum=DontTestOrAddChecksum ); - - // Set up the internal data for a sentence. - // May throw NmeaException if TestChecksum is specified. - void setSentence(const std::string &data, NmeaMessageOptions addOrTestCheckSum=DontTestOrAddChecksum ); - - // Do we have the raw string? - bool haveSentence() const { return !sentence_.empty(); }; - - // Do we have parsed fields? - bool haveTokens() const { return haveTokens_; }; - - // Do we have a valid checksum? - bool haveValidChecksum() const { return checkSumOK_; }; - - // Have we checked the checksum? - bool haveTestedChecksum()const { return haveCheckSum_; }; - - // calculate the checksum from sentence - // May throw NmeaException. - bool testChecksumOk(); - - // Return the raw sentence string - const std::string &sentence() const { return sentence_; }; - - // Return a single data token as a string. - // Throws an exception if that token is empty (see 'isDataTokenEmpty()') - const std::string &getDataToken(int i) const; - - bool isDataTokenEmpty(int i) const; - - // Return the number of fields - int numDataTokens() const { return dataTokens_.size(); }; - - //Tokenise the string that we received - void parseTokens(); - -private: - void init(); - // May throw NmeaException. - void addCheckSum(); - // Have we parsed data into tokens ? - bool haveTokens_; - // Have we a checksum and is it valid? - bool haveCheckSum_; - bool checkSumOK_; - // The raw sentence, allow for terminator -// char sentence_[MAX_SENTENCE_LEN+1]; - std::string sentence_; - // The tokenised data - std::vector<std::string> dataTokens_; -}; - -} - -#endif Added: gearbox/trunk/src/gbxgarminacfr/nmeamessages.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmeamessages.cpp (rev 0) +++ gearbox/trunk/src/gbxgarminacfr/nmeamessages.cpp 2010-03-18 07:54:14 UTC (rev 488) @@ -0,0 +1,236 @@ +#include "nmeamessages.h" +#include <iostream> +#include "nmeasentence.h" +#include <memory> +#include <cstdlib> +#include <gbxutilacfr/exceptions.h> +#include <gbxutilacfr/mathdefs.h> + +using namespace std; + +namespace gbxgarminacfr { + +// Get the useful bits from a GGA message +GenericData* extractGgaData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ) +{ + std::auto_ptr<GgaData> data( new GgaData ); + + data->timeStampSec = timeSec; + data->timeStampUsec = timeUsec; + + //Names for the tokens in the GGA message + enum GgaTokens{MsgType=0,UTC,Lat,LatDir,Lon,LonDir,FixType, + NSatsUsed,HDOP,Hgt,M1,GeoidHgt,M2,DiffAge,DiffId}; + + //UTC time + sscanf(sentence.getDataToken(UTC).c_str(),"%02d%02d%lf", + &data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec ); + + //number of satellites in use + data->satellites = atoi(sentence.getDataToken(NSatsUsed).c_str()); + + // fix type + switch ( sentence.getDataToken(FixType)[0] ) + { + case '0': + data->fixType = Invalid; + // NOTE: not processing the rest! + data->latitude = 0.0; + data->longitude = 0.0; + data->altitude = 0.0; + data->geoidalSeparation = 0.0; + return data.release(); + case '1': + data->fixType = Autonomous; + break; + case '2': + data->fixType = Differential; + break; + default : + throw gbxutilacfr::Exception( ERROR_INFO, "GGA sentence contains unknown GPS fix type: '"+sentence.getDataToken(FixType)+"'" ); + } + + //position + int deg; + double min; + double dir; + + //latitude + sscanf(sentence.getDataToken(Lat).c_str(),"%02d%lf",°,&min); + dir = (*sentence.getDataToken(LatDir).c_str()=='N') ? 1.0 : -1.0; + data->latitude=dir*(deg+(min/60.0)); + //longitude + sscanf(sentence.getDataToken(Lon).c_str(),"%03d%lf",°,&min); + dir = (*sentence.getDataToken(LonDir).c_str()=='E') ? 1.0 : -1.0; + data->longitude=dir*(deg+(min/60.0)); + + //altitude + data->isAltitudeKnown = !sentence.isDataTokenEmpty(Hgt); + if ( data->isAltitudeKnown ) + data->altitude=atof(sentence.getDataToken(Hgt).c_str()); + + //geoidal Separation + data->geoidalSeparation=atof(sentence.getDataToken(GeoidHgt).c_str()); + + return data.release(); +} + +// VTG provides velocity and heading information +GenericData* extractVtgData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ) +{ + std::auto_ptr<VtgData> data( new VtgData ); + + data->timeStampSec = timeSec; + data->timeStampUsec = timeUsec; + + //Names for the VTG message items + enum VtgTokens{MsgType=0,HeadingTrue,T,HeadingMag,M,SpeedKnots, + N,SpeedKPH,K,ModeInd}; + + //Check for an empty string. Means that we can't tell anything useful. + if ( sentence.isDataTokenEmpty(HeadingTrue) ) + { + data->isValid = false; + data->headingTrue = 0.0; + data->headingMagnetic = 0.0; + data->speed = 0.0; + return data.release(); + } + data->isValid = true; + + // true heading + double headingRad = DEG2RAD(atof(sentence.getDataToken(HeadingTrue).c_str())); + NORMALISE_ANGLE( headingRad ); + data->headingTrue=headingRad; + + // magnetic heading + headingRad = DEG2RAD(atof(sentence.getDataToken(HeadingMag).c_str())); + NORMALISE_ANGLE( headingRad ); + data->headingMagnetic=headingRad; + + //speed - converted to m/s + data->speed=atof(sentence.getDataToken(SpeedKPH).c_str()); + data->speed*=(1000/3600.0); + + return data.release(); +} + +// RME message. This one is garmin specific... Give position error estimates +// See doc.dox for a discussion of the position errors as reported here. +// Essentially the EPE reported by the garmin is a 1 sigma error (RMS) or a +// 68% confidence bounds. +GenericData* extractRmeData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ) +{ + std::auto_ptr<RmeData> data( new RmeData ); + + data->timeStampSec = timeSec; + data->timeStampUsec = timeUsec; + + //Names for the RME message items + enum RmeTokens{MsgType=0,HError,M1,VError,M2,EPE,M3}; + + if ( sentence.isDataTokenEmpty(HError) ) + { + // No valid information + data->isValid = false; + data->isVerticalPositionErrorValid = false; + data->horizontalPositionError = 0.0; + data->verticalPositionError = 0.0; + data->estimatedPositionError = 0.0; + return data.release(); + } + data->isValid = true; + + data->horizontalPositionError = atof(sentence.getDataToken(HError).c_str()); + + if ( sentence.isDataTokenEmpty(VError) ) + { + data->isVerticalPositionErrorValid = false; + data->verticalPositionError = -1; + } + else + { + data->isVerticalPositionErrorValid = true; + data->verticalPositionError = atof(sentence.getDataToken(VError).c_str()); + } + + data->estimatedPositionError = atof(sentence.getDataToken(EPE).c_str()); + return data.release(); +} + +// RMC provides a combination of GGA and VTG data +GenericData* extractRmcData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ) +{ + std::auto_ptr<RmcData> data( new RmcData ); + + data->timeStampSec = timeSec; + data->timeStampUsec = timeUsec; + + //Names for the RMC message items + enum RmcTokens{MsgType=0,UTC,Status,Lat,LatDir,Lon,LonDir,SpeedKnots, + HeadingTrue,DiffAge,MagneticVar,MagneticDir,ModeInd}; + + //Check for an empty string. Means that we can't tell anything useful. + if ( sentence.isDataTokenEmpty(HeadingTrue) ) + { + data->isValid = false; + data->headingTrue = 0.0; + data->headingMagnetic = 0.0; + data->speed = 0.0; + return data.release(); + } + data->isValid = true; + + //UTC time + sscanf(sentence.getDataToken(UTC).c_str(),"%02d%02d%lf", + &data->utcTimeHrs, &data->utcTimeMin, &data->utcTimeSec ); + + //position + int deg; + double min; + double dir; + + //latitude + sscanf(sentence.getDataToken(Lat).c_str(),"%02d%lf",°,&min); + dir = (*sentence.getDataToken(LatDir).c_str()=='N') ? 1.0 : -1.0; + data->latitude=dir*(deg+(min/60.0)); + //longitude + sscanf(sentence.getDataToken(Lon).c_str(),"%03d%lf",°,&min); + dir = (*sentence.getDataToken(LonDir).c_str()=='E') ? 1.0 : -1.0; + data->longitude=dir*(deg+(min/60.0)); + + // true heading + double headingRad = DEG2RAD(atof(sentence.getDataToken(HeadingTrue).c_str())); + NORMALISE_ANGLE( headingRad ); + data->headingTrue=headingRad; + + // magnetic heading + double headingVar; + try { + // Magnetic deviation from true + headingVar = DEG2RAD(atof(sentence.getDataToken(MagneticVar).c_str())); + // Direction of magnetic deviation + if (*sentence.getDataToken(MagneticDir).c_str() == 'E') + headingRad -= headingVar; + else + headingRad += headingVar; + } + catch ( const gbxgpsutilacfr::NmeaException& e ) { + // If this occurs, cannot get magnetic heading. Set it to 0. + headingRad = 0.0; + } + NORMALISE_ANGLE( headingRad ); + data->headingMagnetic=headingRad; + + //speed - converted from knots to m/s + data->speed=atof(sentence.getDataToken(SpeedKnots).c_str()); + // knots to kph + data->speed*=1.852; + // kph to m/s + data->speed*=(1000/3600.0); + + return data.release(); +} + +} + Added: gearbox/trunk/src/gbxgarminacfr/nmeamessages.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmeamessages.h (rev 0) +++ gearbox/trunk/src/gbxgarminacfr/nmeamessages.h 2010-03-18 07:54:14 UTC (rev 488) @@ -0,0 +1,216 @@ +/* + * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics + * http://gearbox.sf.net/ + * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer + * + * This distribution is licensed to you under the terms described in + * the LICENSE file included in this distribution. + * + */ +#ifndef GBXGPSUTILACFR_NMEAMESSAGES_H +#define GBXGPSUTILACFR_NMEAMESSAGES_H + +#include <string> +#include <gbxgarminacfr/nmeasentence.h> + +namespace gbxgarminacfr { + +//! Possible types GenericData can contain +enum DataType +{ + //! Contents of PGGGA message. + GpGga, + //! Contents of PGVTG message. + GpVtg, + //! Contents of PGRME message. + PgRme, + //! Contents of GPRMC message. + GpRmc +}; + +//! Generic data type returned by a read +class GenericData +{ +public: + virtual ~GenericData() {}; + //! Returns data type. + virtual DataType type() const=0; + +private: +}; + +//! GPS fix types. +enum FixType +{ + //! Invalid or not available + Invalid, + //! Autonomous position + //! (This is the normal case for non-differential GPS) + Autonomous, + //! Differentially corrected + Differential +}; +std::string toString( const FixType &f ); + +//! Fix data structure. Note that when fixType is Invalid, all other data except the time stamps +//! are meaningless. +struct GgaData : public GenericData +{ +public: + DataType type() const { return GpGga; } + + //! Time (according to the computer clock) when data was measured. + //! Number of seconds + int timeStampSec; + //! Time (according to the computer clock) when data was measured. + //! Number of microseconds + int timeStampUsec; + + //! UTC time (according to the GPS device), reference is Greenwich. + //! Hour [0..23] + int utcTimeHrs; + //! UTC time (according to the GPS device), reference is Greenwich. + //! Minutes [0..59] + int utcTimeMin; + //! UTC time (according to the GPS device), reference is Greenwich. + //! Seconds [0.0..59.9999(9)] + double utcTimeSec; + + //! Latitude [degrees] + double latitude; + //! Longitude [degrees] + double longitude; + //! Altitude is meaningful if and only if isAltitudeKnown + bool isAltitudeKnown; + //! Altitude [metres above ellipsoid] (only meaningful if isAltitudeKnown) + double altitude; + + //! Fix type. When fixType is Invalid, all other data except the time stamps + //! are meaningless. + FixType fixType; + + //! Number of satellites + int satellites; + + //! Horizontal dilution of position [metres] + double horizontalDilutionOfPosition; + + //! Height of geoid (mean sea level) above WGS84 ellipsoid [metres] + double geoidalSeparation; +}; +std::string toString( const GgaData &d ); +inline std::ostream &operator<<( std::ostream &s, const GgaData &d ) +{ return s << toString(d); } +GenericData* extractGgaData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); + +//! Vector track and speed over ground data structure. +class VtgData : public GenericData +{ +public: + DataType type() const { return GpVtg; } + + //! Time (according to the computer clock) when data was measured. + //! Number of seconds + int timeStampSec; + //! Time (according to the computer clock) when data was measured. + //! Number of microseconds + int timeStampUsec; + + //! When false, means that the GPS unit can't make a valid measurement + //! (so all data other than the timestamp is meaningless). + bool isValid; + + //! Heading/track/course with respect to true North [rad] + double headingTrue; + //! Heading/track/course with respect to magnetic North [rad] + double headingMagnetic; + //! Horizontal velocity [metres/second] + double speed; +}; +std::string toString( const VtgData &d ); +inline std::ostream &operator<<( std::ostream &s, const VtgData &d ) +{ return s << toString(d); } +GenericData* extractVtgData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); + +//! Gps data structure +//! (This one is Garmin-specific) +class RmeData : public GenericData +{ +public: + DataType type() const { return PgRme; } + + //! Time (according to the computer clock) when data was measured. + //! Number of seconds + int timeStampSec; + //! Time (according to the computer clock) when data was measured. + //! Number of microseconds + int timeStampUsec; + + //! When false, means that the GPS unit can't make a valid measurement + //! (so all data other than the timestamp is meaningless). + bool isValid; + + //! When false, means that the GPS unit can't tell us anything + //! about our vertical error + bool isVerticalPositionErrorValid; + + //! Horizontal position error: one standard deviation [metres)] + double horizontalPositionError; + //! Vertical position error: one standard deviation [metres] + double verticalPositionError; + + //! Estimated position error. + double estimatedPositionError; +}; +std::string toString( const RmeData &d ); +inline std::ostream &operator<<( std::ostream &s, const RmeData &d ) +{ return s << toString(d); } +GenericData* extractRmeData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); + +//! Gps data structure +class RmcData : public GenericData +{ +public: + DataType type() const { return GpRmc; } + + //! Time (according to the computer clock) when data was measured. + //! Number of seconds + int timeStampSec; + //! Time (according to the computer clock) when data was measured. + //! Number of microseconds + int timeStampUsec; + + //! UTC time (according to the GPS device), reference is Greenwich. + //! Hour [0..23] + int utcTimeHrs; + //! UTC time (according to the GPS device), reference is Greenwich. + //! Minutes [0..59] + int utcTimeMin; + //! UTC time (according to the GPS device), reference is Greenwich. + //! Seconds [0.0..59.9999(9)] + double utcTimeSec; + + //! Latitude [degrees] + double latitude; + //! Longitude [degrees] + double longitude; + + //! When false, means that the GPS unit can't make a valid measurement + //! (so all data other than the timestamp is meaningless). + bool isValid; + + //! Heading/track/course with respect to true North [rad] + double headingTrue; + //! Heading/track/course with respect to magnetic North [rad] + double headingMagnetic; + //! Horizontal velocity [metres/second] + double speed; +}; +std::string toString( const RmcData &d ); +inline std::ostream &operator<<( std::ostream &s, const RmcData &d ) +{ return s << toString(d); } +GenericData* extractRmcData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); + +} + +#endif Added: gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp (rev 0) +++ gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp 2010-03-18 07:54:14 UTC (rev 488) @@ -0,0 +1,254 @@ +/* + * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics + * http://gearbox.sf.net/ + * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks, Alexei Makarenko, Tobias Kaupp + * + * This distribution is licensed to you under the terms described in + * the LICENSE file included in this distribution. + * + */ + +#include <stdio.h> +#include <string> +#include <iostream> +#include <assert.h> +#include <sstream> +#include <gbxutilacfr/tokenise.h> + +// ////////////////////////////// + +// // Ensure we have strnlen +// // eg. Solaris doesn't define strnlen in string.h, so define it here. +// #if !HAVE_STRNLEN + +// #include <cstring> + +// // inline the fucker to guard against multiple inclusion, without the +// // hassle of a special lib. +// inline size_t strnlen(const char *s, size_t maxlen) +// { +// char *p; +// if (s == NULL) { +// return maxlen; +// } +// p = (char *)memchr(s, 0, maxlen); +// if (p == NULL) { +// return maxlen; +// } +// return ((p - s) + 1); +// } +// #endif + +// ////////////////////////////// + +#include "nmeasentence.h" + +using namespace std; +using namespace gbxgpsutilacfr; + +const char NMEAStartOfSentence = '$'; +const char NMEAChecksumDelim = '*'; + + +//The blank constructor +NmeaSentence::NmeaSentence() +{ + init(); +} + +void NmeaSentence::init() +{ + haveCheckSum_ = false; + checkSumOK_ = false; + + // Now clear the internal data store + sentence_.clear(); + dataTokens_.clear(); +} + +NmeaSentence::NmeaSentence(const std::string &sentence, NmeaSentenceOptions addOrTestCheckSum) +{ + init(); + setSentence(sentence,addOrTestCheckSum); +} + + +//Load the data as requested and test the checksum if we are asked to. +void +NmeaSentence::setSentence(const std::string &data, NmeaSentenceOptions addOrTestCheckSum) +{ + init(); + + sentence_ = data; + + switch ( addOrTestCheckSum ) + { + case TestChecksum: { + // This is for Rx'd data that we need to test for correct reception + // (internally it will also call addCheckSum()) + testChecksumOk(); + break; + } + case AddChecksum: { + // This is for Tx data that needs to checksummed before sending + addCheckSum(); + checkSumOK_ = true; + break; + } + case DontTestOrAddChecksum: + break; + default: + assert( false && "unrecognized message option" ); + } +} + +bool +NmeaSentence::testChecksumOk() +{ + haveCheckSum_ = true; + checkSumOK_ = false; + + //First save the existing two checksum chars from the message + //These are straight after the '*' character + const size_t starPos = sentence_.find( NMEAChecksumDelim ); + if ( starPos == std::string::npos ) + { + // cout<<"device: no checksum delimiter"<<endl; + return false; + } + + if ( starPos+2 >= sentence_.size() ) + { + // cout<<"device: no checksum after delimiter"<<endl; + return false; + } + + //save the high and low bytes of the checksum + //Make sure they are in upper case! + const int checksumPos = starPos+1; + const char chksum_HIB = (char)toupper(sentence_[checksumPos]); + const char chksum_LOB = (char)toupper(sentence_[checksumPos+1]); + + //invalidate the existing checksum + sentence_[checksumPos] = 'x'; + sentence_[checksumPos+1] = 'x'; + + //Re-calculate our own copy of the checksum + addCheckSum(); + + //Now compare our saved version with our new ones + if( (chksum_HIB == sentence_[checksumPos]) && (chksum_LOB == sentence_[checksumPos+1]) ) { + //all looked good! + checkSumOK_ = true; + return true; + } + + //failed the checksum! +// cout<<"device: '"<<chksum_HIB<<chksum_LOB <<"' ("<<std::hex<<(unsigned int)chksum_HIB<<","<<(unsigned int)chksum_LOB<<std::dec<<") " +// <<"driver: '"<<*ptr<<*(ptr+1)<<"'" <<"' ("<<std::hex<<(unsigned int)*ptr<<","<<(unsigned int)*(ptr+1)<<std::dec<<") "<<endl; + return false; +} + +// Add the checksum chars to an existing message +// NOTE: this assumes that there is allready space in the message for +// the checksum, and that the checksum delimiter is there +void +NmeaSentence::addCheckSum() +{ + assert( haveSentence() && "calling addCheckSum() without a sentence" ); + + haveCheckSum_ = true; + + //check that we have the '$' at the start + if ( sentence_[0]!= NMEAStartOfSentence ) { + throw NmeaException("cannot calculate checksum, missing leading '$'"); + } + + unsigned char chkRunning = 0; + + // we start from 1 to skip the leading '$' + int loopCount; + for ( loopCount = 1; loopCount < (int)(sentence_.size()); loopCount++ ) + { + un... [truncated message content] |
From: <gb...@us...> - 2010-05-10 03:42:34
|
Revision: 495 http://gearbox.svn.sourceforge.net/gearbox/?rev=495&view=rev Author: gbiggs Date: 2010-05-10 03:42:28 +0000 (Mon, 10 May 2010) Log Message: ----------- Added history note for new Hokuyo tool Modified Paths: -------------- gearbox/trunk/doc/history.dox gearbox/trunk/src/hokuyo_aist/CMakeLists.txt Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2010-05-10 03:38:09 UTC (rev 494) +++ gearbox/trunk/doc/history.dox 2010-05-10 03:42:28 UTC (rev 495) @@ -47,6 +47,9 @@ - added a function to access the component status. - removed functions to specify "infrastructure state" which is now expected to be an optional subsystem. +- libhokuyo_aist: + - Added a useful utility to get a laser's ID and use that to create nodes in /dev. Thanks to Luiz Mirisola. + @par Retired libraries @section gbx_doc_history_911 Changes in Release 9.11 Modified: gearbox/trunk/src/hokuyo_aist/CMakeLists.txt =================================================================== --- gearbox/trunk/src/hokuyo_aist/CMakeLists.txt 2010-05-10 03:38:09 UTC (rev 494) +++ gearbox/trunk/src/hokuyo_aist/CMakeLists.txt 2010-05-10 03:42:28 UTC (rev 495) @@ -29,7 +29,6 @@ GBX_ADD_HEADERS (${libName} ${hdrs}) add_subdirectory (getid) - if (GBX_BUILD_TESTS) add_subdirectory (test) endif (GBX_BUILD_TESTS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bo...@us...> - 2010-09-05 05:23:22
|
Revision: 515 http://gearbox.svn.sourceforge.net/gearbox/?rev=515&view=rev Author: borax00 Date: 2010-09-05 05:23:13 +0000 (Sun, 05 Sep 2010) Log Message: ----------- MR Changes Modified Paths: -------------- gearbox/trunk/cmake/UseBasicRules.cmake gearbox/trunk/doc/announce.dox gearbox/trunk/doc/buildsys.dox gearbox/trunk/doc/contributors.dox gearbox/trunk/doc/depends.dox gearbox/trunk/doc/devguide.dox gearbox/trunk/doc/documentation.dox gearbox/trunk/doc/getting.dox gearbox/trunk/doc/history.dox gearbox/trunk/doc/index.dox gearbox/trunk/doc/install_debian.dox gearbox/trunk/doc/install_gentoo.dox gearbox/trunk/doc/logo.dox gearbox/trunk/doc/overview.dox gearbox/trunk/doc/practices.dox gearbox/trunk/doc/principles.dox gearbox/trunk/doc/publications.dox gearbox/trunk/doc/release_instructions.dox gearbox/trunk/doc/users.dox gearbox/trunk/doc/version_control.dox gearbox/trunk/src/basicexample/defs.h gearbox/trunk/src/basicexample/util.cpp gearbox/trunk/src/basicexample/util.h gearbox/trunk/src/gbxadvancedexample/util.cpp gearbox/trunk/src/gbxadvancedexample/util.h gearbox/trunk/src/gbxgarminacfr/doc.dox gearbox/trunk/src/gbxgarminacfr/driver.cpp gearbox/trunk/src/gbxgarminacfr/driver.h gearbox/trunk/src/gbxgarminacfr/nmeamessages.h gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp gearbox/trunk/src/gbxgarminacfr/nmeasentence.h gearbox/trunk/src/gbxgarminacfr/test/test.cpp gearbox/trunk/src/gbxnovatelacfr/driver.cpp gearbox/trunk/src/gbxnovatelacfr/driver.h gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.cpp gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.h gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/test/crc32test.cpp gearbox/trunk/src/gbxnovatelacfr/hw_review.dox gearbox/trunk/src/gbxnovatelacfr/novatel.dox gearbox/trunk/src/gbxnovatelacfr/test/test.cpp gearbox/trunk/src/gbxserialacfr/doc.dox gearbox/trunk/src/gbxserialacfr/gbxserialacfr.h gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.cpp gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.h gearbox/trunk/src/gbxserialacfr/lockfile/test/locktest.cpp gearbox/trunk/src/gbxserialacfr/serial.cpp gearbox/trunk/src/gbxserialacfr/serial.h gearbox/trunk/src/gbxserialacfr/uncopyable.h gearbox/trunk/src/gbxsickacfr/doc.dox gearbox/trunk/src/gbxsickacfr/driver.cpp gearbox/trunk/src/gbxsickacfr/driver.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/buffer.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/gbxiceutilacfr.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/notify.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/safethread.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/store.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/buffertest.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/notifytest.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/safethreadtest.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/storetest.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/test/threadtest.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/thread.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/threadutils.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/threadutils.h gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.cpp gearbox/trunk/src/gbxsickacfr/gbxiceutilacfr/timer.h gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/gbxserialdeviceacfr.h gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.cpp gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/serialdevicehandler.h gearbox/trunk/src/gbxsickacfr/messages.cpp gearbox/trunk/src/gbxsickacfr/messages.h gearbox/trunk/src/gbxsickacfr/serialhandler.cpp gearbox/trunk/src/gbxsickacfr/serialhandler.h gearbox/trunk/src/gbxsickacfr/sickdefines.cpp gearbox/trunk/src/gbxsickacfr/sickdefines.h gearbox/trunk/src/gbxsickacfr/test/test.cpp gearbox/trunk/src/gbxsmartbatteryacfr/exceptions.h gearbox/trunk/src/gbxsmartbatteryacfr/gbxsmartbatteryacfr.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserver.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverhealthchecks.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverhealthchecks.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverparser.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserverreader.h gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.cpp gearbox/trunk/src/gbxsmartbatteryacfr/oceanserversystem.h gearbox/trunk/src/gbxsmartbatteryacfr/smartbattery.cpp gearbox/trunk/src/gbxsmartbatteryacfr/smartbattery.h gearbox/trunk/src/gbxsmartbatteryacfr/smartbatteryacfr.dox gearbox/trunk/src/gbxsmartbatteryacfr/smartbatteryparsing.cpp gearbox/trunk/src/gbxsmartbatteryacfr/smartbatteryparsing.h gearbox/trunk/src/gbxsmartbatteryacfr/test/longtest.cpp gearbox/trunk/src/gbxutilacfr/doc.dox gearbox/trunk/src/gbxutilacfr/exceptions.cpp gearbox/trunk/src/gbxutilacfr/exceptions.h gearbox/trunk/src/gbxutilacfr/gbxutilacfr.h gearbox/trunk/src/gbxutilacfr/mathdefs.h gearbox/trunk/src/gbxutilacfr/status.cpp gearbox/trunk/src/gbxutilacfr/status.h gearbox/trunk/src/gbxutilacfr/stoppable.h gearbox/trunk/src/gbxutilacfr/subhealth.h gearbox/trunk/src/gbxutilacfr/substatus.h gearbox/trunk/src/gbxutilacfr/test/mathtest.cpp gearbox/trunk/src/gbxutilacfr/test/trivialstatustest.cpp gearbox/trunk/src/gbxutilacfr/test/trivialtracertest.cpp gearbox/trunk/src/gbxutilacfr/tokenise.cpp gearbox/trunk/src/gbxutilacfr/tokenise.h gearbox/trunk/src/gbxutilacfr/tracer.cpp gearbox/trunk/src/gbxutilacfr/tracer.h gearbox/trunk/src/gbxutilacfr/trivialstatus.cpp gearbox/trunk/src/gbxutilacfr/trivialstatus.h gearbox/trunk/src/gbxutilacfr/trivialtracer.cpp gearbox/trunk/src/gbxutilacfr/trivialtracer.h Added Paths: ----------- gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/printutil.cpp gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/printutil.h gearbox/trunk/src/gbxsickacfr/gbxserialdeviceacfr/stickinbuffercallback.h gearbox/trunk/src/gbxutilacfr/substatus.cpp Modified: gearbox/trunk/cmake/UseBasicRules.cmake =================================================================== --- gearbox/trunk/cmake/UseBasicRules.cmake 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/cmake/UseBasicRules.cmake 2010-09-05 05:23:13 UTC (rev 515) @@ -16,9 +16,9 @@ # Platform-specific compiler and linker flags # if( NOT GBX_OS_WIN ) - add_definitions( "-Wall" ) + add_definitions( "-Wall -Wnon-virtual-dtor" ) # -# AlexB: Using -Wconversion finds some real bugs, but turns up lots of +# AlexB: Using -Wconversion finds some real bugs, but turns up lots of # false positives, especially in gcc4.3. # (see: http://gcc.gnu.org/ml/gcc/2008-05/msg00363.html) # Modified: gearbox/trunk/doc/announce.dox =================================================================== --- gearbox/trunk/doc/announce.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/announce.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/buildsys.dox =================================================================== --- gearbox/trunk/doc/buildsys.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/buildsys.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/contributors.dox =================================================================== --- gearbox/trunk/doc/contributors.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/contributors.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/depends.dox =================================================================== --- gearbox/trunk/doc/depends.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/depends.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/devguide.dox =================================================================== --- gearbox/trunk/doc/devguide.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/devguide.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/documentation.dox =================================================================== --- gearbox/trunk/doc/documentation.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/documentation.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Components for robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This copy of GearBox is licensed to you under the terms described in the * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/getting.dox =================================================================== --- gearbox/trunk/doc/getting.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/getting.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/history.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/index.dox =================================================================== --- gearbox/trunk/doc/index.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/index.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/install_debian.dox =================================================================== --- gearbox/trunk/doc/install_debian.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/install_debian.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Components for robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This copy of GearBox is licensed to you under the terms described in the * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/install_gentoo.dox =================================================================== --- gearbox/trunk/doc/install_gentoo.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/install_gentoo.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Components for robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This copy of GearBox is licensed to you under the terms described in the * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/logo.dox =================================================================== --- gearbox/trunk/doc/logo.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/logo.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/overview.dox =================================================================== --- gearbox/trunk/doc/overview.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/overview.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This copy of GearBox is licensed to you under the terms described in the * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/practices.dox =================================================================== --- gearbox/trunk/doc/practices.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/practices.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/principles.dox =================================================================== --- gearbox/trunk/doc/principles.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/principles.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/publications.dox =================================================================== --- gearbox/trunk/doc/publications.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/publications.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This copy of GearBox is licensed to you under the terms described in the * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/release_instructions.dox =================================================================== --- gearbox/trunk/doc/release_instructions.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/release_instructions.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/users.dox =================================================================== --- gearbox/trunk/doc/users.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/users.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/doc/version_control.dox =================================================================== --- gearbox/trunk/doc/version_control.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/doc/version_control.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 GearBox Team + * Copyright (c) 2008-2010 GearBox Team * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/basicexample/defs.h =================================================================== --- gearbox/trunk/src/basicexample/defs.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/basicexample/defs.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 Gearbox team + * Copyright (c) 2008-2010 Gearbox Team * * This copy of Gearbox is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/basicexample/util.cpp =================================================================== --- gearbox/trunk/src/basicexample/util.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/basicexample/util.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 Gearbox team + * Copyright (c) 2008-2010 Gearbox Team * * This copy of Gearbox is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/basicexample/util.h =================================================================== --- gearbox/trunk/src/basicexample/util.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/basicexample/util.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 Gearbox team + * Copyright (c) 2008-2010 Gearbox Team * * This copy of Gearbox is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxadvancedexample/util.cpp =================================================================== --- gearbox/trunk/src/gbxadvancedexample/util.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxadvancedexample/util.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 Gearbox team + * Copyright (c) 2008-2010 Gearbox Team * * This copy of Gearbox is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxadvancedexample/util.h =================================================================== --- gearbox/trunk/src/gbxadvancedexample/util.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxadvancedexample/util.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2008 Gearbox team + * Copyright (c) 2008-2010 Gearbox Team * * This copy of Gearbox is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxgarminacfr/doc.dox =================================================================== --- gearbox/trunk/src/gbxgarminacfr/doc.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxgarminacfr/doc.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp + * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxgarminacfr/driver.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/driver.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxgarminacfr/driver.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2009 Duncan Mercer, Alex Brooks, Alexei Makarenko, Tobias Kaupp, Michael Warren + * Copyright (c) 2004-2010 Duncan Mercer, Alex Brooks, Alexei Makarenko, Tobias Kaupp, Michael Warren * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxgarminacfr/driver.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/driver.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxgarminacfr/driver.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Duncan Mercer, Alex Brooks, Alexei Makarenko, Tobias Kaupp + * Copyright (c) 2004-2010 Duncan Mercer, Alex Brooks, Alexei Makarenko, Tobias Kaupp * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxgarminacfr/nmeamessages.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmeamessages.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxgarminacfr/nmeamessages.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer + * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxgarminacfr/nmeasentence.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Mathew Ridley, Alex Brooks, Alexei Makarenko, Tobias Kaupp + * Copyright (c) 2004-2010 Mathew Ridley, Alex Brooks, Alexei Makarenko, Tobias Kaupp * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxgarminacfr/nmeasentence.h =================================================================== --- gearbox/trunk/src/gbxgarminacfr/nmeasentence.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxgarminacfr/nmeasentence.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer + * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxgarminacfr/test/test.cpp =================================================================== --- gearbox/trunk/src/gbxgarminacfr/test/test.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxgarminacfr/test/test.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp + * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/driver.cpp =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/driver.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/driver.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Matthew Ridley, Ben Upcroft, Michael Moser + * Copyright (c) 2004-2010 Matthew Ridley, Ben Upcroft, Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/driver.h =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/driver.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/driver.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Matthew Ridley, Ben Upcroft, Michael Moser + * Copyright (c) 2004-2010 Matthew Ridley, Ben Upcroft, Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.cpp =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.h =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/crc32.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/imudecoder.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/novatelmessages.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/receiverstatusdecoder.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/serialconnectivity.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/test/crc32test.cpp =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/test/crc32test.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/gbxnovatelutilacfr/test/crc32test.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/hw_review.dox =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/hw_review.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/hw_review.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/novatel.dox =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/novatel.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/novatel.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Matthew Ridley, Ben Upcroft, Michael Moser + * Copyright (c) 2004-2010 Matthew Ridley, Ben Upcroft, Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxnovatelacfr/test/test.cpp =================================================================== --- gearbox/trunk/src/gbxnovatelacfr/test/test.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxnovatelacfr/test/test.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Michael Moser + * Copyright (c) 2004-2010 Michael Moser * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxserialacfr/doc.dox =================================================================== --- gearbox/trunk/src/gbxserialacfr/doc.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/doc.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley + * Copyright (c) 2004-2010 Alex Brooks, Mathew Ridley * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxserialacfr/gbxserialacfr.h =================================================================== --- gearbox/trunk/src/gbxserialacfr/gbxserialacfr.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/gbxserialacfr.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley + * Copyright (c) 2004-2010 Alex Brooks, Mathew Ridley * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.cpp =================================================================== --- gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks + * Copyright (c) 2004-2010 Alex Brooks * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.h =================================================================== --- gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/lockfile/lockfile.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks + * Copyright (c) 2004-2010 Alex Brooks * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxserialacfr/lockfile/test/locktest.cpp =================================================================== --- gearbox/trunk/src/gbxserialacfr/lockfile/test/locktest.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/lockfile/test/locktest.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks + * Copyright (c) 2004-2010 Alex Brooks * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxserialacfr/serial.cpp =================================================================== --- gearbox/trunk/src/gbxserialacfr/serial.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/serial.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley + * Copyright (c) 2004-2010 Alex Brooks, Mathew Ridley * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. @@ -64,6 +64,26 @@ namespace { + std::string toHexAndAscii( const char *str, int len ) + { + stringstream ss; + ss << "'"; + for ( int i=0; i < len; i++ ) + { + ss << str[i]; + } + ss << "' ( "; + // ss << "' ("<<std::hex<<std::setfill('0')<<std::setw(3); + for ( int i=0; i < len; i++ ) + { + char buf[3]; + sprintf(buf,"%02x",((int)((unsigned char)(str[i])))); + ss << buf << " "; + } + ss << ")"; + return ss.str(); + } + // Converts an integer baud-rate into a c-style '#define'd baudrate int cBaudrate( int baudRate ) { @@ -577,10 +597,10 @@ if ( debugLevel_ > 1 ) { - cout<<"TRACE(serial.cpp): just read: '"; - for ( int i=0; i < count; i++ ) - cout << ((char*)(buf))[i]; - cout << "'" << endl; + cout<<"TRACE(serial.cpp): just read: "<<toHexAndAscii((char *)buf,count)<<endl; +// for ( int i=0; i < count; i++ ) +// cout << ((char*)(buf))[i]; +// cout << "'" << endl; } return got; @@ -737,7 +757,7 @@ Serial::writeString(const char *str) { if ( debugLevel_ > 0 ) - cout<<"TRACE(serial.cpp): "<<__func__<<"(): writing '"<<str<<"'" << endl; + cout<<"TRACE(serial.cpp): "<<__func__<<"(): writing: "<<toHexAndAscii(str,strlen(str))<<endl; int put; put = ::write(portFd_, str, strlen(str) ); @@ -853,9 +873,7 @@ } if ( debugLevel_ > 1 ) { - cout<<"TRACE(serial.cpp): wrote " << put << " bytes: '"; - for ( int i=0; i < count; i++ ) cout << ((char*)(buf))[i]; - cout << "'" << endl; + cout<<"TRACE(serial.cpp): wrote " << put << " bytes: "<<toHexAndAscii((char *)buf,count)<<endl; } return put; Modified: gearbox/trunk/src/gbxserialacfr/serial.h =================================================================== --- gearbox/trunk/src/gbxserialacfr/serial.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/serial.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Mathew Ridley + * Copyright (c) 2004-2010 Alex Brooks, Mathew Ridley * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxserialacfr/uncopyable.h =================================================================== --- gearbox/trunk/src/gbxserialacfr/uncopyable.h 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxserialacfr/uncopyable.h 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks + * Copyright (c) 2004-2010 Alex Brooks * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxsickacfr/doc.dox =================================================================== --- gearbox/trunk/src/gbxsickacfr/doc.dox 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxsickacfr/doc.dox 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp + * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. Modified: gearbox/trunk/src/gbxsickacfr/driver.cpp =================================================================== --- gearbox/trunk/src/gbxsickacfr/driver.cpp 2010-08-16 02:22:54 UTC (rev 514) +++ gearbox/trunk/src/gbxsickacfr/driver.cpp 2010-09-05 05:23:13 UTC (rev 515) @@ -1,7 +1,7 @@ /* * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics * http://gearbox.sf.net/ - * Copyright (c) 2004-2008 Alex Brooks + * Copyright (c) 2004-2010 Alex Brooks * * This distribution is licensed to you under the terms described in * the LICENSE file included in this distribution. @@ -21,15 +21,15 @@ namespace { - class NoResponseException : public std::exception + class NoRxMsgException : public std::exception { std::string message_; public: - NoResponseException(const char *message) + NoRxMsgException(const char *message) : message_(message) {} - NoResponseException(const std::string &message) + NoRxMsgException(const std::string &message) : message_(message) {} - ~NoResponseException()throw(){} + ~NoRxMsgException()throw(){} virtual const char* what() const throw() { return message_.c_str(); } }; @@ -45,15 +45,15 @@ virtual const char* what() const throw() { return message_.c_str(); } }; - class ResponseIsErrorException : public std::exception + class RxMsgIsErrorException : public std::exception { std::string message_; public: - ResponseIsErrorException(const char *message) + RxMsgIsErrorException(const char *message) : message_(message) {} - ResponseIsErrorException(const std::string &message) + RxMsgIsErrorException(const std::string &message) : message_(message) {} - ~ResponseIsErrorException()throw(){} + ~RxMsgIsErrorException()throw(){} virtual const char* what() const throw() { return message_.c_str(); } }; } @@ -141,13 +141,13 @@ initLaser(); break; } - catch ( const ResponseIsErrorException &e ) + catch ( const RxMsgIsErrorException &e ) { std::string errorLog = errorConditions(); stringstream ss; ss << e.what() << endl << "Laser error log: " << errorLog; if ( i == MAX_TRIES-1 ) - throw ResponseIsErrorException( ss.str() ); + throw RxMsgIsErrorException( ss.str() ); else tracer_.warning( tryString.str() + ss.str() ); } @@ -163,30 +163,30 @@ } bool -Driver::waitForResponseType( uChar type, TimedLmsResponse &response, int maxWaitMs ) +Driver::waitForRxMsgType( uChar type, TimedLmsRxMsg &rxMsg, int maxWaitMs ) { gbxiceutilacfr::Timer waitTimer; while ( true ) { - int ret = serialHandler_->getNextResponse( response, maxWaitMs ); + int ret = serialHandler_->getNextRxMsg( rxMsg, maxWaitMs ); if ( ret == 0 ) { - // got response - if ( response.response.type == type ) + // got rxMsg + if ( rxMsg.msg->type == type ) return true; - // Got a response, but not of the type we were expecting... + // Got a rxMsg, but not of the type we were expecting... // // In general, print out a warning message. // However, don't print out a warning if it's an ACK/NACK, because ACK/NACK don't // have checksums so they're likely to be found inside a failed-checksum message when a bit // gets flipped during transmission. - if ( response.response.type != ACK && - response.response.type != NACK ) + if ( rxMsg.msg->type != ACK && + rxMsg.msg->type != NACK ) { stringstream ss; - ss << "Driver::waitForResponseType(): While waiting for " << cmdToString(type) << ", received unexpected response: " << toString(response.response); + ss << "Driver::waitForRxMsgType(): While waiting for " << cmdToString(type) << ", received unexpected rxMsg: " << toString(*(rxMsg.msg)); tracer_.warning( ss.str() ); } @@ -218,21 +218,21 @@ while ( true ) { - TimedLmsResponse timedResponse; + TimedLmsRxMsg timedRxMsg; - int ret = serialHandler_->getNextResponse( timedResponse, maxWaitMs ); + int ret = serialHandler_->getNextRxMsg( timedRxMsg, maxWaitMs ); if ( ret == 0 ) { - // got timedResponse - if ( timedResponse.response.type == ACK || timedResponse.response.type == NACK ) + // got timedRxMsg + if ( timedRxMsg.msg->type == ACK || timedRxMsg.msg->type == NACK ) { - receivedAck = (timedResponse.response.type == ACK); + receivedAck = (timedRxMsg.msg->type == ACK); return true; } else { stringstream ss; - ss << "Driver::waitForAckOrNack(): Received unexpected response: " << toString(timedResponse.response); + ss << "Driver::waitForAckOrNack(): Received unexpected rxMsg: " << toString(*(timedRxMsg.msg)); tracer_.warning( ss.str() ); } @@ -250,34 +250,34 @@ else { stringstream ss; - ss << "Weird return code from serialHandler_->getNextResponse: " << ret; + ss << "Weird return code from serialHandler_->getNextRxMsg: " << ret; throw gbxutilacfr::Exception( ERROR_INFO, ss.str() ); } } } -LmsResponse +LmsRxMsgPtr Driver::askLaserForStatusData() { constructStatusRequest( commandAndData_ ); - TimedLmsResponse response = sendAndExpectResponse( commandAndData_ ); - return response.response; + TimedLmsRxMsg rxMsg = sendAndExpectRxMsg( commandAndData_ ); + return rxMsg.msg; } -LmsResponse +LmsRxMsgPtr Driver::askLaserForConfigData() { constructConfigurationRequest( commandAndData_ ); try { - TimedLmsResponse response = sendAndExpectResponse( commandAndData_ ); - return response.response; + TimedLmsRxMsg rxMsg = sendAndExpectRxMsg( commandAndData_ ); + return rxMsg.msg; } - catch ( NoResponseException &e ) + catch ( NoRxMsgException &e ) { stringstream ss; ss << "While trying to askLaserForConfigData(): " << e.what(); - throw NoResponseException( ss.str() ); + throw NoRxMsgException( ss.str() ); } } @@ -346,8 +346,8 @@ tracer_.debug( "Driver: Checking error conditions." ); constructRequestErrorMessage( commandAndData_ ); const bool ignoreErrorConditions = true; - TimedLmsResponse errorResponse = sendAndExpectResponse( commandAndData_, ignoreErrorConditions ); - return toString( errorResponse.response ); + TimedLmsRxMsg errorRxMsg = sendAndExpectRxMsg( commandAndData_, ignoreErrorConditions ); + return toString( *(errorRxMsg.msg) ); } catch ( std::exception &e ) { @@ -363,7 +363,7 @@ { // Tell the laser to switch constructRequestBaudRate( commandAndData_, baudRate ); - sendAndExpectResponse( commandAndData_ ); + sendAndExpectRxMsg( commandAndData_ ); // And switch myself serialHandler_->setBaudRate( config_.baudRate ); } @@ -395,7 +395,7 @@ askLaserForStatusData(); return baudRates[baudRateI]; } - catch ( const NoResponseException &e ) + catch ( const NoRxMsgException &e ) { stringstream ss; ss << "Driver::guessLaserBaudRate(): failed: " << e.what(); @@ -417,7 +417,7 @@ // tracer_.debug("Driver: Turning continuous mode off"); constructRequestMeasuredOnRequestMode( commandAndData_ ); - sendAndExpectResponse( commandAndData_ ); + sendAndExpectRxMsg( commandAndData_ ); // // Set Desired BaudRate @@ -442,24 +442,24 @@ // tracer_.debug("Driver: Checking operating data counters"); constructRequestOperatingDataCounter( commandAndData_ ); - TimedLmsResponse counterResponse = sendAndExpectResponse( commandAndData_ ); - ssInfo << "OperatingDataCounter: " << toString(counterResponse.response) << endl; + TimedLmsRxMsg counterRxMsg = sendAndExpectRxMsg( commandAndData_ ); + ssInfo << "OperatingDataCounter: " << toString(counterRxMsg.msg) << endl; // // Get status // tracer_.debug("Driver: Checking status"); - LmsResponse statusResponse = askLaserForStatusData(); - LmsStatusResponseData *statusResponseData = - dynamic_cast<LmsStatusResponseData*>(statusResponse.data); - assert( statusResponseData != NULL ); - ssInfo << "Status: " << statusResponseData->toString() << endl; + LmsRxMsgPtr statusRxMsg = askLaserForStatusData(); + LmsStatusRxMsgData *statusRxMsgData = + dynamic_cast<LmsStatusRxMsgData*>(statusRxMsg->data.get()); + assert( statusRxMsgData != NULL ); + ssInfo << "Status: " << statusRxMsgData->toString() << endl; - LmsResponse configResponse = askLaserForConfigData(); + LmsRxMsgPtr configRxMsg = askLaserForConfigData(); LmsConfigurationData *lmsConfig = - dynamic_cast<LmsConfigurationData*>(configResponse.data); + dynamic_cast<LmsConfigurationData*>(configRxMsg->data.get()); assert( lmsConfig != NULL ); - ssInfo << "Config: " << configResponse.data->toString() << endl; + ssInfo << "Config: " << configRxMsg->data->toString() << endl; tracer_.info( ssInfo.str() ); @@ -467,7 +467,7 @@ // Enter installation mode // constructRequestInstallationMode( commandAndData_ ); - sendAndExpectResponse( commandAndData_ ); + sendAndExpectRxMsg( commandAndData_ ); // // Configure the thing if we have to @@ -478,13 +478,13 @@ constructConfigurationCommand( desiredConfiguration(), commandAndData_ ); - TimedLmsResponse configCmdResponse = sendAndExpectResponse( commandAndData_ ); - LmsConfigurationResponseData *configCmdResponseData = - dynamic_cast<LmsConfigurationResponseData*>(configCmdResponse.response.data); - if ( !isAsDesired( configCmdResponseData->config ) ) + TimedLmsRxMsg configCmdRxMsg = sendAndExpectRxMsg( commandAndData_ ); + LmsConfigurationRxMsgData *configCmdRxMsgData = + dynamic_cast<LmsConfigurationRxMsgData*>(configCmdRxMsg.msg->data.get()); + if ( !isAsDesired( configCmdRxMsgData->config ) ) { stringstream ss; - ss << "Error configuring SICK: Config after configuration not what we expect. Asked for: " << desiredConfiguration().toString() << endl << "got: " << configCmdResponseData->toString(); + ss << "Error configuring SICK: Config after configuration not what we expect. Asked for: " << desiredConfiguration().toString() << endl << "got: " << configCmdRxMsgData->toString(); throw gbxutilacfr::Exception( ERROR_INFO, ss.str() ); } } @@ -496,15 +496,15 @@ constructSwitchVariant( desiredScanningAngle, desiredAngularResolution(), commandAndData_ ); - TimedLmsResponse angResponse = sendAndExpectResponse( commandAndData_ ); - LmsSwitchVariantResponseData *angResponseData = - dynamic_cast<LmsSwitchVariantResponseData*>(angResponse.response.data); - assert( angResponseData != NULL ); - if ( !( angResponseData->scanningAngle == desiredScanningAngle && - angResponseData->angularResolution == desiredAngularResolution() ) ) + TimedLmsRxMsg angRxMsg = sendAndExpectRxMsg( commandAndData_ ); + LmsSwitchVariantRxMsgData *angRxMsgData = + dynamic_cast<LmsSwitchVariantRxMsgData*>(angRxMsg.msg->data.get()); + assert( angRxMsgData != NULL ); + if ( !( angRxMsgData->scanningAngle == desiredScanningAngle && + angRxMsgData->angularResolution == desiredAngularResolution() ) ) { stringstream ss; - ss << "Error configuring SICK variant: Variant after configuration not what we expect: " << angResponseData->toString(); + ss << "Error configuring SICK variant: Variant after configuration not what we expect: " << angRxMsgData->toString(); throw gbxutilacfr::Exception( ERROR_INFO, ss.str() ); } @@ -512,13 +512,13 @@ // Start continuous mode // constructRequestContinuousMode( commandAndData_ ); - TimedLmsResponse contResponse = sendAndExpectResponse( commandAndData_ ); + TimedLmsRxMsg contRxMsg = sendAndExpectRxMsg( commandAndData_ ); tracer_.info( "Driver: enabled continuous mode, laser is running." ); } -TimedLmsResponse -Driver::sendAndExpectResponse( const std::vector<uChar> &commandAndData, bool ignoreErrorConditions ) +TimedLmsRxMsg +Driver::sendAndExpectRxMsg( const std::vector<uChar> &commandAndData, bool ignoreErrorConditions ) { constructTelegram( telegramBuffer_, commandAndData ); @@ -536,7 +536,7 @@ bool receivedAckOrNack = waitForAckOrNack( isAck ); if ( !receivedAckOrNack ) { - throw NoResponseException( "No ACK/NACK to command "+cmdToString(command) ); + throw NoRxMsgException( "No ACK/NACK to command "+cmdToString(command) ); } if ( !isAck ) { @@ -550,61 +550,61 @@ timeoutMs = 15000; } - TimedLmsResponse response; - bool received = waitForResponseType( ack(command), response, timeoutMs ); + TimedLmsRxMsg rxMsg; + bool received = waitForRxMsgType( ack(command), rxMsg, timeoutMs ); if ( !received ) { - throw NoResponseException( "No response to command "+cmdToString(command) ); + throw NoRxMsgException( "No rxMsg to command "+cmdToString(command) ); } - if ( !ignoreErrorConditions && response.response.isError() ) + if ( !ignoreErrorConditions && rxMsg.msg->isError() ) { - throw ResponseIsErrorException( "Response contains an error condition: "+toString(response.response) ); + throw RxMsgIsErrorException( "RxMsg contains an error condition: "+toString(rxMsg.msg) ); } - if ( response.response.isWarn() ) + if ( rxMsg.msg->isWarn() ) { stringstream ss; - tracer_.warning( "Response contains warning: "+toString(response.response) ); + tracer_.warning( "RxMsg contains warning: "+toString(rxMsg.msg) ); } - return response; + return rxMsg; } void Driver::read( Data &data ) { - TimedLmsResponse response; + TimedLmsRxMsg rxMsg; // This timeout is greater than the scan inter-arrival time for all baudrates. const int timeoutMs = 1000; - bool received = waitForResponseType( ACK_REQUEST_MEASURED_VALUES, response, timeoutMs ); + bool received = waitForRxMsgType( ACK_REQUEST_MEASURED_VALUES, rxMsg, timeoutMs ); if ( !received ) { throw gbxutilacfr::Exception( ERROR_INFO, "No scan received." ); } - LmsMeasurementData *measuredData = (LmsMeasurementData*)response.response.data; + LmsMeasurementData *measuredData = (LmsMeasurementData*)rxMsg.msg->data.get(); - if ( response.response.isError() ) + if ( rxMsg.msg->isError() ) { std::string errorLog = errorConditions(); stringstream ss; - ss << "Scan data indicates errors: " << toString(response.response) << endl << "Laser error log: " << errorLog; - throw ResponseIsErrorException( ss.str() ); + ss << "Scan data indicates errors: " << toString(rxMsg.msg) << endl << "Laser error log: " << errorLog; + throw RxMsgIsErrorException( ss.str() ); } - else if ( response.response.isWarn() ) + else if ( rxMsg.msg->isWarn() ) { data.haveWarnings = true; stringstream ss; - ss << "Scan data indicates warnings: " << toString(response.response); + ss << "Scan data indicates warnings: " << toString(rxMsg.msg); data.warnings = ss.str(); } memcpy( &(data.ranges[0]), &(meas... [truncated message content] |
From: <gb...@us...> - 2010-10-29 07:40:39
|
Revision: 524 http://gearbox.svn.sourceforge.net/gearbox/?rev=524&view=rev Author: gbiggs Date: 2010-10-29 07:40:33 +0000 (Fri, 29 Oct 2010) Log Message: ----------- Major improvements to data reading efficiency. Modified Paths: -------------- gearbox/trunk/doc/history.dox gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp gearbox/trunk/src/hokuyo_aist/sensor.cpp gearbox/trunk/src/hokuyo_aist/sensor.h Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2010-10-28 09:12:53 UTC (rev 523) +++ gearbox/trunk/doc/history.dox 2010-10-29 07:40:33 UTC (rev 524) @@ -55,6 +55,7 @@ - Added support for new SCIP 2.2 commands and multi-echo data. - Added algorithm to calibrate the laser's clock against system time, providing considerably more accurate time stamps in laser data. - Laser model detection and reporting. + - Significant improvements in data reading efficiency. CPU usage has been cut considerably. Reading a URG-04LX (10Hz refresh rate) has dropped from 2%-3% usage down to somewhere between 0% and 1%. Reading a UTM-30LX (40Hz refresh rate) has dropped from 13% down to 1%. Tests were on an Intel Q6600 with no system load. No statistically significant change in the time to read was observed. @par Retired libraries Modified: gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h 2010-10-28 09:12:53 UTC (rev 523) +++ gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h 2010-10-29 07:40:33 UTC (rev 524) @@ -25,5 +25,11 @@ #include "scan_data.h" #include "sensor.h" +// TODO: The line reading code is suffering from age. It is getting bloated and +// complicated, not to mention slow. Reading the range data has been switched +// to an improved method. The rest of the reads need to be moved to this new +// method. Not urgent as only the range data needs to be read really +// efficiently. + #endif // HOKUYO_AIST_H__ Modified: gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp =================================================================== --- gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp 2010-10-28 09:12:53 UTC (rev 523) +++ gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp 2010-10-29 07:40:33 UTC (rev 524) @@ -317,6 +317,7 @@ /* 35 */ "SCIP version 1 does not support the semi-reset command.", /* 36 */ "SCIP version 1 does not support the get ranges and intensities command.", /* 37 */ "Error configuring IP address.", +/* 38 */ "Did not receive a full line." }; return std::string(descriptions[code]); Modified: gearbox/trunk/src/hokuyo_aist/sensor.cpp =================================================================== --- gearbox/trunk/src/hokuyo_aist/sensor.cpp 2010-10-28 09:12:53 UTC (rev 523) +++ gearbox/trunk/src/hokuyo_aist/sensor.cpp 2010-10-29 07:40:33 UTC (rev 524) @@ -52,6 +52,8 @@ unsigned int const SCIP1_LINE_LENGTH = 66; // SCIP2: 67 bytes (64 bytes of data + checksum byte + line feed + 0) unsigned int const SCIP2_LINE_LENGTH = 67; +// Size of a full data block in range data +unsigned int const DATA_BLOCK_LENGTH = 64; /////////////////////////////////////////////////////////////////////////////// // SCIP protocol version 1 notes @@ -1389,7 +1391,10 @@ // not the 0 (although the buffer still has to include this). // If expected_length is -1, this function expects buffer to be a certain length // to allow up to the maximum line length to be read. See SCIP1_LINE_LENGTH and -// SCIP2_LINE_LENGTH. +// SCIP2_LINE_LENGTHr +// If fast is true, Read() will be called instead of ReadLine(), which should +// result in a faster, less CPU-intensive read. This is used, for example, when +// reading the range data. // The line feed that terminates a line will be replaced with a 0. // The return value is the number of bytes received, not including the 0 // byte or the line feed. @@ -1436,8 +1441,8 @@ { err_output_ << "Sensor::" << __func__ << "() Read " << linelength << " bytes.\n"; - err_output_ << "Sensor::" << __func__ << "() Line is " << buffer << - '\n'; + err_output_ << "Sensor::" << __func__ << "() Line is '" << buffer << + "'\n"; } return linelength - 1; // Line feed not included } @@ -1488,10 +1493,10 @@ if(bytesToConsider < 1) throw InsufficientBytesError(bytesToConsider, linelength); - int checkSum = 0; + int checksum = 0; try { - checkSum = confirm_checksum(buffer, bytesToConsider, + checksum = confirm_checksum(buffer, bytesToConsider, static_cast<int>(buffer[checksumIndex])); } catch(ProtocolError& e) @@ -1516,7 +1521,7 @@ linelength); } - checkSum = confirm_checksum(buffer, newBytesToConsider, + checksum = confirm_checksum(buffer, newBytesToConsider, static_cast<int>(buffer[checksumIndex])); } else @@ -1535,6 +1540,88 @@ } +// Data blocks are treated as a special case of lines. This allows us to easily +// implement a faster read with less condition checks, as the format is more +// uniform. +// Returns true if the read data block was not a full data block, and thus is +// the end of the data. +bool Sensor::read_data_block(char* buffer, int& block_size) +{ + bool is_last(false); + + if(verbose_) + { + err_output_ << "Sensor::" << __func__ << "() Reading exactly " << + DATA_BLOCK_LENGTH + 2 << " bytes.\n"; + } + // Read up to DATA_BLOCK_SIZE + 1 (checksum) + 1 (line feed) bytes, + // stopping as soon as a read puts a new line on the end + block_size = 0; + int read_goal = DATA_BLOCK_LENGTH + 2; + while (block_size < read_goal) + { + int bytes_read(0); + if((bytes_read = port_->Read(&buffer[block_size], + read_goal - block_size)) < 0) + { + throw ReadError(0); + } + else if(bytes_read == 0) + { + throw ReadError(1); + } + block_size += bytes_read; + if (buffer[block_size - 1] == '\n') + { + // New line = end of data line + break; + } + } + if(verbose_) + { + err_output_ << "Sensor::" << __func__ << "() Read " << block_size << + " bytes.\n"; + err_output_ << "Sensor::" << __func__ << "() Line is '" << buffer << + "'\n"; + } + // The data block should finish with one or two new lines. If it finishes + // with two, this is the last data block. + if (buffer[block_size - 1] != '\n') + { + throw ReadError(38); + } + buffer[block_size - 1] = '\0'; + block_size -= 1; // Remove the new line + if (buffer[block_size - 1] == '\n') + { + if (verbose_) + { + err_output_ << "Sensor::" << __func__ << "() Found last block.\n"; + } + is_last = true; + buffer[block_size - 1] = '\0'; + block_size -= 1; // So it doesn't get used in the checksum calculation + } + // Check the checksum, which is the last byte in the block. + int bytes_to_consider = block_size - 1; + if(verbose_) + { + err_output_ << "Sensor::" << __func__ << "() Considering " << + bytes_to_consider << " bytes for checksum from a line length of " << + block_size << " bytes.\n"; + } + if(bytes_to_consider < 1) + throw InsufficientBytesError(bytes_to_consider, block_size); + confirm_checksum(buffer, bytes_to_consider, + static_cast<int>(buffer[bytes_to_consider])); + // Nullify the checksum + buffer[bytes_to_consider] = '\0'; + block_size -= 1; + + return is_last; +} + + // Reads lines until the number specified has passed. void Sensor::skip_lines(int count) { @@ -2149,15 +2236,18 @@ // 2 byte data is easy since it fits neatly in a 64-byte block char buffer[SCIP2_LINE_LENGTH]; - unsigned int current_step = 0; - int numBytesInLine = 0; - while(true) + unsigned int current_step(0); + int numBytesInLine(0); + bool done(false); + while(!done) { // Read a line of data - numBytesInLine = read_line_with_check(buffer); + done = read_data_block(buffer, numBytesInLine); // Check if we've reached the end of the data if(numBytesInLine == 0) - break; + { + err_output_ << "numBytesInLine is zero!\n"; + } // Process pairs of bytes until we encounter the end of the line for (int ii = 0; ii < numBytesInLine; ii += 2, current_step++) { @@ -2202,36 +2292,20 @@ // 3 byte data is a pain because it crosses the line boundary, it may // overlap by 0, 1 or 2 bytes char buffer[SCIP2_LINE_LENGTH]; - unsigned int current_step = 0; - int numBytesInLine = 0, split_count = 0; + unsigned int current_step(0); + int numBytesInLine(0), split_count(0); char split_value[3]; int echo_buffer[3] = {-1, -1, -1}; - int echo_buf_ind = 0; - while(true) + int echo_buf_ind(0); + bool done(false); + while(!done) { // Read a line of data - numBytesInLine = read_line_with_check(buffer); + done = read_data_block(buffer, numBytesInLine); // Check if we've reached the end of the data if(numBytesInLine == 0) { - if(echo_buffer[0] != -1) - { - // Not the first value, so deal with the previous - data.write_range(current_step, - process_echo_buffer(echo_buffer, echo_buf_ind + 1)); - if(data.ranges_) - { - if(data.ranges_[current_step] > max_range_) - { - err_output_ << "WARNING: Sensor::" << __func__ << - "() Value at step " << current_step << - " beyond maximum range: " << - data.ranges_[current_step]; - } - } - current_step++; - } - break; + err_output_ << "numBytesInLine is zero!\n"; } // Process triplets of bytes until we encounter or overrun the end of // the line @@ -2265,7 +2339,7 @@ err_output_ << "WARNING: Sensor::" << __func__ << "() Value at step " << current_step << " beyond maximum range: " << - data.ranges_[current_step]; + data.ranges_[current_step] << '\n'; } } current_step++; @@ -2314,6 +2388,24 @@ } // End of this line. Go around again. } + // Last little bit of data + if(echo_buffer[0] != -1) + { + // Not the first value, so deal with the previous + data.write_range(current_step, + process_echo_buffer(echo_buffer, echo_buf_ind + 1)); + if(data.ranges_) + { + if(data.ranges_[current_step] > max_range_) + { + err_output_ << "WARNING: Sensor::" << __func__ << + "() Value at step " << current_step << + " beyond maximum range: " << + data.ranges_[current_step] << '\n'; + } + } + current_step++; + } if(verbose_) err_output_ << "Sensor::" << __func__ << "() Read " << @@ -2346,30 +2438,21 @@ // 3 byte data is a pain because it crosses the line boundary, it may // overlap by 0, 1 or 2 bytes char buffer[SCIP2_LINE_LENGTH]; - unsigned int current_range = 0, current_intensity = 0; - int numBytesInLine = 0, split_count = 0; + unsigned int current_range(0), current_intensity(0); + int numBytesInLine(0), split_count(0); char split_value[3]; - bool nextIsIntensity = false; + bool nextIsIntensity(false); int echo_buffer[3] = {-1, -1, -1}; - int echo_buf_ind = 0; - while(true) + int echo_buf_ind(0); + bool done(false); + while(!done) { // Read a line of data - numBytesInLine = read_line_with_check(buffer); + done = read_data_block(buffer, numBytesInLine); // Check if we've reached the end of the data if(numBytesInLine == 0) { - // The last piece should always be an intensity value (if it isn't - // then the data count won't add up and an error will be thrown - // below anyway). - if(echo_buffer[0] != -1) - { - assert(nextIsIntensity == true); - data.write_intensity(current_intensity, - process_echo_buffer(echo_buffer, echo_buf_ind + 1)); - current_intensity++; - } - break; + err_output_ << "numBytesInLine is zero!\n"; } // Process triplets of bytes until we encounter or overrun the end of // the line @@ -2474,6 +2557,16 @@ } // End of this line. Go around again. } + // The last piece should always be an intensity value (if it isn't + // then the data count won't add up and an error will be thrown + // below anyway). + if(echo_buffer[0] != -1) + { + assert(nextIsIntensity == true); + data.write_intensity(current_intensity, + process_echo_buffer(echo_buffer, echo_buf_ind + 1)); + current_intensity++; + } if(verbose_) { Modified: gearbox/trunk/src/hokuyo_aist/sensor.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/sensor.h 2010-10-28 09:12:53 UTC (rev 523) +++ gearbox/trunk/src/hokuyo_aist/sensor.h 2010-10-29 07:40:33 UTC (rev 524) @@ -514,9 +514,10 @@ float time_skew_alpha_; void clear_read_buffer(); - int read_line(char* buffer, int expected_length = -1); - int read_line_with_check(char* buffer, int expected_length = -1, - bool has_semicolon = false); + int read_line(char* buffer, int expected_length=-1); + int read_line_with_check(char* buffer, int expected_length=-1, + bool has_semicolon=false); + bool read_data_block(char* buffer, int& block_size); void skip_lines(int count); int send_command(char const* cmd, char const* param, int param_length, char const* extra_ok); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gb...@us...> - 2010-11-05 02:18:27
|
Revision: 525 http://gearbox.svn.sourceforge.net/gearbox/?rev=525&view=rev Author: gbiggs Date: 2010-11-05 02:18:21 +0000 (Fri, 05 Nov 2010) Log Message: ----------- Preparing for release 10.11 Modified Paths: -------------- gearbox/trunk/CMakeLists.txt gearbox/trunk/doc/history.dox gearbox/trunk/doc/index.dox Modified: gearbox/trunk/CMakeLists.txt =================================================================== --- gearbox/trunk/CMakeLists.txt 2010-10-29 07:40:33 UTC (rev 524) +++ gearbox/trunk/CMakeLists.txt 2010-11-05 02:18:21 UTC (rev 525) @@ -11,7 +11,7 @@ # # project version # -set( GBX_PROJECT_VERSION_MAJOR "9" ) +set( GBX_PROJECT_VERSION_MAJOR "10" ) set( GBX_PROJECT_VERSION_MINOR "11" ) set( GBX_PROJECT_VERSION_PATCH "+" ) Modified: gearbox/trunk/doc/history.dox =================================================================== --- gearbox/trunk/doc/history.dox 2010-10-29 07:40:33 UTC (rev 524) +++ gearbox/trunk/doc/history.dox 2010-11-05 02:18:21 UTC (rev 525) @@ -29,6 +29,16 @@ @par Project wide +@par New libraries + +@par Updated libraries + +@par Retired libraries + +@section gbx_doc_history_1011 Changes in Release 10.11 + +@par Project wide + - Build system - GBX_REQUIRE_LIB macro now uses a direct check for target existence. - new GBX_ADD_HEADER_ONLY_LIBRARY macro for handling dependencies on header-only libraries. @@ -53,9 +63,9 @@ - New, easier-to-use exceptions hierarchy. - Added support for new lasers to hokuyo_aist, including new UXM-30LX-E. - Added support for new SCIP 2.2 commands and multi-echo data. - - Added algorithm to calibrate the laser's clock against system time, providing considerably more accurate time stamps in laser data. + - Added algorithm to calibrate the laser's clock against system time (including communications delay), providing considerably more accurate time stamps in laser data. - Laser model detection and reporting. - - Significant improvements in data reading efficiency. CPU usage has been cut considerably. Reading a URG-04LX (10Hz refresh rate) has dropped from 2%-3% usage down to somewhere between 0% and 1%. Reading a UTM-30LX (40Hz refresh rate) has dropped from 13% down to 1%. Tests were on an Intel Q6600 with no system load. No statistically significant change in the time to read was observed. + - Significant improvements in data reading efficiency. CPU usage has been cut considerably. Reading a URG-04LX (10Hz refresh rate) has dropped from 2%-3% usage down to somewhere between 0% and 1%. Reading a UTM-30LX (40Hz refresh rate) has dropped from 13% down to 1%. Tests were on an Intel Q6600 with no system load. No statistically significant change in the time to read on an unloaded CPU was observed. @par Retired libraries Modified: gearbox/trunk/doc/index.dox =================================================================== --- gearbox/trunk/doc/index.dox 2010-10-29 07:40:33 UTC (rev 524) +++ gearbox/trunk/doc/index.dox 2010-11-05 02:18:21 UTC (rev 525) @@ -45,6 +45,7 @@ @section gbx_doc_index_news News +- 05-Nov-10 Release 10.11. Major revision of the hokuyo_aist library, with a new API and support for new laser scanners. (@ref gbx_doc_history_1011) - 18-Nov-09 Release 9.11. Several bug fixes in the libraries, build system cleanup to be packaged for Fedora. (@ref gbx_doc_history_911) - 10-Jul-09 Release 9.07. Several bug fixes in the libraries, and the new ability for the flexiport library's UDP port type to handle broadcast data. (@ref gbx_doc_history_907) - 18-Feb-09 Release 9.02. One new driver and a few updates in other libraries. (@ref gbx_doc_history_902) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gb...@us...> - 2011-06-10 01:04:21
|
Revision: 532 http://gearbox.svn.sourceforge.net/gearbox/?rev=532&view=rev Author: gbiggs Date: 2011-06-10 01:04:14 +0000 (Fri, 10 Jun 2011) Log Message: ----------- Fixed FindBoost usage Modified Paths: -------------- gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp gearbox/trunk/src/hokuyo_aist/hokuyo_errors.h gearbox/trunk/src/hokuyo_aist/python/CMakeLists.txt gearbox/trunk/src/hokuyo_aist/scan_data.h gearbox/trunk/src/hokuyo_aist/sensor.cpp gearbox/trunk/src/hokuyo_aist/sensor.h gearbox/trunk/src/hokuyo_aist/sensor_info.cpp gearbox/trunk/src/hokuyo_aist/sensor_info.h gearbox/trunk/src/hokuyo_aist/test/example.cpp gearbox/trunk/src/hokuyo_aist/utils.h gearbox/trunk/submitted/CMakeLists.txt Modified: gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/hokuyo_aist.h 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp =================================================================== --- gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/hokuyo_errors.cpp 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/src/hokuyo_aist/hokuyo_errors.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/hokuyo_errors.h 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/hokuyo_errors.h 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/src/hokuyo_aist/python/CMakeLists.txt =================================================================== --- gearbox/trunk/src/hokuyo_aist/python/CMakeLists.txt 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/python/CMakeLists.txt 2011-06-10 01:04:14 UTC (rev 532) @@ -17,9 +17,7 @@ LINK_DIRECTORIES (${Boost_LIBRARY_DIRS}) if(Boost_PYTHON_FOUND) - GET_FILENAME_COMPONENT (boostPythonLib ${Boost_PYTHON_LIBRARY} NAME_WE CACHE) - # Chop off the lib at the front, too, if present - STRING (REGEX REPLACE "^lib" "" boostPythonLib ${boostPythonLib}) + set(boostPythonLib ${Boost_PYTHON_LIBRARY}) else(Boost_PYTHON_FOUND) MESSAGE (STATUS "Boost::Python library was not found. Cannot build Python bindings for Hokuyo_aist.") Modified: gearbox/trunk/src/hokuyo_aist/scan_data.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/scan_data.h 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/scan_data.h 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/src/hokuyo_aist/sensor.cpp =================================================================== --- gearbox/trunk/src/hokuyo_aist/sensor.cpp 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/sensor.cpp 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * @@ -34,7 +34,6 @@ #include <cstdio> #include <cerrno> #include <cmath> -#include <unistd.h> #include <sstream> #include <iostream> #include <iomanip> @@ -42,7 +41,10 @@ #include <fstream> #if defined(WIN32) + #include <windows.h> // For Sleep() #define __func__ __FUNCTION__ +#else + #include <unistd.h> #endif namespace hokuyo_aist @@ -908,11 +910,16 @@ if(skew_sleep_time > 0) { // Sleep, then do it again to approximate a skew line + if(verbose_) + err_output_ << "Sleeping for " << skew_sleep_time << "s.\n"; +#if defined(WIN32) + DWORD sleep_time = skew_sleep_time * 1000; + Sleep(sleep_time); +#else struct timespec sleep_time = {0, 0}; sleep_time.tv_sec = skew_sleep_time; - if(verbose_) - err_output_ << "Sleeping for " << skew_sleep_time << "s.\n"; nanosleep(&sleep_time, NULL); +#endif if(verbose_) err_output_ << "Gathering " << samples << " offset values.\n"; @@ -1862,10 +1869,16 @@ clock_gettime(CLOCK_REALTIME, &ts); return ts.tv_sec * 1e9 + ts.tv_nsec; #else +#if defined(WIN32) + SYSTEMTIME sys_time; + GetSystemTime(&sys_time); + return sys_time.wSecond * 1e9 + sys_time.wMilliseconds * 1e3; +#else struct timeval tv; gettimeofday(&tv, 0); return tv.tv_sec * 1e9 + tv.tv_usec * 1e3; #endif +#endif } Modified: gearbox/trunk/src/hokuyo_aist/sensor.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/sensor.h 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/sensor.h 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/src/hokuyo_aist/sensor_info.cpp =================================================================== --- gearbox/trunk/src/hokuyo_aist/sensor_info.cpp 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/sensor_info.cpp 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/src/hokuyo_aist/sensor_info.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/sensor_info.h 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/sensor_info.h 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/src/hokuyo_aist/test/example.cpp =================================================================== --- gearbox/trunk/src/hokuyo_aist/test/example.cpp 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/test/example.cpp 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * @@ -35,7 +35,7 @@ bool get_intensities(false), get_new(false), verbose(false); #if defined(WIN32) - port_options = "type=serial,device=COM3,timeout=1"; + port_options = "type=serial,device=COM4,timeout=1"; #else int opt; // Get some options from the command line Modified: gearbox/trunk/src/hokuyo_aist/utils.h =================================================================== --- gearbox/trunk/src/hokuyo_aist/utils.h 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/src/hokuyo_aist/utils.h 2011-06-10 01:04:14 UTC (rev 532) @@ -9,7 +9,7 @@ * LICENSE file included in this distribution. * * This work is a product of the National Institute of Advanced Industrial - * Science and Technology, Japan. Registration number: H22PRO-1086. + * Science and Technology, Japan. Registration number: H22PRO-1195. * * This file is part of hokuyo_aist. * Modified: gearbox/trunk/submitted/CMakeLists.txt =================================================================== --- gearbox/trunk/submitted/CMakeLists.txt 2010-11-05 02:28:37 UTC (rev 531) +++ gearbox/trunk/submitted/CMakeLists.txt 2011-06-10 01:04:14 UTC (rev 532) @@ -1,6 +1,6 @@ # Libraries submitted for consideration for inclusion in Gearbox. -OPTION ( GBX_BUILD_SUBMITTED "Build submitted libraries" OFF ) +OPTION ( GBX_BUILD_SUBMITTED "Build submitted libraries" ON ) MARK_AS_ADVANCED ( FORCE GBX_BUILD_SUBMITTED ) if( GBX_BUILD_SUBMITTED ) @@ -10,5 +10,6 @@ # When adding new directories, please maintain order of inter-dependencies. # Otherwise, maintain alphabetical order. # E.g. add_subdirectory( mydir ) + add_subdirectory( ekfvloc ) endif( GBX_BUILD_SUBMITTED ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |