-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix various inconsistencies, warnings #2485
Conversation
// const auto& baro_output = getBarometer()->getOutput(); | ||
const uint count_gps_sensors = getSensors().size(SensorBase::SensorType::Gps); | ||
if (count_gps_sensors != 0) { | ||
const auto& gps_output = getGpsData(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a tab<->spaces problem in the entire file
Should I fix that as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added commit for that, can be easily dropped if not needed
Since we're now moving ahead from 4.18, we'll need to update the docs to reflect that |
Yes, I'll be making a pr for clang update |
@madratman In the last commit, I've moved the frame types from the individual firmware params to MultiRotorParams, this now includes all the frame types used in PX4, so that the others can also use it, an example could be the Hexacopter model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another leftover, removing this does make the struct bigger, but I think better than earlier
The kArduCopterRotorControlsCount
= 11 is the size of the packet received, 11 also doesn't make much sense, but is enough for larger frames, could be increased to 12 or something for those type of frames, but not changing this for compatibility
Another thing which I noticed, there are many APIs which I think are just for MultiRotors, but are defined in the There are also many deprecated functions which can be removed when going for a new release |
Hey @rajat2004. thanks for this Till, Hope there's no issue in getting the sensor data with the base class method we talked about. Will test out soon. |
@madratman Done |
I think using the new base class Sensor APIs can also help in another way, PX4, ArduPilot require some sensors by default such as IMU, GPS, etc. |
I think we already have default sensors you're talking about, along with a mechanism to instantiate them at json parse time? In void addSensorsFromSettings(const AirSimSettings::VehicleSetting* vehicle_setting)
{
// use sensors from vehicle settings; if empty list, use default sensors.
// note that the vehicle settings completely override the default sensor "list";
// there is no piecemeal add/remove/update per sensor.
const std::map<std::string, std::unique_ptr<AirSimSettings::SensorSetting>>& sensor_settings
= vehicle_setting->sensors.size() > 0 ? vehicle_setting->sensors : AirSimSettings::AirSimSettings::singleton().sensor_defaults;
getSensorFactory()->createSensorsFromSettings(sensor_settings, sensors_, sensor_storage_);
} that sensor_defaults is of type // creates default sensor list when none specified in json
static void createDefaultSensorSettings(const std::string& simmode_name,
std::map<std::string, std::unique_ptr<SensorSetting>>& sensors)
{
if (simmode_name == "Multirotor") {
sensors["imu"] = createSensorSetting(SensorBase::SensorType::Imu, "imu", true);
sensors["magnetometer"] = createSensorSetting(SensorBase::SensorType::Magnetometer, "magnetometer", true);
sensors["gps"] = createSensorSetting(SensorBase::SensorType::Gps, "gps", true);
sensors["barometer"] = createSensorSetting(SensorBase::SensorType::Barometer, "barometer", true);
}
else if (simmode_name == "Car") {
sensors["gps"] = createSensorSetting(SensorBase::SensorType::Gps, "gps", true);
}
else {
// no sensors added for other modes
}
} My understanding is that these defaults are overridden in the case a user specifies custom sensors, and yes, in that case, the code will crash, if that's what you meant and that's what you are trying to prevent. |
Hmm, if the last sentence of my verbose comment above is what you meant - then in |
@madratman Thanks for the detailed explanation, and yes, I did mean what you stated in the last sentence. I've had this happen to me as well, plus some issues are also there regarding this. |
" Shouldn't we also update the compiler being used (currently clang-5)" -> #2500 |
"AirSimSettings.hpp itself, wherein it checks for the AddDefaultSensors field, and if set to true, then can add the default sensors" -> I think I saw it checking exactly for this in the file? |
ah hang on, I have made a mistake in 2500. was porting from a private repo. Restoring... |
Yes, noticed that right now, had forgotten about it, thanks for pointing it out! Should have gone through the file properly before posting. Curiously, this info is not mentioned in the settings.md, it is present in sensors.md, but the sensors page is not linked from the main settings file.
Yup, will do, thanks for the PR! |
ah I ll add sensors.md in nav bar. A few other doc pages are not in the github.io site as well - docker, unity, and everything in wiki. |
No description provided.