intel / gazebo-sitl

A ROS-independent Gazebo plugin for Ardupilot's SITL
Apache License 2.0
10 stars 14 forks source link

Try to make gazebo-sitl compatible with Parrot Sphinx Gazebo 7 (libignition-math2.so.2.2.2) #52

Open MAVProxyUser opened 7 years ago

MAVProxyUser commented 7 years ago

Parrot Sphinx currently only supports Parrot based products. There is no reason the gazebo-sitl plugin for ArduCopter can't be added as well. Parrot uses Gazebo 7.0.1, which is actually version 7.0.0, so the current gazebo-sitl needs to be a bit more backwards compatible.

http://developer.parrot.com/docs/sphinx/index.html

There is currently a compile error related to the Target Pose that needs fixed, the offending code is commented out in this commit so that things compile cleanly. https://github.com/MAVProxyUser/gazebo-sitl/blob/dc8d20c531500f6d0f9a7795998ea847023dbf44/gzsitl/gzsitl_plugin.cc#L128

[ 87%] Building CXX object gzsitl/CMakeFiles/gzsitl_plugin.dir/gzsitl_plugin.cc.o /opt/mesmer/log/gazebo-sitl/gzsitl/gzsitl_plugin.cc: In member function ‘void gazebo::GZSitlPlugin::OnUpdate()’: /opt/mesmer/log/gazebo-sitl/gzsitl/gzsitl_plugin.cc:130:28: error: no match for ‘operator=’ (operand types are ‘ignition::math::Pose3d {aka ignition::math::Pose3}’ and ‘const gazebo::math::Pose’) this->perm_target_pose = this->perm_target->GetWorldPose(); ^ /opt/mesmer/log/gazebo-sitl/gzsitl/gzsitl_plugin.cc:130:28: note: candidate is: In file included from /usr/include/ignition/math2/ignition/math/Frustum.hh:22:0, from /usr/include/ignition/math2/ignition/math.hh:7, from /usr/include/sdformat-4.3/sdf/Param.hh:35, from /usr/include/sdformat-4.3/sdf/Element.hh:24, from /usr/include/sdformat-4.3/sdf/sdf.hh:5, from /usr/local/include/gazebo-7/gazebo/common/Battery.hh:25, from /usr/local/include/gazebo-7/gazebo/common/common.hh:8, from /opt/mesmer/log/gazebo-sitl/gzsitl/gzsitl_plugin.hh:20, from /opt/mesmer/log/gazebo-sitl/gzsitl/gzsitl_plugin.cc:20: /usr/include/ignition/math2/ignition/math/Pose3.hh:222:25: note: ignition::math::Pose3& ignition::math::Pose3::operator=(const ignition::math::Pose3&) [with T = double] public: Pose3 &operator=(const Pose3 &_pose) ^ /usr/include/ignition/math2/ignition/math/Pose3.hh:222:25: note: no known conversion for argument 1 from ‘const gazebo::math::Pose’ to ‘const ignition::math::Pose3&’ make[2]: [gzsitl/CMakeFiles/gzsitl_plugin.dir/gzsitl_plugin.cc.o] Error 1 make[1]: [gzsitl/CMakeFiles/gzsitl_plugin.dir/all] Error 2 make: *** [all] Error 2

MAVProxyUser commented 7 years ago

My initial attempt to use:

this->perm_target_pose = this->perm_target->GetWorldPose();

is wrong because it returns math::Pose, we expect ignition::math::Pose3d& WorldPose per http://osrf-distributions.s3.amazonaws.com/gazebo/api/dev/classgazebo_1_1physics_1_1Entity.html I will need to try InitialRelativePose, DirtyPose, RelativePose, WorldPose from Collision Class. The original code was DEPRECATED from the Physics Entity Class and "Reimplemented in Collision" http://gazebosim.org/api/dev/classgazebo_1_1physics_1_1Entity.html#a736a629303b996ed3fd62a90ede62d0b We are currently in ‘class gazebo::physics::Model’ class... and as such as using a physics entity, and we need to be instead in the Collision class.