Skip to content

Commit

Permalink
Fix missing constructor, cast type and add warnings (#56)
Browse files Browse the repository at this point in the history
* Added missing constructor in NavSatStatusData

* fixed static_cast type

* build with more warnings

---------

Co-authored-by: Arnau <[email protected]>
  • Loading branch information
arnauochoa and Arnau authored May 30, 2024
1 parent 733407f commit 6330863
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
3 changes: 2 additions & 1 deletion fixposition_driver_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.5)
project(fixposition_driver_lib VERSION 5.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic\
-Wshadow -Wunused-parameter -Wformat -Wpointer-arith")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct NavSatStatusData {
};
int8_t status;
uint16_t service;
NavSatStatusData() : status(static_cast<int8_t>(Status::STATUS_NO_FIX)), service(0) {}
};

struct NavSatFixData {
Expand Down
6 changes: 3 additions & 3 deletions fixposition_driver_lib/src/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ void BestGnssPosToNavSatFix(const Oem7MessageHeaderMem* const header, const BEST

switch (static_cast<PositionOrVelocityType>(bestgnsspos->pos_type)) {
case PositionOrVelocityType::NARROW_INT:
navsatfix.status.status = static_cast<uint8_t>(NavSatStatusData::Status::STATUS_GBAS_FIX);
navsatfix.status.status = static_cast<int8_t>(NavSatStatusData::Status::STATUS_GBAS_FIX);
break;
case PositionOrVelocityType::NARROW_FLOAT:
case PositionOrVelocityType::SINGLE:
navsatfix.status.status = static_cast<uint8_t>(NavSatStatusData::Status::STATUS_FIX);
navsatfix.status.status = static_cast<int8_t>(NavSatStatusData::Status::STATUS_FIX);
break;
default:
navsatfix.status.status = static_cast<uint8_t>(NavSatStatusData::Status::STATUS_NO_FIX);
navsatfix.status.status = static_cast<int8_t>(NavSatStatusData::Status::STATUS_NO_FIX);
}

// TODO hardcoded for now for all 4 systems
Expand Down
3 changes: 2 additions & 1 deletion fixposition_driver_ros1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.5)
project(fixposition_driver_ros1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic\
-Wshadow -Wunused-parameter -Wformat -Wpointer-arith")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
3 changes: 2 additions & 1 deletion fixposition_driver_ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.5)
project(fixposition_driver_ros2)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic\
-Wshadow -Wunused-parameter -Wformat -Wpointer-arith")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
3 changes: 2 additions & 1 deletion fixposition_odometry_converter_ros1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.5)
project(fixposition_odometry_converter_ros1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic\
-Wshadow -Wunused-parameter -Wformat -Wpointer-arith")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
7 changes: 4 additions & 3 deletions fixposition_odometry_converter_ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 3.10.2)
project(fixposition_odometry_converter_ros2)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always -Wall -Wextra -Wpedantic -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic\
-Wshadow -Wunused-parameter -Wformat -Wpointer-arith")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand All @@ -27,7 +28,7 @@ include_directories(
)

# BUILD EXECUTABLE =====================================================================================================
add_library(odom_converter SHARED
add_library(odom_converter SHARED
src/params.cpp
src/odom_converter_node.cpp)
ament_target_dependencies(odom_converter ${PACKAGE_INCLUDE_DEPENDS})
Expand All @@ -49,4 +50,4 @@ install(DIRECTORY include
DESTINATION .
)

ament_package()
ament_package()

0 comments on commit 6330863

Please sign in to comment.