Skip to content

Commit

Permalink
Fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellspryn committed Feb 14, 2019
1 parent c95a3d9 commit 39e1b4f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion AirLib/include/api/RpcLibAdapatorsBase.hpp
Expand Up @@ -514,7 +514,7 @@ class RpcLibAdapatorsBase {
};

struct SensorReadings {
std::map<std::string, std::map<std::string, float> > readings;
std::map<std::string, std::map<std::string, double> > readings;

MSGPACK_DEFINE_MAP(readings);

Expand Down
4 changes: 3 additions & 1 deletion AirLib/include/api/RpcLibClientBase.hpp
Expand Up @@ -10,6 +10,8 @@
#include "physics/Kinematics.hpp"
#include "physics/Environment.hpp"

#include <map>

namespace msr { namespace airlib {

//common methods for RCP clients of different vehicles
Expand Down Expand Up @@ -47,7 +49,7 @@ class RpcLibClientBase {
int simGetSegmentationObjectID(const std::string& mesh_name) const;
void simPrintLogMessage(const std::string& message, std::string message_param = "", unsigned char severity = 0);

std::map<std::string, std::map<std::string, float> > readSensors(const std::string vehicle_name = "");
std::map<std::string, std::map<std::string, double> > readSensors(const std::string vehicle_name = "");
msr::airlib::RayCastResponse simRayCast(const msr::airlib::RayCastRequest request, const std::string vehicle_name = "");
void simSetDrawableShapes(const msr::airlib::DrawableShapeRequest request, const std::string vehicle_name = "");

Expand Down
5 changes: 3 additions & 2 deletions AirLib/include/sensors/SensorBase.hpp
Expand Up @@ -10,6 +10,7 @@
#include "physics/Environment.hpp"
#include "physics/Kinematics.hpp"

#include <map>

namespace msr { namespace airlib {

Expand Down Expand Up @@ -60,9 +61,9 @@ class SensorBase : public UpdatableObject {
return attach_link_name_;
}

virtual const std::map<std::string, float> read() const
virtual const std::map<std::string, double> read() const
{
return std::map<std::string, float>();
return std::map<std::string, double>();
}

virtual ~SensorBase() = default;
Expand Down
9 changes: 5 additions & 4 deletions AirLib/include/sensors/SensorCollection.hpp
Expand Up @@ -5,6 +5,7 @@
#define msr_airlib_SensorCollection_hpp

#include <unordered_map>
#include <map>
#include "sensors/SensorBase.hpp"
#include "common/UpdatableContainer.hpp"
#include "common/Common.hpp"
Expand Down Expand Up @@ -76,7 +77,7 @@ class SensorCollection : UpdatableObject {
return 0;
}
else {
return it->second.size();
return static_cast<uint>(it->second.size());
}
}

Expand Down Expand Up @@ -133,12 +134,12 @@ class SensorCollection : UpdatableObject {

//*** End: UpdatableState implementation ***//

virtual std::map<std::string, std::map<std::string, float> > getReadings() const
virtual std::map<std::string, std::map<std::string, double> > getReadings() const
{
std::map<std::string, std::map<std::string, float> > readings;
std::map<std::string, std::map<std::string, double> > readings;
for (auto &kvp : this->sensors_)
{
std::map<std::string, float> reading;
std::map<std::string, double> reading;
std::string sensor_name = kvp.first;
for (auto iter = kvp.second.get()->begin(); iter != kvp.second.get()->end(); ++iter)
{
Expand Down
4 changes: 2 additions & 2 deletions AirLib/include/sensors/barometer/BarometerBase.hpp
Expand Up @@ -34,9 +34,9 @@ class BarometerBase : public SensorBase {
reporter.writeValue("Baro-Prs", output_.pressure);
}

virtual const std::map<std::string, float> read() const override
virtual const std::map<std::string, double> read() const override
{
std::map<std::string, float> values;
std::map<std::string, double> values;
auto& output = this->getOutput();

values["Baro-Alt"] = output.altitude;
Expand Down
5 changes: 2 additions & 3 deletions AirLib/include/sensors/distance/DistanceBase.hpp
Expand Up @@ -34,10 +34,9 @@ class DistanceBase : public SensorBase {
reporter.writeValue("Dist-Curr", output_.distance);
}

virtual const std::map<std::string, float> read() const override
virtual const std::map<std::string, double> read() const override
{
std::map<std::string, float> values;
auto& output = this->getOutput();
std::map<std::string, double> values;

values["Dist-Curr"] = output_.distance;
values["Max-Distance"] = output_.max_distance;
Expand Down
11 changes: 8 additions & 3 deletions AirLib/include/sensors/gps/GpsBase.hpp
Expand Up @@ -107,9 +107,9 @@ class GpsBase : public SensorBase {
reporter.writeValue("GPS-Epv", output_.gnss.epv);
}

virtual const std::map<std::string, float> read() const override
virtual const std::map<std::string, double> read() const override
{
std::map<std::string, float> values;
std::map<std::string, double> values;
auto& output = this->getOutput();

values["GPS-Loc-latitude"] = output.gnss.geo_point.latitude;
Expand All @@ -121,7 +121,12 @@ class GpsBase : public SensorBase {
values["GPS-Eph"] = output.gnss.eph;
values["GPS-Epv"] = output.gnss.epv;
values["GPS-fix-type"] = output.gnss.fix_type;
values["GPS-time-utc"] = output.gnss.time_utc;

// Marshall bits into double
double marshalled_time;
memcpy(&marshalled_time, &output.gnss.time_utc, sizeof(output.gnss.time_utc));
values["GPS-time-utc"] = marshalled_time;

values["GPS-IsValid"] = output.is_valid ? 1.0f : 0.0f;

return values;
Expand Down
4 changes: 2 additions & 2 deletions AirLib/include/sensors/imu/ImuBase.hpp
Expand Up @@ -35,10 +35,10 @@ class ImuBase : public SensorBase {
reporter.writeValue("IMU-Lin", output_.linear_acceleration);
}

virtual const std::map<std::string, float> read() const override
virtual const std::map<std::string, double> read() const override
{
auto output = this->getOutput();
std::map<std::string, float> values;
std::map<std::string, double> values;
values["IMU-Ang-pitch"] = output.angular_velocity.x();
values["IMU-Ang-roll"] = output.angular_velocity.y();
values["IMU-Ang-yaw"] = output.angular_velocity.z();
Expand Down
4 changes: 2 additions & 2 deletions AirLib/include/sensors/magnetometer/MagnetometerBase.hpp
Expand Up @@ -32,9 +32,9 @@ class MagnetometerBase : public SensorBase {
reporter.writeValue("Mag-Vec", output_.magnetic_field_body);
}

virtual const std::map<std::string, float> read() const override
virtual const std::map<std::string, double> read() const override
{
std::map<std::string, float> values;
std::map<std::string, double> values;
auto& output = this->getOutput();

values["Mag-Vec-x"] = output.magnetic_field_body.x();
Expand Down
2 changes: 1 addition & 1 deletion AirLib/src/api/RpcLibClientBase.cpp
Expand Up @@ -217,7 +217,7 @@ void RpcLibClientBase::simPrintLogMessage(const std::string& message, std::strin
pimpl_->client.call("simPrintLogMessage", message, message_param, severity);
}

std::map<std::string, std::map<std::string, float> > RpcLibClientBase::readSensors(const std::string vehicle_name)
std::map<std::string, std::map<std::string, double> > RpcLibClientBase::readSensors(const std::string vehicle_name)
{
return pimpl_->client.call("readSensors", vehicle_name).as<msr::airlib_rpclib::RpcLibAdapatorsBase::SensorReadings>().readings;
}
Expand Down

0 comments on commit 39e1b4f

Please sign in to comment.