Giter VIP home page Giter VIP logo

stonefish's Introduction

Stonefish logo

Stonefish

An advanced simulation tool developed for marine robotics.

Stonefish is a C++ library combining a physics engine and a lightweight rendering pipeline. The physics engine is based on the core functionality of the Bullet Physics library, extended to deliver realistic simulation of marine robots. It is directed towards researchers in the field of marine robotics but can as well be used as a general purpose robot simulator.

Stonefish includes advanced hydrodynamic computations based on actual geometry of bodies, to better approximate hydrodynamic forces and allow for effects not possible when using symbolic models. The rendering pipeline, developed from the ground up, delivers realistic rendering of atmosphere, ocean and underwater environment. Special focus was put on the latter, where effects of wavelength-dependent light absorption and scattering were considered (other simulators often use only blue fog).

Stonefish can be used to create standalone applications or combined with a Robot Operating System (ROS) package stonefish_ros, which implements standard simulator node and facilitates easy integration with ROS architecture.

There are two sources of documentation for the library: html documentation generated with Sphinx and code documentation generated with Doxygen, based on comments in the code (instructions below).

Requirements

The simulation is CPU heavy and requires a recent GPU. The minimum requirement is the support for OpenGL 4.3.

Install official manufacturer drivers for your graphics card before using Stonefish!

The software is developed and tested on Linux Ubuntu. It should work on any Unix based platform. A version for Windows is not available at this time. MacOS is not supported due to its lack of support for OpenGL 4.3.

Installation

  1. Dependencies

    • OpenGL Mathematics library (libglm-dev, version >= 0.9.9.0)
    • SDL2 library (libsdl2-dev, may need the following fix!)
      1. Install SDL2 library from the repository.
      2. cd /usr/lib/x86_64-linux-gnu/cmake/SDL2/
      3. sudo vim sdl2-config.cmake
      4. Remove space after "-lSDL2".
      5. Save file.
    • Freetype library (libfreetype6-dev)
  2. Building

    1. Clone stonefish repository.
    2. cd stonefish
    3. mkdir build
    4. cd build
    5. cmake ..
    6. make -jX (where X is the number of threads)
    7. sudo make install
  3. Documentation

    1. Go to "stonefish" directory.
    2. doxygen doxygen
    3. Open "docs/html/index.html".

Credits

This software was written and is continuously developed by Patryk Cieślak. Parts of the software based on code developed by other authors are clearly marked as such.

If you find this software useful in your research, please cite:

Patryk Cieślak, "Stonefish: An Advanced Open-Source Simulation Tool Designed for Marine Robotics, With a ROS Interface", In Proceedings of MTS/IEEE OCEANS 2019, June 2019, Marseille, France

@inproceedings{stonefish,
   author = {Cie{\'s}lak, Patryk},
   booktitle = {OCEANS 2019 - Marseille},
   title = {{Stonefish: An Advanced Open-Source Simulation Tool Designed for Marine Robotics, With a ROS Interface}},
   month = jun,
   year = {2019},
   doi={10.1109/OCEANSE.2019.8867434}}

Support

I offer paid support on setting up the simulation of your own systems, including necessary 3D modelling (simplification of CAD models for physics, preparation of accurate visualisations, etc.), setup of simulation scenarios, development of new sensors, actuators, and custom features that do not require significant changes to the code base. Please contact me at [email protected].

Funding

Currently there is no funding of this work. It is developed by the author following his needs and requests from other users. The work was started during his PhD studies and was mainly developed in his free time. Parts of this work were developed in the context of the project titled ”Force/position control system to enable compliant manipulation from a floating I-AUV”, which received funding from the European Community H2020 Programme, under the Marie Sklodowska-Curie grant agreement no. 750063. The work was also extended under a project titled ”EU Marine Robots”, which received funding from the European Community H2020 Programme, grant agreement no. 731103.

License

This is free software, published under the General Public License v3.0.

stonefish's People

Contributors

dependabot[bot] avatar iquarobotics avatar nilsbore avatar patrykcieslak avatar rogerpi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

stonefish's Issues

Rudders

Is your feature request related to a problem? Please describe.
I am not sure if this is a bug or a feature.

I am trying to get rudders working in our stonefish simulation.
I remember you suggesting to simply add a link with a rudder mesh model
and attach it to a revolute joint that can be used to control the rudder angle.
I tried that but I have some problems getting the simulation to be stable with
that kind of actuator. What typically happens either directly when you start
up the simulation or when you start to control the rudder is that the vehicle
"flies" away. It seems that somehow too big a force is applied
by the joint controller.

I have tried various combinations of rudder mass, max_torque, position_gain and velocity_gain.
Do you have any ideas of combinations that you think should be more stable
(although maybe not physically realistic)?

Describe the solution you'd like
The rudder joint turning to the setpoint, without the vehicle flying away :).

Describe alternatives you've considered
Implement a dedicated rudder actuator.

Thank you!
Nils

Building fails with compilation error on AcousticModem.cpp

[ 4%] Building CXX object CMakeFiles/Stonefish.dir/Library/src/comms/AcousticModem.cpp.o /mnt/c/Users/asafe/BoatSpeed/stonefish/Library/src/comms/AcousticModem.cpp: In static member function ‘static sf::AcousticModem* sf::AcousticModem::getNode(uint64_t)’: /mnt/c/Users/asafe/BoatSpeed/stonefish/Library/src/comms/AcousticModem.cpp:72:34: error: expected unqualified-id before ‘&’ token 72 | catch(const std::out_of_range& oor) | ^ /mnt/c/Users/asafe/BoatSpeed/stonefish/Library/src/comms/AcousticModem.cpp:72:34: error: expected ‘)’ before ‘&’ token 72 | catch(const std::out_of_range& oor) | ~ ^ | ) /mnt/c/Users/asafe/BoatSpeed/stonefish/Library/src/comms/AcousticModem.cpp:72:34: error: expected ‘{’ before ‘&’ token /mnt/c/Users/asafe/BoatSpeed/stonefish/Library/src/comms/AcousticModem.cpp:72:36: error: ‘oor’ was not declared in this scope 72 | catch(const std::out_of_range& oor) | ^~~ make[2]: *** [CMakeFiles/Stonefish.dir/build.make:230: CMakeFiles/Stonefish.dir/Library/src/comms/AcousticModem.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/Stonefish.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

IMU measurements with gravity effect

Hi!

Thank you for your fantastic work! I'm using Stonefish for some state estimation projects and would like to fuse IMU information with the velocity from a DVL.

I noticed the IMU message does not include the gravity effect. (When the robot is static on the surface, the IMU should read [0,0,9.81] from the buoyancy force.) I'm wondering if gravity can be added to the simulation to better reflect real-world use cases. In an ideal scenario, the acceleration readings from an IMU can be modeled as $R^I_w*(-g) + a$, where $R^I_W$ is the ground truth rotation matrix that maps from the world frame (z up, gravity down) to the imu frame, and $g$ is the gravity vector $(0,0,-9.81)^T$.

Thanks again for this awesome project!

btTransform basis and origin use different coordinate systems?

I built a very simple example using the girona500 model, it is included in the scenario as follows:

  <include file="girona500auv_console.scn">
    <arg name="robot_name" value="GIRONA500"/>
    <arg name="robot_position" value="5.0 3.0 10.0"/>
  </include>

At the start of the simulation I am calling getRobot on the simulation then getTransform on the robot to get a btTransform object back. I am confused about the content of the transform; the origin shows something close to x=5, y=3, z=10 as I would expect based on my definition, however the basis I am getting something closer to:

[0.0, -1.0, 0.0]
[0.0, 0.0, -1.0]
[1.0, 0.0, 0.0]

I would expect with rpy set to all zeros to get something close to identity for the basis, however the basis appears to be the bullet physics coordinate system within an NED world frame. Why is the origin in NED, but the basis is in the bullet physics frame (Y up, Z forward, X left)? Or are they both in bullet coordinates and I am misinterpreting the config file?

If this is what is expected for a btTransform I can just transform the basis to NED and leave the origin as is, but wanted to check if I am interpreting this correctly. Thank you!

How to load Apriltags into the simulation?

Hi, I want to use Apriltags in the simulation but are not sure what are some ways for loading them in? I have tried loading a static object with a custom looks using the Apriltag image as a texture. The Apriltag is loaded but are repeated over the entire surface.

Thruster model error?

Describe the bug
I'm experiencing a very odd behaviour with the thruster models. Regardless of rpm value 0 - 1000, the vehicle moves with approximately the same velocity. When changing the thruster coefficient, the velocity changes but the same behaviour with a constant speed, regardless of rpm value, is still there.

I'm running the simulator within the SMaRC ROS framework:
https://github.com/smarc-project

I have tried to vary coefficients and max rpm settings but it does not change this behaviour.

Any thoughts on what this could be related to?

Failed to Compile Shaders

Describe the bug
I'm Getting a "Failed to Compile Shaders Error" when I run open the simulation in any water based environment. The simulation runs but I'm experiencing weird rendering errors with the water surface.

Screenshots

Screenshot from 2024-07-29 11-34-01
Screenshot from 2024-07-29 11-34-17
Screenshot from 2024-07-29 11-34-26
Screenshot from 2024-07-29 11-34-45

To Recreate

./FluidDynamicsTest &> fluid_test_out.txt

fluid_test_out.txt

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • OpenGL Version: 4.6 (Compatibility Profile)
  • Graphics Card: AMD Radeon rx 5700 xt
  • CPU: AMD Ryzen 7 3700x 8-core processor × 16

Add arg tag for include in `scn` files

Is your feature request related to a problem? Please describe.
We would like to be able to include multiple robots of the same type from an scn file, something like this:

<scenario>

    <include file="$(find sam_stonefish_sim)/data/biograd_world/biograd_env.scn"/>
    <include file="$(find sam_stonefish_sim)/data/sam_auv/sam_auv.xml">
       <arg name="robot_name" value="sam1"/>
    </include>
    <include file="$(find sam_stonefish_sim)/data/sam_auv/sam_auv.xml">
       <arg name="robot_name" value="sam2"/>
    </include>

</scenario>

Describe the solution you'd like
We would add an arg tag like above that would be necessary when including a file that has a line like this at the top:
<arg name="robot_name"/>
There would probably be NO default value like in ROS launch files, just to keep things simple. This means you always have to provide arg when including.

Describe alternatives you've considered
The alternative in this case is to make several copies of our robot scn file with different robot names. That seems like a worse solution.

Additional context
Add any other context or screenshots about the feature request here.

Compiling on MacOSX

Builds great in Ubuntu 20.04 (work remotes), however my laptop runs Mac OSX Catalina. Reckoned I'd post this small bug fix for others that might hit this same problem.

Describe the bug
Following Unix install instructions, there path errors within MacOSX SDL2 and glm libraries.

Solution

  1. Install both SDL2 and glm using brew install <package>.
  2. Use brew info to determine install paths.
  3. Make a symbolic link within Library/include.

For example, my build succeeded with the following two linkages:

  • ln -s /usr/local/Cellar/glm/0.9.9.8/include/glm ../Library/include/glm
  • ln -s /usr/local/Cellar/sdl2/2.0.12_1/include/SDL2 ../Library/include/SDL2

If you're using Windows...may Heaven have mercy on your poor masochistic soul.

Try get the full images of ColorCamera and FLS

Is your feature request related to a problem?
Hi! I can't correctly export ColorCamera and FLS images for use in an external dependency (LCM). I don't really know the 'correct' way of getting the image, and it would be awesome if you could help me with that.

Describe the solution you'd like
I would love an easy way of getting the full images correctly, of the ColorCamera and FLS so I can later use them in any way I see fit.

Describe alternatives you've considered
I've considered using the function getImagDataPointer() of both sensors, like this:

    //ColorCamera
    uint8_t* image = (uint8_t*)camera-> getImageDataPointer();
    unsigned int res_x, res_y;
    camera-> getResolution(res_x, res_y);
    //FLS
    auto im = (float*) fls-> getImageDataPointer();
    unsigned int nRanges, nBeams;
    fls-> getResolution(nBeams, nRanges);
    glm::vec2 range = fls-> getRangeLimits();

I believe this is not the correct way, because later I'm having some segmentation faults related to that. I believe that in retrieving the image I'm stepping on forbidden memory space, but I'm not really sure. It would be awesome if you can point me in the right direction.

Include .scn file from another .scn file

Is your feature request related to a problem? Please describe.
I would like to be able to include .scn files from other .scn files. For example, this would allow defining the worlds and vehicles in different scn files, which can then be combined into a complete scenario file.

Describe the solution you'd like
Add a way of including .scn files in other .scn files by specifying paths to the other file.
E.g. in one scn file: <include file="data/robot/girona500.scn"/>.

Describe alternatives you've considered
Keeping it as it is, always copying robot definitions between files. I think this is suboptimal.

Simulation Reset

Is your feature request related to a problem? Please describe.
More of a question than a request. I'm doing reinforcement learning which requires episodic trajectory rollouts. It would be convenient if there were a way to reset the state of the robot inside the sim and not have to restart the app everytime a new episode rollout is required or drive the robot back to it's starting location and pose. Is there anyway to reset the robot state which would include being able to reset for example x, y, z, vx, vy, vz, roll angle, pitch angle, yaw angle, omega, accel, etc.?

I guess it would look like teleportation in the sim haha!

Describe the solution you'd like
State reset as a function call, perhaps.

Problem with Thrusters while building Test Directory

Describe the bug
I'm trying out stonefish for the first time but when I try to build the test directory I keep running into an error involving "no matching call to Thruster".

To Reproduce

mkdir build
cd build
cmake -DBUILD_TESTS=ON ..
make -j8 >& make_out.txt

make_out.txt

Desktop:

  • OS: Ubuntu 22.0.4 LTS

I'm new to the stonefish library so I'm not sure whether I misunderstood the build instructions or my environment is broken. Some help would be appreciated. Thanks in advance!

Drag computation for compound hull

On line 324 of Compound.cpp, it states that drag is computed for externally declared parts that are submerged. That makes sense. However, does the app compute drag for the hull, for example, in the following declaration of the compound vehicle hull since it's not explicitly labeled as 'external'?

//Build whole body
sf::Compound* vehicle = new sf::Compound("Vehicle", phy, hullB, sf::I4());

range and intensity data for Mechanical scanning imaging sonar (MSIS)

Is your feature request related to a problem? Please describe.
This is not related to a problem.

Describe the solution you'd like
MSIS sensor publishes another data format such as sensor_msgs/LaserScan

Additional context
Thanks for sharing this awesome project. We are trying to get range and intensity from the MSIS sensor. I checked the source file generated sonar image such as the OpenGLMSIS.cpp , but this seems strongly related to OpenGL, which I am not familiar with.

Could you give some suggestions to get raw range and intensity data from the MSIS sonar? Maye some tips to extract data from the OpenGL buffer, or maybe post-process the sonar image to get the data we want.

Thank you so much !!

Help with running examples

So, my current master thesis requires that I learn all about hydrodynamics in robotic manipulators, design a controller then perform simulation. I came across this incredible work, but I don't understand how to run the provided examples.

I installed stonefish on a Linux system and compiled the examples using (cmake and make commands). but after that i don't know how to run them. I just need a little push, then I will learn everything else on my own.

I tried webots and coppleasim as well as UUV with gazebo but stonefish seems like next level, so I want to work on my manipulator on it.

UnderwaterTest does not run. Get a dbus error message

Describe the bug
UnderwaterTest does not run. Get a dbus error message.

To Reproduce
sudo apt-get install libglm-dev
sudo apt-get install libsdl2-dev
sudo apt-get install libfreetype6-dev
git clone "https://github.com/patrykcieslak/stonefish.git"
cd stonefish
mkdir build
cd build
cmake -DBUILD_TESTS=ON ..
make -j4
cd Tests
./UnderwaterTest

Expected behavior
The underwater test app should launch and run.

What actually happens
[INFO] Welcome to Stonefish 1.3.
dbus[14735]: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file ../../../dbus/dbus-message.c line 1362.
This is normally a bug in some application using the D-Bus library.

D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)

My system

  • OS: Ubuntu 18.04
  • Device:Nvidia Xavier NX running Jetpack 4.6

Is there a way to add the sensor suite from Gazebo to Stonefish?

It appears to be the case that there is a limited suite of sensors in Stonefish. It would be nice to have a way to simply plug and play those sensors found in the Gazebo simulator in this simulated engine also.

Those Gazebo sensors work like plugins to the URDF file. They go about with a tag and an .so file whereas the ones in stonefish are enabled via a tag and type parameter. If there could exist a bridge between the two, the amount of sensors one can use in Stonefish increases.

about Current function

I have experienced and am grateful for many things through your simulation.

While using the simulation, I had a question. There is a function that allows you to add water velocity to the environment, so I added water velocity to the ocean tag in the scenario file environment, but this does not seem to work. I need help with this part.
Thank you.
testcurrent

Simulated side scan sonar looks unexpected

Describe the bug
When trying to simulate side scan sonar image using stonefish according to the documentation, the resulting simulated sensor output appears to be somewhat erroneous.

Specifically, it looks like that the port and starboard channels are exact complements of one another. The below SSS screenshot was taken when a simulated robot travels above a flat seafloor with constant velocity.

Screenshots

Screenshot from 2021-03-29 17-01-50

failed run special functionality magnetic

Hello, I would like to contact you because I have a question while using the simulator. During the 1.4 update, I tried to use the magnetic materials function in the special functionality, but when I added magnet to two materials and ran it, it didn't look like there was magnetism. Is there any additional work required to use this feature?

Thank you

Build error in Ubuntu 24.04

Describe the bug
uint64_t type didn't found during compile.
The problem is in the Sample.h file.

To Reproduce
Steps to reproduce the behavior:

  1. Have ubuntu 24.04 and follow the installation instruction from the readme.
  2. compiling error will pop-up when make the stonefish.

fix
Adding #include <cstdint> in /stonefish/Library/include/sensors/Sample.h will solve the problem.

Actuators behaving weirdly when near the surface

Describe the bug
Hi! First of all thank you for your amazing library! I work for an underwater robotics laboratory in Chile, and we have benefited a lot from the possibility of accurately modeling our robots!
We've seen one problem, though: whenever the robot goes to the surface, it starts spinning endlessly. Checking the actuators in the Debug menu, I see that no force is being done by the actuators until it reaches the surface, and then it starts in full, even though no new commands are being sent. If I try with a simpler model (just a box with 6 thrusters), the problem doesn't appear.

To Reproduce
The model of the ROV is quite complex, but this is how we are creating it:

//Create ROVerto body
//Main Frame
sf::Polyhedron* profileO = new sf::Polyhedron("ProfileOrigin", path_data + "/bperfil_59,5_ORIGIN_.stl", 1, sf::I4(), "ProfileMat", sf::BodyPhysicsType::SUBMERGED, "metal_gray");
profileO->ScalePhysicalPropertiesToArbitraryMass(1.364);
sf::Polyhedron* profile53 = new sf::Polyhedron("ProfileHorizontalLateral", path_data + "/bperfil_53_.stl", 1, sf::I4(), "ProfileMat", sf::BodyPhysicsType::SUBMERGED, "metal_gray");
profile53->ScalePhysicalPropertiesToArbitraryMass(1.763);
sf::Polyhedron* profile11 = new sf::Polyhedron("ProfileVerticalFeet", path_data + "/bperfil_11,0_.stl", 1, sf::I4(), "ProfileMat", sf::BodyPhysicsType::SUBMERGED, "metal_gray");
profile11->ScalePhysicalPropertiesToArbitraryMass(.366);
sf::Polyhedron* profile41 = new sf::Polyhedron("ProfileHorizontalInner", path_data + "/bperfil_59,5_ORIGIN_.stl", 1, sf::I4(), "ProfileMat", sf::BodyPhysicsType::SUBMERGED, "metal_gray");
profile41->ScalePhysicalPropertiesToArbitraryMass(1.364);
sf::Polyhedron* sheet_acr = new sf::Polyhedron("Sheet", path_data + "/bsoporte_lateral_.stl", 1, sf::I4(), "AcrMat", sf::BodyPhysicsType::SUBMERGED, "polim_white");
sheet_acr->ScalePhysicalPropertiesToArbitraryMass(1.11);
sf::Polyhedron* top_acr = new sf::Polyhedron("TopAcrylic", path_data + "/bsoporte_acr_.stl", 1, sf::I4(), "AcrMat", sf::BodyPhysicsType::SUBMERGED, "polim_white");
top_acr->ScalePhysicalPropertiesToArbitraryMass(.142);
sf::Polyhedron* foam_feet = new sf::Polyhedron("FoamFeet", path_data + "/bespuma_pata_.stl", 1, sf::I4(), "FoamMat", sf::BodyPhysicsType::SUBMERGED, "yellow");
foam_feet->ScalePhysicalPropertiesToArbitraryMass(.01);
// sf::Cylinder* cylinder = new sf::Cylinder("cylinder", .3, .1, sf::I4(), "BoxMat", sf::BodyPhysicsType::SUBMERGED, "yellow");

//Inner Components
sf::Polyhedron* bottle = new sf::Polyhedron("AluminiumBottle", path_data + "/bbotella_alu_.stl", 1, sf::I4(), "FoamMat", sf::BodyPhysicsType::SUBMERGED, "black");
bottle->ScalePhysicalPropertiesToArbitraryMass(3.7); // Peso promedio entre ambas botellas
sf::Polyhedron* camera = new sf::Polyhedron("Camera", path_data + "/bcamara_.stl", 1, sf::I4(), "CamMat", sf::BodyPhysicsType::SUBMERGED, "black");
camera->ScalePhysicalPropertiesToArbitraryMass(1.718);
sf::Polyhedron* supp_cams_l = new sf::Polyhedron("SupportCameraLow", path_data + "/bsoporte_cams_abj_.stl", 1, sf::I4(), "SuppMat", sf::BodyPhysicsType::SUBMERGED, "black");
supp_cams_l->ScalePhysicalPropertiesToArbitraryMass(.277);
sf::Polyhedron* supp_cams_h = new sf::Polyhedron("SupportCameraHigh", path_data + "/bsoporte_cams_arr_.stl", 1, sf::I4(), "SuppMat", sf::BodyPhysicsType::SUBMERGED, "black");
supp_cams_h->ScalePhysicalPropertiesToArbitraryMass(.655);
sf::Polyhedron* supp_sens = new sf::Polyhedron("SupportSensor", path_data + "/bsoporte_sens_.stl", 1, sf::I4(), "SuppMat", sf::BodyPhysicsType::SUBMERGED, "black");
supp_sens->ScalePhysicalPropertiesToArbitraryMass(1.189);
sf::Polyhedron* light = new sf::Polyhedron("LightBottle", path_data + "/bluz_.stl", 1, sf::I4(), "LightMat", sf::BodyPhysicsType::SUBMERGED, "black");
light->ScalePhysicalPropertiesToArbitraryMass(.668);
sf::Polyhedron* ROV_sensor = new sf::Polyhedron("ROVSensor", path_data + "/bsensor_.stl", 1, sf::I4(), "SensorMat", sf::BodyPhysicsType::SUBMERGED, "black");
ROV_sensor->ScalePhysicalPropertiesToArbitraryMass(7.2);
sf::Polyhedron* foam_block_1 = new sf::Polyhedron("FoamBlock", path_data + "/bespuma_.stl", 1, sf::I4(), "FoamMat", sf::BodyPhysicsType::SUBMERGED, "yellow");
// foam_block_1->ScalePhysicalPropertiesToArbitraryMass(.123);
sf::Box* foam_block_2 = new sf::Box("FoamBlock2", sf::Vector3(.1,.12,.035), sf::I4(), "FoamMat", sf::BodyPhysicsType::SUBMERGED, "yellow");
sf::Box* foam_block_3 = new sf::Box("FoamBlock3", sf::Vector3(.08,.12,.3), sf::I4(), "FoamMat", sf::BodyPhysicsType::SUBMERGED, "yellow");
sf::Polyhedron* foam_corner = new sf::Polyhedron("FoamCorner", path_data + "/bespuma_esq_.stl", 1, sf::I4(), "FoamMat", sf::BodyPhysicsType::SUBMERGED, "yellow");
foam_corner->ScalePhysicalPropertiesToArbitraryMass(.016);
sf::Polyhedron* propeller = new sf::Polyhedron("Propeller", path_data + "/bT200_.stl", 1, sf::Transform(sf::Quaternion(M_PI_2, 0, 0)), "ThrustMat", sf::BodyPhysicsType::SUBMERGED, "black");
propeller->ScalePhysicalPropertiesToArbitraryMass(.34382302);

//NOTE: investigate variable "isBuoyant". In the example UnderwaterTest they set it false.

//Build body
vehicle = new sf::Compound("Vehicle", profileO, sf::I4(), sf::BodyPhysicsType::SUBMERGED);
vehicle->AddExternalPart(profile11, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.250, .220500, 0.07)));
vehicle->AddExternalPart(profile11, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.250, .220500, 0.07)));
vehicle->AddExternalPart(profile11, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.250, -.220500, 0.07)));
vehicle->AddExternalPart(profile11, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.250, -.220500, 0.07)));
vehicle->AddExternalPart(profile41, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.090, 0, -0.154)));
vehicle->AddExternalPart(profile41, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, 0, -0.315)));
vehicle->AddExternalPart(profile53, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, .220500, 0)));
vehicle->AddExternalPart(profile53, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, -.220500, 0)));
vehicle->AddExternalPart(profile53, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, .220500, -0.154)));
vehicle->AddExternalPart(profile53, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, -.220500, -0.154)));
vehicle->AddExternalPart(profile53, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, .220500, -0.315)));
vehicle->AddExternalPart(profile53, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, -.220500, -0.315)));
vehicle->AddExternalPart(foam_feet, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.250, 0.220500, 0.137732)));
vehicle->AddExternalPart(foam_feet, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.250, 0.220500, 0.137732)));
vehicle->AddExternalPart(foam_feet, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.250, -0.220500, 0.137732)));
vehicle->AddExternalPart(foam_feet, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.250, -0.220500, 0.137732)));
vehicle->AddExternalPart(sheet_acr, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.268075, 0, -0.1575)));
vehicle->AddExternalPart(sheet_acr, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.268075, 0, -0.1575)));
vehicle->AddExternalPart(top_acr, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.129032, 0.158930, -0.3315)));
vehicle->AddExternalPart(top_acr, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.129032, 0.158930, -0.3315)));
vehicle->AddExternalPart(top_acr, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.129032, -0.158930, -0.3315)));
vehicle->AddExternalPart(top_acr, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.129032, -0.158930, -0.3315)));
// vehicle->AddExternalPart(cylinder, sf::Transform(sf::Quaternion::getIdentity(), sf::Vector3(1.2, 1.2, 0)));

//Add inner components
vehicle->AddExternalPart(bottle, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.093553, 0.0055, -0.073530)));
vehicle->AddExternalPart(bottle, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.093460, 0.0055, -0.235823)));
// vehicle->AddExternalPart(bottle, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.004749, 0.0055, -0.155542)));
vehicle->AddExternalPart(camera, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.210, 0.079198, -0.099868)));
vehicle->AddExternalPart(camera, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.210, -0.003752, -0.099868)));
vehicle->AddExternalPart(camera, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.210, -0.086702, -0.099868)));
vehicle->AddExternalPart(supp_cams_l, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.210694, -0.004496, -0.179)));
vehicle->AddExternalPart(supp_cams_h, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.209106, -0.002968, -0.025)));
vehicle->AddExternalPart(supp_sens, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.165369, -0.0055, -0.129)));
vehicle->AddExternalPart(light, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.165, 0.1414, -0.129844)));
vehicle->AddExternalPart(light, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.165, -0.1524, -0.129844)));
vehicle->AddExternalPart(ROV_sensor, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.164742, -0.005441, -0.186226)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, M_PI_2), sf::Vector3(0.213250, 0.1735, -0.2684)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.0225, 0, -0.268))); //ADDED
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.0225, 0, -0.204))); //ADDED
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.0225, 0.12, -0.048))); //ADDED
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.0225, -0.12, -0.048))); //ADDED
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.0225, 0, -0.048))); //ADDED
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.0805, 0.1439, -0.298)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.184, 0.1439, -0.298)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.184, -0.1439, -0.298)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.0805, -0.1439, -0.298)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, M_PI_2), sf::Vector3(0.213250, -0.1735, -0.2684)));
vehicle->AddExternalPart(foam_block_2, sf::Transform(sf::Quaternion(0, 0, M_PI_2), sf::Vector3(0.213250, -0.1735, -0.0984))); //ADDED
vehicle->AddExternalPart(foam_block_2, sf::Transform(sf::Quaternion(0, 0, M_PI_2), sf::Vector3(0.213250, 0.1735, -0.0984))); //ADDED
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.182, 0.16061, -0.365)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.0785, 0.16061, -0.365)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.078844, 0.16061, -0.365)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.182344, 0.16061, -0.365)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.182344, -0.155684, -0.365)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.078844, -0.155684, -0.365)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.0785, -0.155684, -0.365)));
vehicle->AddExternalPart(foam_block_1, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.182, -0.155684, -0.365)));
vehicle->AddExternalPart(foam_corner, sf::Transform(sf::Quaternion(0, 0, M_PI), sf::Vector3(0.261650, 0.248232, -0.300)));
vehicle->AddExternalPart(foam_corner, sf::Transform(sf::Quaternion(0, 0, M_PI), sf::Vector3(-0.261650, 0.248232, -0.300)));
vehicle->AddExternalPart(foam_corner, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.261650, -0.248232, -0.300)));
vehicle->AddExternalPart(foam_corner, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.261650, -0.248232, -0.300)));
vehicle->AddExternalPart(foam_block_3, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.308075, 0.15, -0.1575))); //ADDED
vehicle->AddExternalPart(foam_block_3, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0.308075, -0.15, -0.1575))); //ADDED
vehicle->AddExternalPart(foam_block_3, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.308075, 0.15, -0.1575))); //ADDED
vehicle->AddExternalPart(foam_block_3, sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(-0.308075, -0.15, -0.1575))); //ADDED

//Create Thrusters
xl = new sf::Thruster("XL", propeller, 0.076, std::make_pair(0.43,0.43), 0.09, 3000, true);
xr = new sf::Thruster("XR", propeller, 0.076, std::make_pair(0.43,0.43), 0.09, 3000, true);
zb = new sf::Thruster("ZB", propeller, 0.076, std::make_pair(0.43,0.43), 0.09, 3000, true);
zf = new sf::Thruster("ZF", propeller, 0.076, std::make_pair(0.43,0.43), 0.09, 3000, true);
yd = new sf::Thruster("YD", propeller, 0.076, std::make_pair(0.43,0.43), 0.09, 3000, true);
yu = new sf::Thruster("YU", propeller, 0.076, std::make_pair(0.43,0.43), 0.09, 3000, true);

//Thrusters
roverto->DefineLinks(vehicle);
roverto->AddLinkActuator(xl, "Vehicle", sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, -0.289940, -0.144792)));
roverto->AddLinkActuator(xr, "Vehicle", sf::Transform(sf::Quaternion(0, 0, 0), sf::Vector3(0, 0.289940, -0.144792)));
roverto->AddLinkActuator(yd, "Vehicle", sf::Transform(sf::Quaternion(M_PI_2, 0, 0), sf::Vector3(-0.009208, 0, 0.069440)));
roverto->AddLinkActuator(yu, "Vehicle", sf::Transform(sf::Quaternion(M_PI_2, 0, 0), sf::Vector3(-0.009208, 0, -0.38440)));
roverto->AddLinkActuator(zb, "Vehicle", sf::Transform(sf::Quaternion(0, -M_PI_2, 0), sf::Vector3(-0.319590, -0.003956, -0.153)));
roverto->AddLinkActuator(zf, "Vehicle", sf::Transform(sf::Quaternion(0, -M_PI_2, 0), sf::Vector3(0.319590, -0.003956, -0.153)));

Expected behavior
I expected the robot in the surface to keep a similar heading behavior as that in deep water. The spinning makes it impossible to control.

Screenshots
I uploaded a short video of the problem, available here.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04

Thank you very much!

Problem running tests ?

Hello Patryk !
Thanks a lot for this simulator. Seems really cool but I am having a bit of problems
getting it to work. Might be something really dumb I am doing since I am bit rusty on C++ ( Getting back to it now)
Describe the bug

I was able to compile and install the library without any problems.
But for some reason I cant compile the test examples, and when I make my own example following your tutorial I have some linking problems.
It might be my compiler version or something like that but i feel i don't have the info to fix it.

The test examples.

First, compiling then directly with the provided cmake does not work.
doing

     cd Tests
     mkdir build && cd build && cmake .. && make 

gives me include error, since the include does contains the folder Stonefish in the path.

/home/felipe/stonefish/Tests/FloatingTest/main.cpp:26:10: fatal error: core/GraphicalSimulationApp.h: No such file or directory
 #include <core/GraphicalSimulationApp.h>

fixing that gives me an error on the data folder macro

/home/felipe/stonefish/Tests/FallingTest/main.cpp:49:35: error: expected primary-expression before ‘(’ token
     FallingTestApp app(std::string(DATA_DIR_PATH), s, h, simulationManager);

My own example

When I create the first example described here : https://stonefish.readthedocs.io/en/stable/building.html,
compiling as :

g++ -o test main.cpp MySimulationManager.cpp -DDATA_DIR_PATH=\"${CMAKE_CURRENT_SOURCE_DIR}/Data/\" -lStonefish -I /usr/local/include/Stonefish/

gives me a weird linking error.

/tmp/ccIGdiDK.o: In function `MySimulationManager::MySimulationManager(float)':
MySimulationManager.cpp:(.text+0x28): undefined reference to `sf::SimulationManager::SimulationManager(float, sf::SolverType, sf::CollisionFilteringType)'
/tmp/ccIGdiDK.o: In function `MySimulationManager::BuildScenario()':
MySimulationManager.cpp:(.text+0xbb): undefined reference to `sf::SimulationManager::CreateMaterial(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float, float)'
MySimulationManager.cpp:(.text+0x13e): undefined reference to `sf::SimulationManager::CreateMaterial(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float, float)'
MySimulationManager.cpp:(.text+0x1ea): undefined reference to `sf::SimulationManager::SetMaterialsInteraction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float, float)'
MySimulationManager.cpp:(.text+0x2a5): undefined reference to `sf::SimulationManager::SetMaterialsInteraction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float, float)'
MySimulationManager.cpp:(.text+0x360): undefined reference to `sf::SimulationManager::SetMaterialsInteraction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float, float)'
MySimulationManager.cpp:(.text+0x73a): undefined reference to `sf::Plane::Plane(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float)'
/tmp/ccIGdiDK.o:(.data.rel.ro._ZTV19MySimulationManager[_ZTV19MySimulationManager]+0x28): undefined reference to `sf::SimulationManager::SimulationStepCompleted(float)'
collect2: error: ld returned 1 exit status

I think it might be some flag on the CMAKE for the library compilation ? Maybe some library version that I have ?

THanks again for this amazing project

Environment

OS: ubuntu 18.04
Compiler: g++ 8.4

Variable Buoyancy System (VBS) actuator

Is your feature request related to a problem? Please describe.
We have a vehicle with a VBS pumping in and out water. The best way to represent this
in simulation would probably be a block of water with changing proportions (the cylinder
in this example is filled with water when the VBS is pumping in and vice versa).

Describe the solution you'd like
I'm not exactly sure, but I'm envisioning something like an actuator with a mass that
can change either its volume or its mass.

Describe alternatives you've considered
Again, not really sure. One could just hook into the simulator and apply some kind of force.
That's what we've done before in Gazebo but we would like also the center of gravity to
change since the center of mass is moving when the water volume is extended/decreased.

Any suggestions for short-term solutions would also be very welcome.

scenario_parser reports file not found on xml ending tag mismatch

Describe the bug
I accidentally created an environment file with a mismatching XML ending tag (<dimensions xyz="0.0 0.0 0.0">). The stonefish_ros_parser.log file logged the error "File not found!", but perhaps "XML file syntax error" would be a more informative error message?

[Integration] Struggling to build the example

Describe the bug
Really appreciate this project! So far I've build and run the tests, and those work great. Currently struggling to build the example simulator outside of the stonefish repo assuming that I've install stonefish to my system with sudo make install.

To Reproduce

My setup:

/MyWorkspace/
  /example
    /main.cpp
    /MySimulationManager.cc
    /MySimulationManager.h
 CMakeLists.txt
#  CMakeLists.txt
add_executable(demo demo/main.cpp demo/MySimulationManager.cpp)

My steps:

cd MyRepo/demo
mkdir build
cd build
cmake ..
make

Output:

In file included from /MyWorkspace/demo/main.cpp:1:
/usr/local/include/Stonefish/core/GraphicalSimulationApp.h:29:10: fatal error: graphics/OpenGLDataStructs.h: No such file or directory
   29 | #include "graphics/OpenGLDataStructs.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/demo.dir/build.make:76: CMakeFiles/demo.dir/demo/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/demo.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Expected behavior

I expect this to build successfully and the system includes seem to work fine, but the relative includes fail to resolve. If I add an include_target_directories, I get linking errors.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Graphics free mode?

Describe the bug
No bug. Just a question.

How can one run the stonefish simulator in a mode with no graphics displayed?

Thanks for the awesome simulation btw!

GPS reports zero longitude and latitude when configuring a negative longitude for the environment

GPS sensor reports 0 longitude and 0 latitude when setting negative longitude in the scenario file for the .

To Reproduce
Steps to reproduce the behavior:

  1. Install stonefish
  2. Install cola2_msgs
  3. install_stonefish_ros
  4. install_cola2_stonefish
  5. change line 2 and 3 in stonefish_ros/launch/simulator.launch
    <arg name="simulation_data" default="$(find cola2_stonefish)/data"/> <!-- path to the data directory -->
    <arg name="scenario_description" default="$(find cola2_stonefish)/scenarios/sparus2_tank.scn"/> 
  1. change the longitude to a negative value at line 4 in cola2_stonefish/scenarios/sparus2_tank.scn

    <ned latitude="41.7777" longitude="-3.0333"/>

  2. roslaunch stonefish_ros simulator.launch

  3. rostopic echo /sparus2/navigator/gps in a separated terminal window

Expected behavior
latitude and longitude reports 0.0
see the attached screenshot

Screenshots
gps_invalid

Desktop (please complete the following information):

  • OS: Ubuntu 20.04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.