Commit 0bd37283 authored by Tomaz Canabrava's avatar Tomaz Canabrava Committed by Daniel Agar

VehicleObjectAvoidance: Use qobject_cast instead of dynamic_cast

qobject_cast is times faster dynamic_cast for objects that
inherit QObject. also, use auto keyword to not duplicate
class names.
parent c53977fb
......@@ -46,7 +46,7 @@ VehicleObjectAvoidance::update(mavlink_obstacle_distance_t* message)
//-- Create a plottable grid with found objects
_objGrid.clear();
_objDistance.clear();
VehicleSetpointFactGroup* sp = dynamic_cast<VehicleSetpointFactGroup*>(_vehicle->setpointFactGroup());
auto* sp = qobject_cast<VehicleSetpointFactGroup*>(_vehicle->setpointFactGroup());
qreal startAngle = sp->yaw()->rawValue().toDouble() + _angleOffset;
for(int i = 0; i < MAVLINK_MSG_OBSTACLE_DISTANCE_FIELD_DISTANCES_LEN; i++) {
if(_distances[i] < _maxDistance && message->distances[i] != UINT16_MAX) {
......
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