Skip to content
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 px4 connection for wsl 2. #3603

Merged
merged 44 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
dd27458
fix px4 connection for wsl 2.
lovettchris Apr 16, 2021
b30ee91
enable throttling to 250 hz and fix bug in lockstep, should not send …
lovettchris Apr 16, 2021
1f3368b
add mavlink 2 support
lovettchris Apr 16, 2021
1c15604
make test terminate when it finds a problem, so you can capture the r…
lovettchris Apr 16, 2021
006d4e2
Merge settings improvements from PR 3546
lovettchris Apr 16, 2021
3b82fef
fix build and update docs.
lovettchris Apr 16, 2021
30ab123
fix unreal build
lovettchris Apr 16, 2021
b0b5de3
compute checksum on telemetry messages.
lovettchris Apr 17, 2021
71ff206
fix compiler warning.
lovettchris Apr 17, 2021
24d1bb6
Move telemetry to separate thread to get it out of the update() loop.…
lovettchris Apr 18, 2021
62048e5
guard telemetry variables with a mutex.
lovettchris Apr 18, 2021
938046f
make actuator delay an average
lovettchris Apr 18, 2021
9608bb4
add missing script files
lovettchris Apr 18, 2021
cb46217
fix pwsh support
lovettchris Apr 18, 2021
cfc7eec
add update_time to mavlinktelemetry
lovettchris Apr 18, 2021
642539a
Merge branch 'master' into clovett/mavlinkfixes
lovettchris Apr 19, 2021
f943770
add requirements.txt for pythonclient.
lovettchris Apr 20, 2021
92f3f3f
add info on how to use mavlink logs and px4 log viewer to debug a bad…
lovettchris Apr 20, 2021
bf71a53
Merge branch 'clovett/mavlinkfixes' of github.com:microsoft/AirSim in…
lovettchris Apr 20, 2021
db62395
Merge branch 'master' into clovett/mavlinkfixes
lovettchris Apr 20, 2021
cbdff5b
fix install link
lovettchris Apr 20, 2021
d48f5c0
add link to logging.
lovettchris Apr 20, 2021
65c3b4b
Merge branch 'master' into clovett/mavlinkfixes
lovettchris Apr 24, 2021
f7d2fea
fix drone server wsl2 connection.
lovettchris Apr 24, 2021
ad5534a
CR feedback.
lovettchris Apr 27, 2021
3d8f8b2
fix ros wrapper compile.
lovettchris Apr 27, 2021
e894d3a
script to test flying up high
lovettchris Apr 28, 2021
9d2012e
merge master
lovettchris Apr 28, 2021
0b81265
fix missing stopLoggingReceiveMessage
lovettchris Apr 28, 2021
f72de5f
nasty merge with master
lovettchris Apr 28, 2021
62b08da
consistency with logviewer logging and add docs.
lovettchris Apr 28, 2021
6db1f21
Pause physics update loop while waiting for actuator controls during …
lovettchris Apr 28, 2021
6fdb9b7
add missing update
lovettchris Apr 28, 2021
d28ace6
cleanup unnecessary cmake messages.
lovettchris Apr 28, 2021
f28f32b
Fix code formatting
lovettchris Apr 29, 2021
b717da4
fix typos.
lovettchris Apr 29, 2021
609031b
fix typo in udpate_rate
lovettchris Apr 29, 2021
def8bc0
fix bugs.
lovettchris Apr 30, 2021
c04924f
clang format
lovettchris Apr 30, 2021
6c747c7
cr fixes
lovettchris Apr 30, 2021
ade1289
Merge branch 'master' into clovett/mavlinkfixes
lovettchris May 3, 2021
e434f41
Add info on lockstep and steppable clock.
lovettchris May 3, 2021
ef5a6a6
add lockstep to toc
lovettchris May 4, 2021
6db5c7f
Make sure each buffer is zero'd out before reading bytes. Remove unn…
lovettchris May 5, 2021
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
165 changes: 61 additions & 104 deletions AirLib/include/common/AirSimSettings.hpp

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions AirLib/include/common/common_utils/FileSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ class FileSystem
break;
}
if (i < 0) return "";
auto ui = static_cast<uint>(i);
return str.substr(ui, len - ui);
return str.substr(i, len - i);
}

static std::string getLogFolderPath(bool folder_timestamp, const std::string& parent = "")
Expand Down
2 changes: 1 addition & 1 deletion AirLib/include/physics/PhysicsEngineBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PhysicsEngineBase : public UpdatableObject {
virtual void erase_remove(TUpdatableObjectPtr obj) {
members_.erase(std::remove(members_.begin(), members_.end(), obj), members_.end()); }

virtual void setWind(const Vector3r& wind) {};
virtual void setWind(const Vector3r& wind) { unused(wind); };

private:
MembersContainer members_;
Expand Down
2 changes: 1 addition & 1 deletion AirLib/include/sensors/SensorBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class SensorBase : public UpdatableObject {

private:
//ground truth can be shared between many sensors
GroundTruth ground_truth_;
GroundTruth ground_truth_ = { nullptr, nullptr };
std::string name_ = "";
};

Expand Down
21 changes: 10 additions & 11 deletions AirLib/include/sensors/SensorFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ class SensorFactory {
public:

// creates one sensor from settings
virtual std::unique_ptr<SensorBase> createSensorFromSettings(
virtual std::shared_ptr<SensorBase> createSensorFromSettings(
const AirSimSettings::SensorSetting* sensor_setting) const
{
switch (sensor_setting->sensor_type) {
case SensorBase::SensorType::Imu:
return std::unique_ptr<ImuSimple>(new ImuSimple(*static_cast<const AirSimSettings::ImuSetting*>(sensor_setting)));
return std::shared_ptr<ImuSimple>(new ImuSimple(*static_cast<const AirSimSettings::ImuSetting*>(sensor_setting)));
case SensorBase::SensorType::Magnetometer:
return std::unique_ptr<MagnetometerSimple>(new MagnetometerSimple(*static_cast<const AirSimSettings::MagnetometerSetting*>(sensor_setting)));
return std::shared_ptr<MagnetometerSimple>(new MagnetometerSimple(*static_cast<const AirSimSettings::MagnetometerSetting*>(sensor_setting)));
case SensorBase::SensorType::Gps:
return std::unique_ptr<GpsSimple>(new GpsSimple(*static_cast<const AirSimSettings::GpsSetting*>(sensor_setting)));
return std::shared_ptr<GpsSimple>(new GpsSimple(*static_cast<const AirSimSettings::GpsSetting*>(sensor_setting)));
case SensorBase::SensorType::Barometer:
return std::unique_ptr<BarometerSimple>(new BarometerSimple(*static_cast<const AirSimSettings::BarometerSetting*>(sensor_setting)));
return std::shared_ptr<BarometerSimple>(new BarometerSimple(*static_cast<const AirSimSettings::BarometerSetting*>(sensor_setting)));
default:
throw new std::invalid_argument("Unexpected sensor type");
}
}

// creates sensor-collection
virtual void createSensorsFromSettings(
const std::map<std::string, std::unique_ptr<AirSimSettings::SensorSetting>>& sensors_settings,
const std::map<std::string, std::shared_ptr<AirSimSettings::SensorSetting>>& sensors_settings,
SensorCollection& sensors,
vector<unique_ptr<SensorBase>>& sensor_storage) const
vector<shared_ptr<SensorBase>>& sensor_storage) const
{
for (const auto& sensor_setting_pair : sensors_settings) {
const AirSimSettings::SensorSetting* sensor_setting = sensor_setting_pair.second.get();
Expand All @@ -49,11 +49,10 @@ class SensorFactory {
if (sensor_setting == nullptr || !sensor_setting->enabled)
continue;

std::unique_ptr<SensorBase> sensor = createSensorFromSettings(sensor_setting);
std::shared_ptr<SensorBase> sensor = createSensorFromSettings(sensor_setting);
if (sensor) {
SensorBase* sensor_temp = sensor.get();
sensor_storage.push_back(std::move(sensor));
sensors.insert(sensor_temp, sensor_setting->sensor_type);
sensor_storage.push_back(sensor);
sensors.insert(sensor.get(), sensor_setting->sensor_type);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions AirLib/include/sensors/barometer/BarometerSimple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BarometerSimple : public BarometerBase {
//GM process that would do random walk for pressure factor
pressure_factor_.initialize(params_.pressure_factor_tau, params_.pressure_factor_sigma, 0);

uncorrelated_noise_ = RandomGeneratorGausianR(0.0f, params_.unnorrelated_noise_sigma);
uncorrelated_noise_ = RandomGeneratorGausianR(0.0f, params_.uncorrelated_noise_sigma);
//correlated_noise_.initialize(params_.correlated_noise_tau, params_.correlated_noise_sigma, 0.0f);

//initialize frequency limiter
Expand Down Expand Up @@ -76,7 +76,7 @@ class BarometerSimple : public BarometerBase {
auto altitude = ground_truth.environment->getState().geo_point.altitude;
auto pressure = EarthUtils::getStandardPressure(altitude);

//add drift in pressure, about 10m change per hour
//add drift in pressure, about 10m change per hour using default settings.
pressure_factor_.update();
pressure += pressure * pressure_factor_.getOutput();

Expand Down
15 changes: 11 additions & 4 deletions AirLib/include/sensors/barometer/BarometerSimpleParams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define msr_airlib_BarometerSimpleParams_hpp

#include "common/Common.hpp"
#include "common/AirSimSettings.hpp"


namespace msr { namespace airlib {
Expand Down Expand Up @@ -33,14 +34,14 @@ struct BarometerSimpleParams {

real_T correlated_noise_sigma = 0.27f;
real_T correlated_noise_tau = 0.87f;
real_T unnorrelated_noise_sigma = 0.24f;
real_T uncorrelated_noise_sigma = 0.24f;
*/

//Experiments for MEAS MS56112 sensor shows 0.021mbar, datasheet has resoultion of 0.027mbar @ 1024
//http://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=MS5611-01BA03&DocType=Data+Sheet&DocLang=English
real_T unnorrelated_noise_sigma = 0.027f * 100;
real_T uncorrelated_noise_sigma = 0.027f * 100;
//jMavSim uses below
//real_T unnorrelated_noise_sigma = 0.1f;
//real_T uncorrelated_noise_sigma = 0.1f;

//see PX4 param reference for EKF: https://dev.px4.io/en/advanced/parameter_reference.html
real_T update_latency = 0.0f; //sec
Expand All @@ -49,7 +50,13 @@ struct BarometerSimpleParams {

void initializeFromSettings(const AirSimSettings::BarometerSetting& settings)
{
unused(settings);
const auto& json = settings.settings;
pressure_factor_sigma = json.getFloat("PressureFactorSigma", pressure_factor_sigma);
pressure_factor_tau = json.getFloat("PressureFactorTau", pressure_factor_tau);
uncorrelated_noise_sigma = json.getFloat("UncorrelatedNoiseSigma", uncorrelated_noise_sigma);
update_latency = json.getFloat("UpdateLatency", update_latency);
update_frequency = json.getFloat("UpdateFrequency", update_frequency);
startup_delay = json.getFloat("StartupDelay", startup_delay);
}
};

Expand Down
2 changes: 1 addition & 1 deletion AirLib/include/sensors/distance/DistanceSimple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DistanceSimple : public DistanceBase {
// initialize params
params_.initializeFromSettings(setting);

uncorrelated_noise_ = RandomGeneratorGausianR(0.0f, params_.unnorrelated_noise_sigma);
uncorrelated_noise_ = RandomGeneratorGausianR(0.0f, params_.uncorrelated_noise_sigma);
//correlated_noise_.initialize(params_.correlated_noise_tau, params_.correlated_noise_sigma, 0.0f);


Expand Down
25 changes: 14 additions & 11 deletions AirLib/include/sensors/distance/DistanceSimpleParams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ struct DistanceSimpleParams {

real_T correlated_noise_sigma = 0.27f;
real_T correlated_noise_tau = 0.87f;
real_T unnorrelated_noise_sigma = 0.24f;
real_T uncorrelated_noise_sigma = 0.24f;

*/
//TODO: update sigma based on documentation, maybe as a function increasing with measured distance
real_T unnorrelated_noise_sigma = 0.002f * 100;
real_T uncorrelated_noise_sigma = 0.002f * 100;
//jMavSim uses below
//real_T unnorrelated_noise_sigma = 0.1f;
//real_T uncorrelated_noise_sigma = 0.1f;

//see PX4 param reference for EKF: https://dev.px4.io/en/advanced/parameter_reference.html
real_T update_latency = 0.0f; //sec
Expand All @@ -46,14 +46,17 @@ struct DistanceSimpleParams {

void initializeFromSettings(const AirSimSettings::DistanceSetting& settings)
{
std::string simmode_name = AirSimSettings::singleton().simmode_name;
const auto& settings_json = settings.settings;
min_distance = settings_json.getFloat("MinDistance", min_distance);
max_distance = settings_json.getFloat("MaxDistance", max_distance);
draw_debug_points = settings_json.getBool("DrawDebugPoints", draw_debug_points);

min_distance = settings.min_distance;
max_distance = settings.max_distance;
auto position = AirSimSettings::createVectorSetting(settings_json, VectorMath::nanVector());
auto rotation = AirSimSettings::createRotationSetting(settings_json, AirSimSettings::Rotation::nanRotation());

draw_debug_points = settings.draw_debug_points;
std::string simmode_name = AirSimSettings::singleton().simmode_name;

relative_pose.position = settings.position;
relative_pose.position = position;
if (std::isnan(relative_pose.position.x()))
relative_pose.position.x() = 0;
if (std::isnan(relative_pose.position.y()))
Expand All @@ -66,9 +69,9 @@ struct DistanceSimpleParams {
}

float pitch, roll, yaw;
pitch = !std::isnan(settings.rotation.pitch) ? settings.rotation.pitch : 0;
roll = !std::isnan(settings.rotation.roll) ? settings.rotation.roll : 0;
yaw = !std::isnan(settings.rotation.yaw) ? settings.rotation.yaw : 0;
pitch = !std::isnan(rotation.pitch) ? rotation.pitch : 0;
roll = !std::isnan(rotation.roll) ? rotation.roll : 0;
yaw = !std::isnan(rotation.yaw) ? rotation.yaw : 0;
relative_pose.orientation = VectorMath::toQuaternion(
Utils::degreesToRadians(pitch), //pitch - rotation around Y axis
Utils::degreesToRadians(roll), //roll - rotation around X axis
Expand Down
15 changes: 13 additions & 2 deletions AirLib/include/sensors/gps/GpsSimpleParams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace msr { namespace airlib {
struct GpsSimpleParams {
real_T eph_time_constant = 0.9f, epv_time_constant = 0.9f;
real_T eph_initial = 100.0f, epv_initial = 100.0f; //initially fully diluted positions
real_T eph_final = 0.3f, epv_final = 0.4f;
real_T eph_final = 0.1f, epv_final = 0.1f; // PX4 won't converge GPS sensor fusion until we get to 10% accuracty.
real_T eph_min_3d = 3.0f, eph_min_2d = 4.0f;

real_T update_latency = 0.2f; //sec
Expand All @@ -21,7 +21,18 @@ struct GpsSimpleParams {

void initializeFromSettings(const AirSimSettings::GpsSetting& settings)
{
unused(settings);
const auto& json = settings.settings;
eph_time_constant = json.getFloat("EPH_TimeConstant", eph_time_constant);
epv_time_constant = json.getFloat("EPV_TimeConstant", epv_time_constant);
eph_initial = json.getFloat("EphInitial", eph_initial);
epv_initial = json.getFloat("EpvInitial", epv_initial);
eph_final = json.getFloat("EphFinal", eph_final);
epv_final = json.getFloat("EpvFinal", epv_final);
eph_min_3d = json.getFloat("EphMin3d", eph_min_3d);
eph_min_2d = json.getFloat("EphMin2d", eph_min_2d);
update_latency = json.getFloat("UpdateLatency", update_latency);
update_frequency = json.getFloat("UpdateFrequency", update_frequency);
startup_delay = json.getFloat("StartupDelay", startup_delay);
}
};

Expand Down
22 changes: 20 additions & 2 deletions AirLib/include/sensors/imu/ImuSimpleParams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct ImuSimpleParams {
For Allan Variance/Deviation plots see http://www.invensense.com/wp-content/uploads/2015/02/MPU-3300-Datasheet.pdf
*/
struct Gyroscope {
//angule random walk (ARW)
//angular random walk (ARW)
real_T arw = 0.30f / sqrt(3600.0f) * M_PIf / 180; //deg/sqrt(hour) converted to rad/sqrt(sec)
//Bias Stability (tau = 500s)
real_T tau = 500;
Expand All @@ -46,7 +46,25 @@ struct ImuSimpleParams {

void initializeFromSettings(const AirSimSettings::ImuSetting& settings)
{
unused(settings);
const auto& json = settings.settings;
float arw = json.getFloat("AngularRandomWalk", Utils::nan<float>());
if (!std::isnan(arw)) {
gyro.arw = arw / sqrt(3600.0f) * M_PIf / 180; // //deg/sqrt(hour) converted to rad/sqrt(sec)
}
gyro.tau = json.getFloat("GyroBiasStabilityTau", gyro.tau);
float bias_stability = json.getFloat("GyroBiasStability", Utils::nan<float>());
if (!std::isnan(bias_stability)) {
gyro.bias_stability = bias_stability / 3600 * M_PIf / 180; //deg/hr converted to rad/sec
}
auto vrw = json.getFloat("VelocityRandomWalk", Utils::nan<float>());
if (!std::isnan(vrw)) {
accel.vrw = vrw * EarthUtils::Gravity / 1.0E3f; //mg converted to m/s^2
}
accel.tau = json.getFloat("AccelBiasStabilityTau", accel.tau);
bias_stability = json.getFloat("AccelBiasStability", Utils::nan<float>());
if (!std::isnan(bias_stability)) {
accel.bias_stability = bias_stability * 1E-6f * 9.80665f; //ug converted to m/s^2
lovettchris marked this conversation as resolved.
Show resolved Hide resolved
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ struct MagnetometerSimpleParams {

void initializeFromSettings(const AirSimSettings::MagnetometerSetting& settings)
{
unused(settings);
const auto& json = settings.settings;
float noise = json.getFloat("NoiseSigma", noise_sigma.x());
noise_sigma = Vector3r(noise, noise, noise);
scale_factor = json.getFloat("ScaleFactor", scale_factor);
float bias = json.getFloat("NoiseBias", noise_bias.x());
noise_bias = Vector3r(bias, bias, bias);
update_latency = json.getFloat("UpdateLatency", update_latency);
update_frequency = json.getFloat("UpdateFrequency", update_frequency);
startup_delay = json.getFloat("StartupDelay", startup_delay);
}
};

Expand Down
8 changes: 2 additions & 6 deletions AirLib/include/vehicles/car/api/CarApiBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ class CarApiBase : public VehicleApiBase {

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;
const auto& sensor_settings = vehicle_setting->sensors;

sensor_factory_->createSensorsFromSettings(sensor_settings, sensors_, sensor_storage_);
}
Expand All @@ -149,7 +145,7 @@ class CarApiBase : public VehicleApiBase {

std::shared_ptr<const SensorFactory> sensor_factory_;
SensorCollection sensors_; //maintains sensor type indexed collection of sensors
vector<unique_ptr<SensorBase>> sensor_storage_; //RAII for created sensors
vector<shared_ptr<SensorBase>> sensor_storage_; //RAII for created sensors
lovettchris marked this conversation as resolved.
Show resolved Hide resolved

protected:
virtual void resetImplementation() override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ class ArduRoverApi : public CarApiBase {
}

Utils::log(Utils::stringf("Using UDP port %d, local IP %s, remote IP %s for sending sensor data", port_, connection_info_.local_host_ip.c_str(), ip_.c_str()), Utils::kLogLevelInfo);
Utils::log(Utils::stringf("Using UDP port %d for receiving rotor power", connection_info_.control_port, connection_info_.local_host_ip.c_str(), ip_.c_str()), Utils::kLogLevelInfo);
Utils::log(Utils::stringf("Using UDP port %d for receiving rotor power", connection_info_.control_port_local, connection_info_.local_host_ip.c_str(), ip_.c_str()), Utils::kLogLevelInfo);

udpSocket_ = std::make_shared<mavlinkcom::UdpSocket>();
udpSocket_->bind(connection_info_.local_host_ip, connection_info_.control_port);
udpSocket_->bind(connection_info_.local_host_ip, connection_info_.control_port_local);
}

private:
Expand Down
8 changes: 2 additions & 6 deletions AirLib/include/vehicles/multirotor/MultiRotorParams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@ class MultiRotorParams {

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;
const auto& sensor_settings = vehicle_setting->sensors;

getSensorFactory()->createSensorsFromSettings(sensor_settings, sensors_, sensor_storage_);
}
Expand Down Expand Up @@ -412,7 +408,7 @@ class MultiRotorParams {
private:
Params params_;
SensorCollection sensors_; //maintains sensor type indexed collection of sensors
vector<unique_ptr<SensorBase>> sensor_storage_; //RAII for created sensors
vector<shared_ptr<SensorBase>> sensor_storage_; //RAII for created sensors
};

}} //namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ class ArduCopterApi : public MultirotorApiBase {
}

Utils::log(Utils::stringf("Using UDP port %d, local IP %s, remote IP %s for sending sensor data", port_, connection_info_.local_host_ip.c_str(), ip_.c_str()), Utils::kLogLevelInfo);
Utils::log(Utils::stringf("Using UDP port %d for receiving rotor power", connection_info_.control_port, connection_info_.local_host_ip.c_str(), ip_.c_str()), Utils::kLogLevelInfo);
Utils::log(Utils::stringf("Using UDP port %d for receiving rotor power", connection_info_.control_port_local, connection_info_.local_host_ip.c_str(), ip_.c_str()), Utils::kLogLevelInfo);

udpSocket_ = std::make_shared<mavlinkcom::UdpSocket>();
udpSocket_->bind(connection_info_.local_host_ip, connection_info_.control_port);
udpSocket_->bind(connection_info_.local_host_ip, connection_info_.control_port_local);
}

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ class ArduCopterSoloApi : public MavLinkMultirotorApi
}

Utils::log(Utils::stringf("Using UDP port %d, local IP %s, remote IP %s for sending sensor data", port, connection_info_.local_host_ip.c_str(), ip.c_str()), Utils::kLogLevelInfo);
Utils::log(Utils::stringf("Using UDP port %d for receiving rotor power", connection_info_.control_port, connection_info_.local_host_ip.c_str(), ip.c_str()), Utils::kLogLevelInfo);
Utils::log(Utils::stringf("Using UDP port %d for receiving rotor power", connection_info_.control_port_local, connection_info_.local_host_ip.c_str(), ip.c_str()), Utils::kLogLevelInfo);

udpSocket_ = mavlinkcom::AdHocConnection::connectLocalUdp("ArduCopterSoloConnector", ip, connection_info_.control_port);
udpSocket_ = mavlinkcom::AdHocConnection::connectLocalUdp("ArduCopterSoloConnector", ip, connection_info_.control_port_local);
mavlinkcom::AdHocMessageHandler handler = [this](std::shared_ptr<mavlinkcom::AdHocConnection> connection, const std::vector<uint8_t> &msg) {
this->rotorPowerMessageHandler(connection, msg);
};
Expand Down
Loading