Home        Store        Learn        Blog

Install freebuoyancy_gazebo plugin problem

Hi
i have installed gazebo 7 and i cloned ardupilot code in ubuntu 16.04 64 bit.
i receive this error when installing freebuoyancy_gazebo plugin.

farhad@farhad:~/freebuoyancy_gazebo/build$ make
Scanning dependencies of target freebuoyancy_gazebo
[ 50%] Building CXX object CMakeFiles/freebuoyancy_gazebo.dir/src/freebuoyancy.cpp.o
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp: In member function ‘virtual void gazebo::FreeBuoyancyPlugin::OnUpdate()’:
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:74:25: error: ‘class gazebo::physics::World’ has no member named ‘ModelCount’
     for (i=0; i<world_->ModelCount(); ++i) {
                         ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:77:25: error: ‘class gazebo::physics::World’ has no member named ‘ModelByIndex’
             if (world_->ModelByIndex(i)->GetName() == model_it->name)
                         ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:80:33: error: ‘class gazebo::physics::World’ has no member named ‘ModelByIndex’
         if (!found && !(world_->ModelByIndex(i)->IsStatic())) // model not in listand not static, parse it for potential buoyancy flags
                                 ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:81:35: error: ‘class gazebo::physics::World’ has no member named ‘ModelByIndex’
             ParseNewModel(world_->ModelByIndex(i));
                                   ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:88:29: error: ‘class gazebo::physics::World’ has no member named ‘ModelCount’
         for (i=0; i<world_->ModelCount(); ++i) {
                             ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:89:25: error: ‘class gazebo::physics::World’ has no member named ‘ModelByIndex’
             if (world_->ModelByIndex(i)->GetName() == model_it->name)
                         ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:103:39: error: ‘class gazebo::physics::Link’ has no member named ‘WorldPose’
         cob_position = link_it->link->WorldPose().Pos() + link_it->link->WorldPose().Rot().RotateVector(link_it->buoyancy_center);
                                       ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:103:74: error: ‘class gazebo::physics::Link’ has no member named ‘WorldPose’
         cob_position = link_it->link->WorldPose().Pos() + link_it->link->WorldPose().Rot().RotateVector(link_it->buoyancy_center);
                                                                          ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:124:46: error: ‘class gazebo::physics::Link’ has no member named ‘WorldPose’
         velocity_difference = link_it->link->WorldPose().Rot().RotateVectorReverse(link_it->link->WorldLinearVel() - fluid_velocity_);
                                              ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:124:99: error: ‘class gazebo::physics::Link’ has no member named ‘WorldLinearVel’
         velocity_difference = link_it->link->WorldPose().Rot().RotateVectorReverse(link_it->link->WorldLinearVel() - fluid_velocity_);
                                                                                                   ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:130:40: error: ‘class gazebo::physics::Link’ has no member named ‘WorldPose’
         actual_force -= link_it->link->WorldPose().Rot().RotateVector(link_it->linear_damping * velocity_difference);
                                        ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:135:46: error: ‘class gazebo::physics::Link’ has no member named ‘RelativeAngularVel’
         velocity_difference = link_it->link->RelativeAngularVel();
                                              ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp: In member function ‘void gazebo::FreeBuoyancyPlugin::ParseNewModel(const ModelPtr&)’:
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:197:78: error: ‘class gazebo::physics::Inertial’ has no member named ‘CoG’
                     new_buoy_link.buoyancy_center = sdf_link->GetInertial()->CoG();
                                                                              ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:198:145: error: ‘class gazebo::physics::Inertial’ has no member named ‘Mass’
                     new_buoy_link.linear_damping = new_buoy_link.angular_damping = 5 * ignition::math::Vector3d::One * sdf_link->GetInertial()->Mass();
                                                                                                                                                 ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:210:92: error: ‘class gazebo::physics::Inertial’ has no member named ‘Mass’
                     new_buoy_link.buoyant_force = -compensation * sdf_link->GetInertial()->Mass() * WORLD_GRAVITY;
                                                                                            ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:234:78: error: ‘class gazebo::physics::Inertial’ has no member named ‘CoG’
                     new_buoy_link.buoyancy_center = sdf_link->GetInertial()->CoG();
                                                                              ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:235:145: error: ‘class gazebo::physics::Inertial’ has no member named ‘Mass’
                     new_buoy_link.linear_damping = new_buoy_link.angular_damping = 5 * ignition::math::Vector3d::One * sdf_link->GetInertial()->Mass();
                                                                                                                                                 ^
/home/farhad/freebuoyancy_gazebo/src/freebuoyancy.cpp:259:92: error: ‘class gazebo::physics::Inertial’ has no member named ‘Mass’
                     new_buoy_link.buoyant_force = -compensation * sdf_link->GetInertial()->Mass() * WORLD_GRAVITY;
                                                                                            ^
CMakeFiles/freebuoyancy_gazebo.dir/build.make:62: recipe for target 'CMakeFiles/freebuoyancy_gazebo.dir/src/freebuoyancy.cpp.o' failed
make[2]: *** [CMakeFiles/freebuoyancy_gazebo.dir/src/freebuoyancy.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/freebuoyancy_gazebo.dir/all' failed
make[1]: *** [CMakeFiles/freebuoyancy_gazebo.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Hi @mohammad,

You need to use the following repository, branch and instructions:

currently i used gazebo 8 and i dont have error with gazebo but when running sitl i have link 1 down error.
farhad@farhad:~/ardupilot/ArduSub$ sim_vehicle.py -f gazebo-bluerov2 -L RATBeach --out=udp:0.0.0.0:14550 --console
SIM_VEHICLE: Start
SIM_VEHICLE: Killing tasks
SIM_VEHICLE: Starting up at 33.810313,-118.393867,0,270 (RATBeach)
SIM_VEHICLE: WAF build
SIM_VEHICLE: Configure waf
SIM_VEHICLE: “/home/farhad/ardupilot/modules/waf/waf-light” “configure” “–board” “sitl”
Setting top to : /home/farhad/ardupilot
Setting out to : /home/farhad/ardupilot/build
Autoconfiguration : enabled
Setting board to : sitl
Using toolchain : native
Checking for ‘g++’ (C++ compiler) : /usr/lib/ccache/g++
Checking for ‘gcc’ (C compiler) : /usr/lib/ccache/gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
Checking for need to link with librt : not necessary
Checking for feenableexcept : yes
Checking for HAVE_CMATH_ISFINITE : yes
Checking for HAVE_CMATH_ISINF : yes
Checking for HAVE_CMATH_ISNAN : yes
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISINF_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE : yes
Checking for header endian.h : yes
Checking for header byteswap.h : yes
Checking for HAVE_MEMRCHR : yes
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.12
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.12
Source is git repository : yes
Update submodules : yes
Checking for program ‘git’ : /usr/bin/git
Checking for program ‘size’ : /usr/bin/size
Benchmarks : disabled
Unit tests : enabled
Scripting : enabled
Scripting runtime checks : enabled
Checking for program ‘rsync’ : /usr/bin/rsync
‘configure’ finished successfully (5.765s)
SIM_VEHICLE: Building
SIM_VEHICLE: “/home/farhad/ardupilot/modules/waf/waf-light” “build” “–target” “bin/ardusub”
Waf: Entering directory /home/farhad/ardupilot/build/sitl' Embedding file sandbox.lua:libraries/AP_Scripting/scripts/sandbox.lua Waf: Leaving directory /home/farhad/ardupilot/build/sitl’

BUILD SUMMARY
Build directory: /home/farhad/ardupilot/build/sitl
Target Text Data BSS Total

bin/ardusub 1935763 2912 65312 2003987

Build commands will be stored in build/sitl/compile_commands.json
‘build’ finished successfully (6.146s)
SIM_VEHICLE: Using defaults from (/home/farhad/ardupilot/Tools/autotest/default_params/sub.parm)
SIM_VEHICLE: Run ArduSub
SIM_VEHICLE: “/home/farhad/ardupilot/Tools/autotest/run_in_terminal_window.sh” “ArduSub” “/home/farhad/ardupilot/build/sitl/bin/ardusub” “-S” “-I0” “–home” “33.810313,-118.393867,0,270” “–model” “gazebo-bluerov2” “–speedup” “1” “–defaults” “/home/farhad/ardupilot/Tools/autotest/default_params/sub.parm”
SIM_VEHICLE: Run MavProxy
SIM_VEHICLE: “mavproxy.py” “–master” “tcp:127.0.0.1:5760” “–sitl” “127.0.0.1:5501” “–out” “127.0.0.1:14550” “–out” “127.0.0.1:14551” “–out” “udp:0.0.0.0:14550” “–console”
RiTW: Starting ArduSub : /home/farhad/ardupilot/build/sitl/bin/ardusub -S -I0 --home 33.810313,-118.393867,0,270 --model gazebo-bluerov2 --speedup 1 --defaults /home/farhad/ardupilot/Tools/autotest/default_params/sub.parm
Connect tcp:127.0.0.1:5760 source_system=255
Loaded module console
Log Directory:
Telemetry log: mav.tlog
Waiting for heartbeat from tcp:127.0.0.1:5760
MAV>

You need to click in the play button on gazebo.