ai4ce / M3DP-Sim

https://ai4ce.github.io/M3DP-Sim
2 stars 4 forks source link

Ros Noetic Support #1

Open marios-stam opened 1 year ago

marios-stam commented 1 year ago

Hello, congrats for the very interesting work. I am trying to setup the simulation on ROS Noetic and Ubuntu 20.04. Do you know if it is possible and what steps should be changed in order to do that?

Thank you!

simbaforrest commented 1 year ago

@uljadberdica1000 @Rtlyc any thoughts?

marios-stam commented 1 year ago

I think I have installed everything successfully and I am able to move both the manipulator and turtle bot in Gazebo. But it is not clear to me how one can control the printing action of the manipulator. Is there a ROS Topic that signals the start of extrusion from the manipulator or something similar?

Could you help me with that, please?

marios-stam commented 1 year ago

I tried to build splishsplash by following the usual commands mkdir build cd build cmake .. make

and I get the following error:

In file included from /usr/include/ignition/math6/gz/math.hh:66,
                 from /usr/include/ignition/math6/ignition/math.hh:18,
                 from /usr/include/sdformat-9.8/sdf/Param.hh:33,
                 from /usr/include/sdformat-9.8/sdf/Element.hh:28,
                 from /usr/include/sdformat-9.8/sdf/Actor.hh:25,
                 from /usr/include/sdformat-9.8/sdf/sdf.hh:2,
                 from /home/marios/.local/include/gazebo-11/gazebo/common/Battery.hh:25,
                 from /home/marios/.local/include/gazebo-11/gazebo/common/common.hh:8,
                 from /home/marios/.local/include/gazebo-11/gazebo/gazebo_core.hh:19,
                 from /home/marios/.local/include/gazebo-11/gazebo/gazebo.hh:20,
                 from /home/marios/M3DP-Sim/splisplash/Simulator/GUI/GazeboFluidVisualizer/GazeboFluidVisualizer.h:8,
                 from /home/marios/M3DP-Sim/splisplash/Simulator/GUI/GazeboFluidVisualizer/GazeboFluidVisualizer.cpp:5:
/usr/include/ignition/math6/gz/math/Sphere.hh: At global scope:
/usr/include/ignition/math6/gz/math/Sphere.hh:109:20: error: ‘optional’ in namespace ‘std’ does not name a template type
  109 |       public: std::optional<Vector3<Precision>>
      |                    ^~~~~~~~
/usr/include/ignition/math6/gz/math/Sphere.hh:109:15: note: ‘std::optional’ is only available from C++17 onwards
  109 |       public: std::optional<Vector3<Precision>>
      |               ^~~

I tried to choose the c++17 standard through the CmakeLists.txt but I keep on getting the same error. The error appears even after I installed the gazebo version you are recommending from bitBucket

Please let me know if this is what should be done or not and if yes how can I solve this error?

Thank you!

simbaforrest commented 1 year ago

It's the final exam season so please give us some time. Hopefully @Rtlyc can look into this in early January.

uljad commented 1 year ago

This appears to be a splishsplash issue I have not encountered before. The error is in the legacy codebase. I would try using a different vector structure that does not require the optional template. Initializing the vector to bypass the need to use std::optional has worked for me before.

I will try to replicate the error later today and get back to you.

marios-stam commented 1 year ago

@simbaforrest I understand 100% and thank you for your help

marios-stam commented 1 year ago

@uljadberdica1000 I finally managed to force building through c++17 standard by changing this line set(CMAKE_CXX_FLAGS "-std=c++17") in the CmakeLists.txt and the previous error was fixed. Although now I get the following and I am not able to fix it yet.

- Build files have been written to: /home/marios/M3DP-Sim/splisplash/build/extern/PositionBasedDynamics/src/Ext_PBD-build
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp: In destructor ‘virtual Partio::ZipStreambufCompress::~ZipStreambufCompress()’:
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:359:23: error: ‘streampos’ is not a member of ‘std::ios’ {aka ‘std::basic_ios<char>’}
  359 |             std::ios::streampos final_position=ostream.tellp();
      |                       ^~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:364:27: error: ‘final_position’ was not declared in this scope
  364 |             ostream.seekp(final_position);}
      |                           ^~~~~~~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp: In destructor ‘virtual Partio::ZipFileWriter::~ZipFileWriter()’:
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:454:15: error: ‘streampos’ is not a member of ‘std::ios’ {aka ‘std::basic_ios<char>’}
  454 |     std::ios::streampos final_position=ostream.tellp();
      |               ^~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:456:15: error: ‘streampos’ is not a member of ‘std::ios’ {aka ‘std::basic_ios<char>’}
  456 |     std::ios::streampos central_end=ostream.tellp();
      |               ^~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:463:44: error: ‘central_end’ was not declared in this scope
  463 |     Write_Primitive(ostream,(unsigned int)(central_end-final_position)); // size of header
      |                                            ^~~~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:463:56: error: ‘final_position’ was not declared in this scope
  463 |     Write_Primitive(ostream,(unsigned int)(central_end-final_position)); // size of header
      |                                                        ^~~~~~~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp: In member function ‘bool Partio::ZipFileReader::Find_And_Read_Central_Header()’:
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:505:15: error: ‘streampos’ is not a member of ‘std::ios’ {aka ‘std::basic_ios<char>’}
  505 |     std::ios::streampos end_position=istream.tellg();
      |               ^~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:508:15: error: ‘streamoff’ is not a member of ‘std::ios’ {aka ‘std::basic_ios<char>’}
  508 |     std::ios::streamoff read_start=max_comment_size+read_size_before_comment;
      |               ^~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:509:8: error: ‘read_start’ was not declared in this scope
  509 |     if(read_start>end_position) read_start=end_position;
      |        ^~~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:509:19: error: ‘end_position’ was not declared in this scope
  509 |     if(read_start>end_position) read_start=end_position;
      |                   ^~~~~~~~~~~~
[ 35%] Performing build step for 'Ext_PBD'
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:510:19: error: ‘end_position’ was not declared in this scope
  510 |     istream.seekg(end_position-read_start);
      |                   ^~~~~~~~~~~~
/home/marios/M3DP-Sim/splisplash/extern/partio/src/lib/io/ZIP.cpp:510:32: error: ‘read_start’ was not declared in this scope
  510 |     istream.seekg(end_position-read_start);

To me, it seems that the problem lies in the fact that some libraries are written based on the c++17 standard and get errors while building for previous standards and vice versa. My expertise in c++ is not that strong so I would appreciate it if you could guide me on how to fix this issue if you do not have time at the moment. Your plugin is too good for me to stop trying to integrate it! 😁

marios-stam commented 1 year ago

I managed to fix all the issues and errors regarding the c++ 17 and ros noetic and got a successful build in a new branch here. Although now I am not sure how should I start a simple simulation but going to create a new issue for that.

uljad commented 1 year ago

Happy you could get it to work. I tried to replicate but was running into other irrelevant issues. I will reply to the other issue as soon as I can

ssungho98 commented 1 year ago

Hi Marios and Uljad! I would like to try the simulation in ROS noetic as well. If you don't mind, can I ask several questions personally to you guys? Please email me to sy2154@nyu.edu. Look forward to hearing from you!

simbaforrest commented 1 year ago

@Rtlyc can you meet with @ssungho98 to help him with his questions? Thank you!

marios-stam commented 1 year ago

Please include me in this meeting if possible. I did not manage to make it work finally

Rtlyc commented 1 year ago

Yes. I am in contact with @ssungho98. For the experiment setup, I think @ uljadberdica1000 has more experience and might be able to help.