Skip to content

Commit

Permalink
Merge pull request #100 from schmiddey/ros2-humble-ns-fix
Browse files Browse the repository at this point in the history
changed to c++17 and added ns to diff_drive and laser plugin
  • Loading branch information
josephduchesne authored Nov 22, 2023
2 parents 4e2f6b0 + 5d0585f commit fc3f233
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion flatland_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down
8 changes: 4 additions & 4 deletions flatland_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ cmake_minimum_required(VERSION 3.5)
project(flatland_plugins)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
# if(NOT CMAKE_CXX_STANDARD)
# set(CMAKE_CXX_STANDARD 17)
# endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -std=c++17)
endif()


Expand Down
8 changes: 8 additions & 0 deletions flatland_plugins/src/diff_drive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ void DiffDrive::OnInitialize(const YAML::Node & config)
throw YAMLException("Body with name " + Q(body_name) + " does not exist");
}

//append namespace to topics
std::string ns = this->GetModel()->GetNameSpace();
twist_topic = ns + "/" + twist_topic;
odom_topic = ns + "/" + odom_topic;
ground_truth_topic = ns + "/" + ground_truth_topic;
twist_pub_topic = ns + "/" + twist_pub_topic;


// publish and subscribe to topics
using std::placeholders::_1;
twist_sub_ = node_->create_subscription<geometry_msgs::msg::Twist>(
Expand Down
4 changes: 4 additions & 0 deletions flatland_plugins/src/laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ void Laser::OnInitialize(const YAML::Node & config)
ParseParameters(config);

update_timer_.SetRate(update_rate_);

//add namespace
std::string ns = GetModel()->GetName();
topic_ = ns + "/" + topic_;
scan_publisher_ = node_->create_publisher<sensor_msgs::msg::LaserScan>(topic_, 1);

// construct the body to laser transformation matrix once since it never
Expand Down
8 changes: 4 additions & 4 deletions flatland_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ cmake_minimum_required(VERSION 3.5)
project(flatland_server)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
# if(NOT CMAKE_CXX_STANDARD)
# set(CMAKE_CXX_STANDARD 17)
# endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -std=c++17)
endif()

## Find macros and libraries
Expand Down
2 changes: 1 addition & 1 deletion flatland_viz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(flatland_viz)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down

0 comments on commit fc3f233

Please sign in to comment.