byu-magicc / magicc_sim

Extra ROSflight simulation plugins and agents used in the lab
1 stars 3 forks source link

Support for ROS Noetic and Gazebo 11? #7

Open guriandoro opened 2 years ago

guriandoro commented 2 years ago

Hi!

I'm wondering if there is anything in place for this project to work on ROS Noetic and Gazebo 11?

I've tried catkin_make with the master branch and also with work on PR #5, but I'm still getting errors:

...
[ 40%] Building CXX object magicc_sim/magicc_sim_plugins/CMakeFiles/magicc_sim_camera_utils.dir/src/gazebo_ros_camera_utils.cpp.o
In file included from /usr/include/ignition/math6/ignition/math/Quaternion.hh:20,
                 from /usr/include/ignition/math6/ignition/math/Pose3.hh:20,
                 from /usr/include/sdformat-9.7/sdf/Actor.hh:23,
                 from /usr/include/sdformat-9.7/sdf/sdf.hh:2,
                 from /usr/include/gazebo-11/gazebo/common/Plugin.hh:33,
                 from /home/agustin/catkin_ws_magicc/src/magicc_sim/magicc_sim_plugins/src/step_camera.cpp:1:
/usr/include/ignition/math6/ignition/math/Helpers.hh:40:13: warning: variable templates only available with ‘-std=c++14’ or ‘-std=gnu++14’
   40 | constexpr T IGN_MASSMATRIX3_DEFAULT_TOLERANCE = T(10);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ignition/math6/ignition/math/Helpers.hh: In function ‘std::chrono::_V2::steady_clock::duration ignition::math::v6::stringToDuration(const string&)’:
/usr/include/ignition/math6/ignition/math/Helpers.hh:990:28: error: ‘chrono_literals’ is not a namespace-name
  990 |       using namespace std::chrono_literals;
      |                            ^~~~~~~~~~~~~~~

...

[ 70%] Built target magicc_sim_camera_utils
make: *** [Makefile:141: all] Error 2
Invoking "make -j8 -l8" failed

Do you know what else I can try? Let me know if you need any other outputs.

Thanks!

guriandoro commented 2 years ago

Hi again :)

I've been able to fix these issues. The patch is:

agustin@scf:~/catkin_ws_uncc/src/magicc_sim$ git diff
diff --git a/magicc_sim/CMakeLists.txt b/magicc_sim/CMakeLists.txt
index e56972c..86515b2 100644
--- a/magicc_sim/CMakeLists.txt
+++ b/magicc_sim/CMakeLists.txt
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8.3)
 project(magicc_sim)

 add_definitions(-std=c++11)
+add_compile_options(-std=c++17)

 find_package(catkin
   REQUIRED COMPONENTS
diff --git a/magicc_sim_plugins/CMakeLists.txt b/magicc_sim_plugins/CMakeLists.txt
index 11ec32f..4a91df4 100644
--- a/magicc_sim_plugins/CMakeLists.txt
+++ b/magicc_sim_plugins/CMakeLists.txt
@@ -1,9 +1,12 @@
 cmake_minimum_required(VERSION 2.8.3)
 project(magicc_sim_plugins)

+add_compile_options(-std=c++17)
+
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")

+
 # To enable assertions when compiled in release mode.
 add_definitions(-DROS_ASSERT_ENABLED)

diff --git a/magicc_sim_plugins/src/step_camera.cpp b/magicc_sim_plugins/src/step_camera.cpp
index 8de80e1..79a3b0a 100644
--- a/magicc_sim_plugins/src/step_camera.cpp
+++ b/magicc_sim_plugins/src/step_camera.cpp
@@ -84,7 +84,7 @@ void StepCamera::OnUpdateParentSensor(){
 void StepCamera::OnUpdate(const common::UpdateInfo&){
    if(this->parentSensor->IsActive() && (GZ_COMPAT_GET_SIM_TIME(this->world_) - this->last_update_time_) >= (this->_updateRate) ){
      // If we should have published a message, try and get a lock to wait for onUpdateParentSensor
-     if(!this->_updateLock.timed_lock(boost::posix_time::seconds(this->_updateRate))){
+     if(!this->_updateLock.timed_lock(boost::posix_time::seconds(int(this->_updateRate)))){
          ROS_FATAL_STREAM("Update loop timed out waiting for the renderer.");
      }
    }

Let me know if you are interested, and I can send a proper PR with the changes in place.

It's now compiling for me on the aforementioned versions.

Best