Skip to content

Commit

Permalink
minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed Apr 1, 2017
1 parent ff0b675 commit 72e3aa8
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 33 deletions.
2 changes: 1 addition & 1 deletion AirLib/include/sensors/gps/GpsSimpleParams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct GpsSimpleParams {
real_T eph_final = 0.3f, epv_final = 0.4f;
real_T eph_min_3d = 3.0f, eph_min_2d = 4.0f;

real_T update_latency = 0.1f; //sec
real_T update_latency = 0.2f; //sec
real_T update_frequency = 50; //Hz
real_T startup_delay = 1; //sec
};
Expand Down
4 changes: 2 additions & 2 deletions AirLib/include/vehicles/configs/FlamewheelQuadX.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class FlamewheelQuadX : public MultiRotorParams {
std::vector<real_T> arm_angles(params.rotor_count, 45);

//set up mass
params.mass = 1.935f;
params.mass = 1.635f;
real_T motor_assembly_weight = 0.052f;
real_T box_mass = params.mass - params.rotor_count * motor_assembly_weight;

params.rotor_params.C_T = 0.11f;
params.rotor_params.C_P = 0.047f;
params.rotor_params.max_rpm = 8500;
params.rotor_params.max_rpm = 9500;
params.rotor_params.calculateMaxThrust();
params.linear_drag_coefficient *= 4; // make top speed more real.
params.rotor_params.throttle_boost = 0;
Expand Down
10 changes: 10 additions & 0 deletions LogViewer/LogViewer/Controls/ChartStack.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ public void ClearCharts()

public UIElementCollection Charts { get { return theStack.Children; } }

protected override void OnKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
selecting = false;
Selection.Visibility = Visibility.Collapsed;
e.Handled = true;
}
}

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
Expand All @@ -85,6 +94,7 @@ protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Selection.Width = 1;
Selection.Height = this.ActualHeight;
Selection.Margin = new Thickness(pos.X, 0, 0, 0);
Focus();
this.CaptureMouse();
base.OnMouseLeftButtonDown(e);
}
Expand Down
26 changes: 16 additions & 10 deletions LogViewer/LogViewer/Controls/SimpleLineChart.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,9 @@ public Color LineColor

const double TooltipThreshold = 20;

DataValue FindNearestValue(Point pos, bool ignoreY)
int FindNearestValue(Point pos, bool ignoreY)
{
DataValue found = null;
int found = -1;

// transform top Graph coordinates (which could be constantly changing because of zoom and scrolling.
pos = this.TransformToDescendant(Graph).Transform(pos);
Expand Down Expand Up @@ -658,7 +658,7 @@ DataValue FindNearestValue(Point pos, bool ignoreY)
if (distance < minDistance)
{
minDistance = distance;
found = d;
found = i;
}
}
}
Expand All @@ -674,7 +674,7 @@ DataValue FindNearestValue(Point pos, bool ignoreY)
if (distance < minDistance)
{
minDistance = distance;
found = d;
found = i;
}
}
}
Expand All @@ -685,9 +685,10 @@ DataValue FindNearestValue(Point pos, bool ignoreY)

void UpdatePointer(Point pos)
{
DataValue found = FindNearestValue(pos, false);
if (found != null)
int i = FindNearestValue(pos, false);
if (i >= 0)
{
DataValue found = series.Values[i];
double availableHeight = this.ActualHeight;
double value = found.Y;
Point scaled = scaleTransform.Transform(new Point(found.X, found.Y));
Expand All @@ -709,14 +710,19 @@ internal void HandleZoomTooltip(ChartStack stack, Point mouseDownPos, Point pos)
Point localEndPos = stack.TransformToDescendant(this).Transform(pos);
if (localEndPos.X >= 0 && localEndPos.Y >= 0 && localEndPos.X < this.ActualWidth && localEndPos.Y < this.ActualHeight)
{
DataValue startData = FindNearestValue(localStartPos, true);
DataValue endData = FindNearestValue(localEndPos, true);
if (startData != null && endData != null)
int s = FindNearestValue(localStartPos, true);
int e = FindNearestValue(localEndPos, true);
if (s >= 0 && e >= 0)
{
DataValue startData = series.Values[s];
DataValue endData = series.Values[e];
Point tipPosition = this.TransformToDescendant(Graph).Transform(localEndPos);
double microseconds = endData.X - startData.X;
TimeSpan span = new TimeSpan((long)microseconds * 10);
ShowTip(span.ToString(), tipPosition);
double seconds = span.TotalSeconds;
double diff = endData.Y - startData.Y;
string msg = string.Format("{0:N3} sec, dist={1:N3}, rate={2:N3}, samples={3:N3}", seconds, diff, diff / seconds, e - s);
ShowTip(msg, tipPosition);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions LogViewer/LogViewer/LogViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<SuiteName>PX4 Log Viewer</SuiteName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>32</ApplicationRevision>
<ApplicationRevision>34</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
Expand Down Expand Up @@ -61,7 +61,7 @@
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MyKeyFile)</AssemblyOriginatorKeyFile>
Expand Down
52 changes: 35 additions & 17 deletions MavLinkCom/MavLinkTest/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,32 @@ bool PlayLogCommand::Parse(const std::vector<std::string>& args)
{
if (args.size() <= 0)
return false;


this->_syncParams = false;
this->_fileName = "";

std::string cmd = args[0];
if (cmd == "playlog") {
if (args.size() > 1) {
_fileName = args.at(1);
log_.openForReading(_fileName);
for (size_t i = 1; i < args.size(); i++)
{
std::string arg = args.at(i);
if (arg == "-sync") {
this->_syncParams = true;
}
else if (_fileName == "") {
_fileName = args.at(1);
log_.openForReading(_fileName);
}
else {
printf("Usage: playlog <mavlink_logfile>\n");
return false;
}
return true;
}
else {
printf("Usage: playlog <mavlink_logfile>\n");
}
if (_fileName == "") {
printf("Usage: playlog <mavlink_logfile>\n");
return false;
}
}
return false;
}
Expand Down Expand Up @@ -547,15 +562,16 @@ void PlayLogCommand::Execute(std::shared_ptr<MavLinkVehicle> com)
playback_timestamp = playback_start_timestamp = MavLinkLog::getTimeStamp();
uint16_t last_basemode = -1, last_custommode = -1;

printf("Comparing parameters with recorded log...\n");
std::vector<MavLinkParameter> params;
try {
params = com->getParamList();
}
catch (std::exception e) {
printf("%s\n", e.what());
if (this->_syncParams) {
printf("Comparing parameters with recorded log...\n");
try {
params = com->getParamList();
}
catch (std::exception e) {
printf("%s\n", e.what());
}
}

printf("loading log...\n");

while (log_.read(msg, log_timestamp)) {
Expand Down Expand Up @@ -655,9 +671,11 @@ void PlayLogCommand::Execute(std::shared_ptr<MavLinkVehicle> com)
}
case MavLinkParamValue::kMessageId:
{
MavLinkParamValue param;
param.decode(msg);
SyncParamValue(com, params, param);
if (this->_syncParams) {
MavLinkParamValue param;
param.decode(msg);
SyncParamValue(com, params, param);
}
break;
}
default:
Expand Down
3 changes: 2 additions & 1 deletion MavLinkCom/MavLinkTest/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class PlayLogCommand : public Command
{
public:
PlayLogCommand() {
this->Name = "playlog filename";
this->Name = "playlog filename";
}

virtual bool Parse(const std::vector<std::string>& args);
Expand All @@ -394,6 +394,7 @@ class PlayLogCommand : public Command
float quaternion_[4];
float x, y, z;
std::string _fileName;
bool _syncParams;
};


Expand Down

0 comments on commit 72e3aa8

Please sign in to comment.