Skip to content

Commit

Permalink
Merge pull request #812 from cdyk/fix_809
Browse files Browse the repository at this point in the history
Fixed compilation errors in unit tests.
  • Loading branch information
sytelus authored Feb 14, 2018
2 parents 2e45a50 + 6a1657d commit 714c265
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -787,16 +787,20 @@ struct MavLinkDroneController::impl {
mag_output.magnetic_field_body,
baro_output.pressure * 0.01f /*Pa to Milibar */, baro_output.altitude);

const auto& distance_output = getDistance()->getOutput();
float pitch, roll, yaw;
VectorMath::toEulerianAngle(distance_output.relative_pose.orientation, pitch, roll, yaw);

sendDistanceSensor(distance_output.min_distance / 100, //m -> cm
distance_output.max_distance / 100, //m -> cm
distance_output.distance,
0, //sensor type: //TODO: allow changing in settings?
77, //sensor id, //TODO: should this be something real?
pitch); //TODO: convert from radians to degrees?

const auto * distance = getDistance();
if (distance) {
const auto& distance_output = distance->getOutput();
float pitch, roll, yaw;
VectorMath::toEulerianAngle(distance_output.relative_pose.orientation, pitch, roll, yaw);

sendDistanceSensor(distance_output.min_distance / 100, //m -> cm
distance_output.max_distance / 100, //m -> cm
distance_output.distance,
0, //sensor type: //TODO: allow changing in settings?
77, //sensor id, //TODO: should this be something real?
pitch); //TODO: convert from radians to degrees?
}

const auto gps = getGps();
if (gps != nullptr) {
Expand Down
4 changes: 1 addition & 3 deletions AirLibUnitTests/PixhawkTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ class PixhawkTest : public TestBase {
public:
virtual void run() override
{
SensorFactory sensor_factory;

//Test PX4 based drones
auto pixhawk = MultiRotorParamsFactory::createConfig("Pixhawk", &sensor_factory);
auto pixhawk = MultiRotorParamsFactory::createConfig("Pixhawk", std::make_shared<SensorFactory>());

DroneControllerBase* controller = pixhawk->getController();
testAssert(controller != nullptr, "Couldn't get pixhawk controller");
Expand Down
3 changes: 1 addition & 2 deletions AirLibUnitTests/RosFlightTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class RosFlightTest : public TestBase {
public:
virtual void run() override
{
SensorFactory sensor_factory;
auto rosFlight = MultiRotorParamsFactory::createConfig("RosFlight", &sensor_factory);
auto rosFlight = MultiRotorParamsFactory::createConfig("RosFlight", std::make_shared<SensorFactory>());

DroneControllerBase* controller = rosFlight->getController();
testAssert(controller != nullptr, "Couldn't get controller");
Expand Down
2 changes: 1 addition & 1 deletion AirLibUnitTests/SimpleFlightTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SimpleFlightTest : public TestBase

SensorFactory sensor_factory;

std::unique_ptr<MultiRotorParams> params = MultiRotorParamsFactory::createConfig("SimpleFlight", &sensor_factory);
std::unique_ptr<MultiRotorParams> params = MultiRotorParamsFactory::createConfig("SimpleFlight", std::make_shared<SensorFactory>());
MultiRotor vehicle;
std::unique_ptr<Environment> environment;
vehicle.initialize(params.get(), Pose(),
Expand Down

0 comments on commit 714c265

Please sign in to comment.