Commit ba00aeb8 authored by Nicolae Rosia's avatar Nicolae Rosia
Browse files

plugins: Fix compilation errors against Gazebo7


Signed-off-by: default avatarNicolae Rosia <nicolae.rosia@gmail.com>
parent d7f998c3
...@@ -61,7 +61,11 @@ void RayPlugin::Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf) ...@@ -61,7 +61,11 @@ void RayPlugin::Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
{ {
// Get then name of the parent sensor // Get then name of the parent sensor
this->parentSensor = this->parentSensor =
#if GAZEBO_MAJOR_VERSION >= 7
std::dynamic_pointer_cast<sensors::RaySensor>(_parent);
#else
boost::dynamic_pointer_cast<sensors::RaySensor>(_parent); boost::dynamic_pointer_cast<sensors::RaySensor>(_parent);
#endif
if (!this->parentSensor) if (!this->parentSensor)
gzthrow("RayPlugin requires a Ray Sensor as its parent"); gzthrow("RayPlugin requires a Ray Sensor as its parent");
......
...@@ -505,9 +505,15 @@ void GazeboMavlinkInterface::handle_message(mavlink_message_t *msg) ...@@ -505,9 +505,15 @@ void GazeboMavlinkInterface::handle_message(mavlink_message_t *msg)
// set angles of control surface joints (this should go into a message for the correct plugin) // set angles of control surface joints (this should go into a message for the correct plugin)
double roll = 0.5 * (inputs.control[4] + inputs.control[5]); double roll = 0.5 * (inputs.control[4] + inputs.control[5]);
double pitch = 0.5 * (inputs.control[4] - inputs.control[5]); double pitch = 0.5 * (inputs.control[4] - inputs.control[5]);
#if GAZEBO_MAJOR_VERSION >= 7
left_elevon_joint_->SetPosition(0, roll);
right_elevon_joint_->SetPosition(0, -roll);
elevator_joint_->SetPosition(0, -pitch);
#else
left_elevon_joint_->SetAngle(0, roll); left_elevon_joint_->SetAngle(0, roll);
right_elevon_joint_->SetAngle(0, -roll); right_elevon_joint_->SetAngle(0, -roll);
elevator_joint_->SetAngle(0, -pitch); elevator_joint_->SetAngle(0, -pitch);
#endif
} }
received_first_referenc_ = true; received_first_referenc_ = true;
......
...@@ -56,12 +56,20 @@ void CameraPlugin::Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf) ...@@ -56,12 +56,20 @@ void CameraPlugin::Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf)
gzerr << "Invalid sensor pointer.\n"; gzerr << "Invalid sensor pointer.\n";
this->parentSensor = this->parentSensor =
#if GAZEBO_MAJOR_VERSION >= 7
std::dynamic_pointer_cast<sensors::CameraSensor>(_sensor);
#else
boost::dynamic_pointer_cast<sensors::CameraSensor>(_sensor); boost::dynamic_pointer_cast<sensors::CameraSensor>(_sensor);
#endif
if (!this->parentSensor) if (!this->parentSensor)
{ {
gzerr << "CameraPlugin requires a CameraSensor.\n"; gzerr << "CameraPlugin requires a CameraSensor.\n";
#if GAZEBO_MAJOR_VERSION >= 7
if (std::dynamic_pointer_cast<sensors::DepthCameraSensor>(_sensor))
#else
if (boost::dynamic_pointer_cast<sensors::DepthCameraSensor>(_sensor)) if (boost::dynamic_pointer_cast<sensors::DepthCameraSensor>(_sensor))
#endif
gzmsg << "It is a depth camera sensor\n"; gzmsg << "It is a depth camera sensor\n";
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment