Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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