diff --git a/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml b/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml
index 0f8f2f3..7bb255b 100644
--- a/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml
+++ b/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml
@@ -8,10 +8,10 @@
d:DesignHeight="450" d:DesignWidth="800">
-
+
@@ -30,5 +30,15 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml.cs b/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml.cs
index 271f794..08b7a69 100644
--- a/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml.cs
+++ b/ADIS_Csharp/RobotClientWpf/Views/ConfigView.xaml.cs
@@ -61,5 +61,20 @@ namespace RobotClientWpf.Views
log.Error("challenge object is null");
}
}
+
+ private void btnStartCalibration_Click(object sender, RoutedEventArgs e)
+ {
+ this.challenge?.RobotMobile.LineSensor.StartCalibration(true);
+ }
+
+ private void btnEndCalibration_Click(object sender, RoutedEventArgs e)
+ {
+ this.challenge?.RobotMobile.LineSensor.StartCalibration(false);
+ }
+
+ private void btnGetCalibrationData_Click(object sender, RoutedEventArgs e)
+ {
+ this.challenge?.RobotMobile.LineSensor.GetCalibrationData();
+ }
}
}
diff --git a/ADIS_Csharp/RobotClientWpf/Views/MainView.xaml.cs b/ADIS_Csharp/RobotClientWpf/Views/MainView.xaml.cs
index 44f7ffd..8c9a3f5 100644
--- a/ADIS_Csharp/RobotClientWpf/Views/MainView.xaml.cs
+++ b/ADIS_Csharp/RobotClientWpf/Views/MainView.xaml.cs
@@ -12,8 +12,8 @@ namespace RobotClientWpf.Views
{
private static readonly NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
private ChallengeFactory? challenge;
- private const int AMOUNT_SPEED_ADDED_PER_CLICK = 10;
- private const int TURN_ANGLE_PER_CLICK = 25;
+ private const int AMOUNT_SPEED_ADDED_PER_CLICK = 500;
+ private const int TURN_ANGLE_PER_CLICK = 30;
public MainView()
{
diff --git a/ADIS_Csharp/RobotLib/Movement/DevLineSensor.cs b/ADIS_Csharp/RobotLib/Movement/DevLineSensor.cs
new file mode 100644
index 0000000..695478c
--- /dev/null
+++ b/ADIS_Csharp/RobotLib/Movement/DevLineSensor.cs
@@ -0,0 +1,27 @@
+using RobotLib.Communication;
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+
+namespace RobotLib.Movement
+{
+ public class DevLineSensor : DevBase
+ {
+ private const string TOPIC_ROBO_CALIB_CMD = "/mobile/cmd/line_sens/calib";
+ private const string TOPIC_ROBO_GET_CALIB = "/mobile/cmd/line_sens/get_calib";
+ private const string TOPIC_ROBO_CALIB_STATE = "/mobile/state/line_sens/calib_data";
+
+ public DevLineSensor(IPublisherSubscriber com) : base(com, new List() { }) { }
+
+ public void GetCalibrationData()
+ {
+ base.SendMessage(TOPIC_ROBO_GET_CALIB, true.ToString());
+ }
+
+ public void StartCalibration(bool start)
+ {
+ string payload = JsonSerializer.Serialize(new Dictionary() { { "start", start } });
+ base.SendMessage(TOPIC_ROBO_CALIB_CMD, payload);
+ }
+ }
+}
diff --git a/ADIS_Csharp/RobotLib/Robot.cs b/ADIS_Csharp/RobotLib/Robot.cs
index 33c0431..7a8ccec 100644
--- a/ADIS_Csharp/RobotLib/Robot.cs
+++ b/ADIS_Csharp/RobotLib/Robot.cs
@@ -13,6 +13,7 @@ namespace RobotLib
//Buzzer = new DevBuzzer(Com);
//Battery = new DevBattery(Com);
SplitFlap = new DevSplitFlap(com);
+ LineSensor = new DevLineSensor(com);
Movement = new DevMovement(com);
Timer timer = new Timer(TimerCallback);
@@ -25,6 +26,7 @@ namespace RobotLib
//public DevBattery Battery { get; }
public DevSplitFlap SplitFlap { get; }
public DevMovement Movement { get; }
+ public DevLineSensor LineSensor { get; }
public void Connect(string host, int port)
{