1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Hardware;
using Tango.PMR.Printing;
using Tango.PMR.Stubs;
using Tango.Stubs.UI;
public void OnExecute(StubManager stubManager)
{
//SystemResetRequest systemResetRequest = new SystemResetRequest();
//var response1 = stubManager.Run<SystemResetResponse>(systemResetRequest);
// stubManager.Run("StubGPIOWriteBitRequest" ,"P", 4, true);//ON
Thread.Sleep(10);
// stubManager.Run("StubGPIOWriteBitRequest" ,"P", 4, false);//OFF
// stubManager.Run("StubGPIOWriteBitRequest" ,"P", 4, true);//ON
UploadHardwareConfigurationRequest uploadHardwareConfigurationRequest = new UploadHardwareConfigurationRequest();
HardwareConfiguration hardwareConfiguration = new HardwareConfiguration();
HardwareMotor hardwareMotor1 = new HardwareMotor();
hardwareMotor1.HardwareMotorType = Tango.PMR.Hardware.HardwareMotorType.MotoRdriving;
hardwareMotor1.MinFrequency = 0;
hardwareMotor1.MaxFrequency = 30000;
hardwareMotor1.SetMicroStep = 1;
hardwareMotor1.MicroStep = 2;
hardwareMotor1.MaxChangeSlope = 500;
hardwareMotor1.HighLengthMicroSecond = 0;
hardwareMotor1.SpeedMaster = false;
hardwareMotor1.PulsePerRound = 200;
hardwareMotor1.PulleyRadius = 1.3;
hardwareMotor1.ConfigWord = 0;
hardwareMotor1.DirectionThreadWize = true;
hardwareMotor1.KvalHold = 0x28;
hardwareMotor1.KvalRun = 0x5f;
hardwareMotor1.KvalAcc = 0x5f;
hardwareMotor1.KvalDec = 0x5f;
hardwareMotor1.OverCurrentThreshold = 7;
hardwareMotor1.StallThreshold = 0;
hardwareMotor1.ThermalCompensationFactor = 0;
hardwareMotor1.LowSpeedOptimization = false;
hardwareMotor1.StSlp = 6;
hardwareMotor1.IntSpd = 0x44B8;
hardwareMotor1.FnSlpAcc = 0x14;
hardwareMotor1.FnSlpDec = 0x14;
hardwareConfiguration.Motors.Add(hardwareMotor1);
stubManager.WriteLine("data.data length = " + hardwareConfiguration.CalculateSize());
uploadHardwareConfigurationRequest.HardwareConfiguration = hardwareConfiguration;
var response = stubManager.Run<UploadHardwareConfigurationResponse>(uploadHardwareConfigurationRequest);
/*Thread.Sleep(5000);
stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 7, false);//OFF
Thread.Sleep(10);
stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 4, true);//ON
Thread.Sleep(10);
stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 4, false);//OFF
Thread.Sleep(10);
stubManager.Run("StubGPIOWriteBitRequest" ,"Q", 4, true);//ON
*/
}
|