aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-01-16 13:15:52 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-01-16 13:15:52 +0200
commitff183d99def579aeaaee06d89ad6bbbfa47c4107 (patch)
treebbf0e58eae9f7155afc4f272c8b59b75688ad792 /Software/Visual_Studio
parentc5dba8cec3db88733ee8e1c206c518e27974f867 (diff)
downloadTango-ff183d99def579aeaaee06d89ad6bbbfa47c4107.tar.gz
Tango-ff183d99def579aeaaee06d89ad6bbbfa47c4107.zip
Implemented velocity graph on technician module using mouse position.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml32
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs1
-rw-r--r--Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs3
-rw-r--r--Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj2
-rw-r--r--Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsResponse.cs39
6 files changed, 83 insertions, 11 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs
index 5b28916ec..c3cf7386e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs
@@ -82,9 +82,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
TemperatureController = new GraphController();
PressureController = new GraphController();
+ VelocityController = new GraphController();
_controllers.Add(TemperatureController);
_controllers.Add(PressureController);
+ _controllers.Add(VelocityController);
var module = moduleLoader.UserModules.SingleOrDefault(x => x is TechnicianModule) as TechnicianModule;
@@ -126,8 +128,9 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="data">The data.</param>
private void MachineOperator_SensorsDataAvailable(object sender, PushSensorsResponse data)
{
- TemperatureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray());
- PressureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray());
+ TemperatureController.PushData(data.Temperature.ToArray());
+ PressureController.PushData(data.Temperature.ToArray());
+ VelocityController.PushData(data.Velocity.ToArray());
}
#endregion
@@ -174,6 +177,16 @@ namespace Tango.MachineStudio.Technician.ViewModels
set { _pressureController = value; RaisePropertyChanged(nameof(PressureController)); }
}
+ private GraphController _velocityController;
+ /// <summary>
+ /// Gets or sets the velocity sensor graph controller .
+ /// </summary>
+ public GraphController VelocityController
+ {
+ get { return _velocityController; }
+ set { _velocityController = value; RaisePropertyChanged(nameof(VelocityController)); }
+ }
+
#endregion
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml
index 2e074ec3c..63feae2f3 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml
@@ -129,6 +129,38 @@
</Border>
</Grid>
</ContentControl>
+
+ <!--Velocity-->
+ <ContentControl Grid.Column="2" Style="{StaticResource graphContent}" Margin="0 0 5 5" MinHeight="5">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="40"/>
+ <ColumnDefinition Width="438*"/>
+ </Grid.ColumnDefinitions>
+
+ <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1">
+ <StackPanel Orientation="Horizontal">
+ <components:YAxisScroll Interval="6" Graph="{Binding ElementName=graphVelocity}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll>
+ <components:YAxisTicks SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=graphVelocity}"></components:YAxisTicks>
+ </StackPanel>
+ </Border>
+ <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0">
+ <graphEx:RealTimeGraphExLineScroll x:Name="graphVelocity" Controller="{Binding VelocityController}" Antialiased="True" RefreshRate="30" MaxPoints="{Binding GraphSeconds,Converter={StaticResource secondsToPoints}, ConverterParameter=1}" Minimum="0" Maximum="1080" FillGraph="True" Fill="#70002BFF" Stroke="#0500FF">
+ <graphEx:RealTimeGraphExLineScroll.Components>
+ <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" />
+ <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines>
+ </graphEx:RealTimeGraphExLineScroll.Components>
+ <graphEx:RealTimeGraphExLineScroll.InnerContent>
+ <Grid>
+ <Label Style="{StaticResource graphLabel}">
+ VELOCITY
+ </Label>
+ </Grid>
+ </graphEx:RealTimeGraphExLineScroll.InnerContent>
+ </graphEx:RealTimeGraphExLineScroll>
+ </Border>
+ </Grid>
+ </ContentControl>
</Grid>
<Grid Grid.Row="1">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs
index 4727a3603..c94c26414 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs
@@ -31,6 +31,7 @@ namespace Tango.MachineStudio.Technician.Views
_syncManager = new SyncManager();
_syncManager.AddGraph(graphTemperature);
_syncManager.AddGraph(graphPressure);
+ _syncManager.AddGraph(graphVelocity);
_syncManager.RefreshRate = 30;
_syncManager.Start();
}
diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
index d07c526c6..fe4a994e6 100644
--- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
+++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
@@ -15,6 +15,7 @@ using Tango.Core.Commands;
using Tango.Transport;
using Tango.PMR.Integration;
using Tango.PMR.Diagnostics;
+using System.Windows.Forms;
namespace Tango.Emulations.Emulators
{
@@ -110,6 +111,8 @@ namespace Tango.Emulations.Emulators
res.Temperature.Add((int)(150 + 75 * Math.Sin(2 * 3.14 * 10 * value)));
}
+ res.Velocity.Add(Cursor.Position.Y);
+
Transporter.SendResponse<PushSensorsResponse>(res, container.Token);
Thread.Sleep(10);
}
diff --git a/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj b/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj
index 477d7f983..d76a547d0 100644
--- a/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj
+++ b/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj
@@ -36,6 +36,8 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsResponse.cs
index 5ffacccc9..205665e69 100644
--- a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsResponse.cs
+++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushSensorsResponse.cs
@@ -23,13 +23,13 @@ namespace Tango.PMR.Diagnostics {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChlQdXNoU2Vuc29yc1Jlc3BvbnNlLnByb3RvEhVUYW5nby5QTVIuRGlhZ25v",
- "c3RpY3MiKgoTUHVzaFNlbnNvcnNSZXNwb25zZRITCgtUZW1wZXJhdHVyZRgB",
- "IAMoBUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90",
- "bzM="));
+ "c3RpY3MiPAoTUHVzaFNlbnNvcnNSZXNwb25zZRITCgtUZW1wZXJhdHVyZRgB",
+ "IAMoARIQCghWZWxvY2l0eRgCIAMoAUIhCh9jb20udHdpbmUudGFuZ28ucG1y",
+ "LmRpYWdub3N0aWNzYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushSensorsResponse), global::Tango.PMR.Diagnostics.PushSensorsResponse.Parser, new[]{ "Temperature" }, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushSensorsResponse), global::Tango.PMR.Diagnostics.PushSensorsResponse.Parser, new[]{ "Temperature", "Velocity" }, null, null, null)
}));
}
#endregion
@@ -61,6 +61,7 @@ namespace Tango.PMR.Diagnostics {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public PushSensorsResponse(PushSensorsResponse other) : this() {
temperature_ = other.temperature_.Clone();
+ velocity_ = other.velocity_.Clone();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -70,14 +71,24 @@ namespace Tango.PMR.Diagnostics {
/// <summary>Field number for the "Temperature" field.</summary>
public const int TemperatureFieldNumber = 1;
- private static readonly pb::FieldCodec<int> _repeated_temperature_codec
- = pb::FieldCodec.ForInt32(10);
- private readonly pbc::RepeatedField<int> temperature_ = new pbc::RepeatedField<int>();
+ private static readonly pb::FieldCodec<double> _repeated_temperature_codec
+ = pb::FieldCodec.ForDouble(10);
+ private readonly pbc::RepeatedField<double> temperature_ = new pbc::RepeatedField<double>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public pbc::RepeatedField<int> Temperature {
+ public pbc::RepeatedField<double> Temperature {
get { return temperature_; }
}
+ /// <summary>Field number for the "Velocity" field.</summary>
+ public const int VelocityFieldNumber = 2;
+ private static readonly pb::FieldCodec<double> _repeated_velocity_codec
+ = pb::FieldCodec.ForDouble(18);
+ private readonly pbc::RepeatedField<double> velocity_ = new pbc::RepeatedField<double>();
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ public pbc::RepeatedField<double> Velocity {
+ get { return velocity_; }
+ }
+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as PushSensorsResponse);
@@ -92,6 +103,7 @@ namespace Tango.PMR.Diagnostics {
return true;
}
if(!temperature_.Equals(other.temperature_)) return false;
+ if(!velocity_.Equals(other.velocity_)) return false;
return true;
}
@@ -99,6 +111,7 @@ namespace Tango.PMR.Diagnostics {
public override int GetHashCode() {
int hash = 1;
hash ^= temperature_.GetHashCode();
+ hash ^= velocity_.GetHashCode();
return hash;
}
@@ -110,12 +123,14 @@ namespace Tango.PMR.Diagnostics {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
temperature_.WriteTo(output, _repeated_temperature_codec);
+ velocity_.WriteTo(output, _repeated_velocity_codec);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += temperature_.CalculateSize(_repeated_temperature_codec);
+ size += velocity_.CalculateSize(_repeated_velocity_codec);
return size;
}
@@ -125,6 +140,7 @@ namespace Tango.PMR.Diagnostics {
return;
}
temperature_.Add(other.temperature_);
+ velocity_.Add(other.velocity_);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -136,10 +152,15 @@ namespace Tango.PMR.Diagnostics {
input.SkipLastField();
break;
case 10:
- case 8: {
+ case 9: {
temperature_.AddEntriesFrom(input, _repeated_temperature_codec);
break;
}
+ case 18:
+ case 17: {
+ velocity_.AddEntriesFrom(input, _repeated_velocity_codec);
+ break;
+ }
}
}
}