Coder Social home page Coder Social logo

Comments (4)

SwiftGust avatar SwiftGust commented on August 23, 2024

If you are aftering just control simulation then you don't need Gazebo-ROS connection at all.
You can use Gazebo<->ArduPilot as is then configure MAVROS node connected to ArduPilot SITL for ROS topics.

However, if you need sensor topic in ROS such as Camera, Lidar etc(No IMU or GPS, this can be acquired from MAVROS) then it is different story, you should use Gazebo-ROS package.
You have to add gazebo-ros plugins in the current model.

Refer official Gazebo Guide regarding this,
http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros
http://gazebosim.org/tutorials?cat=connect_ros

from ardupilot_gazebo.

anish-pratheepkumar avatar anish-pratheepkumar commented on August 23, 2024

Good Day,
Thank you for your reply!
I have already installed Gazebo-ROS.
Yes, I would like to access lidar, camera and so on by running MAVROS nodes. Since the goal is to do autonomous navigation in a non-GPS setup, using Opticalflow(PX4flow).
So do you mean if I:-

  1. initialize MAVROS
  2. initialize GAZEBO-ROS
  3. initialize GAZEBO-Ardupilot SITL separately (not with ros wrapping, then how to get this Ardupilot SITL connected with Gazebo-ROS?)
  4. also how to connect MAVROS to GAZEBO-ROS-Ardupilot after doing 3rd step.
    I am a bit confused here

Also I was trying to set up GAZEBO-Ardupilot. Unfortunately, I am getting an error in 'make -j4' step. I tried both khancyr and yours(SwiftGust). I have Gazebo 9 is that an issue? As per this statement from your wiki "ArduPilot setup for SITL launch Gazebo version 7.x or 8.x The gazebo9 branch will works on gazebo >= 9.x"
does it mean I have to just replace the numerical 7 or 8 with 9? I just did that but still, error is coming.
Note: I will post the error I am getting while doing "make -j4" soon, when I get back to my working PC.
Thanks & regards!

from ardupilot_gazebo.

anish-pratheepkumar avatar anish-pratheepkumar commented on August 23, 2024

Please find the error while running "make -j4". Do you have info as to why this error is occurring ?

anish@studienarbeit:~/ardupilot_gazebo/build$ make -j4
[ 16%] Building CXX object CMakeFiles/ArduCopterPlugin.dir/src/ArduCopterPlugin.cc.o
[ 33%] Building CXX object CMakeFiles/ArduPilotPlugin.dir/src/ArduPilotPlugin.cc.o
[ 50%] Building CXX object CMakeFiles/ArduCopterIRLockPlugin.dir/src/ArduCopterIRLockPlugin.cc.o
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc: In member function ‘void gazebo::ArduCopterPlugin::OnUpdate()’:
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc:565:68: error: ‘class gazebo::physics::World’ has no member named ‘GetSimTime’
gazebo::common::Time curTime = this->dataPtr->model->GetWorld()->GetSimTime();
^
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc: In member function ‘void gazebo::ArduCopterPlugin::SendState() const’:
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc:752:53: error: ‘class gazebo::physics::World’ has no member named ‘GetSimTime’
pkt.timestamp = this->dataPtr->model->GetWorld()->GetSimTime().Double();
^
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc:802:27: error: ‘class gazebo::physics::Model’ has no member named ‘GetWorldPose’
this->dataPtr->model->GetWorldPose().Ign();
^
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc:833:38: error: ‘class gazebo::physics::Link’ has no member named ‘GetWorldLinearVel’
this->dataPtr->model->GetLink()->GetWorldLinearVel().Ign();
^
In file included from /usr/include/boost/variant.hpp:22:0,
from /usr/include/sdformat-6.2/sdf/Param.hh:26,
from /usr/include/sdformat-6.2/sdf/Element.hh:25,
from /usr/include/sdformat-6.2/sdf/sdf.hh:4,
from /home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc:27:
/usr/include/boost/variant/get.hpp: In instantiation of ‘typename boost::add_reference::type boost::strict_get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2, ignition::math::v4::Vector2, ignition::math::v4::Vector3, ignition::math::v4::Quaternion, ignition::math::v4::Pose3}; typename boost::add_reference::type = short unsigned int&]’:
/usr/include/boost/variant/get.hpp:284:25: required from ‘typename boost::add_reference::type boost::get(boost::variant<T0, TN ...>&) [with U = short unsigned int; T0 = bool; TN = {char, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, long unsigned int, unsigned int, double, float, sdf::Time, ignition::math::v4::Color, ignition::math::v4::Vector2, ignition::math::v4::Vector2, ignition::math::v4::Vector3, ignition::math::v4::Quaternion, ignition::math::v4::Pose3}; typename boost::add_reference::type = short unsigned int&]’
/usr/include/sdformat-6.2/sdf/Param.hh:300:31: required from ‘bool sdf::Param::Get(T&) const [with T = short unsigned int]’
/usr/include/sdformat-6.2/sdf/Element.hh:454:7: required from ‘std::pair<T, bool> sdf::Element::Get(const string&, const T&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string]’
/usr/include/sdformat-6.2/sdf/Element.hh:429:55: required from ‘T sdf::Element::Get(const string&) const [with T = short unsigned int; std::__cxx11::string = std::__cxx11::basic_string]’
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc:55:12: required from ‘bool getSdfParam(sdf::ElementPtr, const string&, T&, const T&, const bool&) [with T = short unsigned int; sdf::ElementPtr = std::shared_ptrsdf::Element; std::__cxx11::string = std::__cxx11::basic_string]’
/home/anish/ardupilot_gazebo/src/ArduCopterPlugin.cc:590:45: required from here
/usr/include/boost/variant/get.hpp:212:5: error: static assertion failed: boost::variant does not contain specified type U, call to boost::get(boost::variant<T...>&) will always throw boost::bad_get exception
BOOST_STATIC_ASSERT_MSG(
^
CMakeFiles/ArduCopterPlugin.dir/build.make:62: recipe for target 'CMakeFiles/ArduCopterPlugin.dir/src/ArduCopterPlugin.cc.o' failed
make[2]: *** [CMakeFiles/ArduCopterPlugin.dir/src/ArduCopterPlugin.cc.o] Error 1
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/ArduCopterPlugin.dir/all' failed

from ardupilot_gazebo.

SwiftGust avatar SwiftGust commented on August 23, 2024

Are you using Gazebo 9?
Some of API changed in Gazebo 9 and working plugin for that is at gazebo9 branch
https://github.com/SwiftGust/ardupilot_gazebo/tree/gazebo9
I need to update master branch but didn't have time to do it...

from ardupilot_gazebo.

Related Issues (20)

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.