2 using System.Collections.Generic;
5 using AnimatGUI.Framework;
9 namespace RobotIOControls
12 public class XBeeCommander : AnimatGUI.DataObjects.Robotics.RemoteControl
14 #region " Attributes "
16 protected string m_strPort =
"";
17 protected int m_iBaudRate = 38400;
26 #region " Attributes "
28 public override string Description {
get {
return "Performs wireless IO using an UartSBee to communicate with the Commander remote control.";} set { }}
29 public override string ButtonImageName {
get {
return "RoboticsGUI.Graphics.XBeeCommanderLarge.gif";}}
30 public override string WorkspaceImageName {
get {
return "RoboticsGUI.Graphics.XBeeCommanderSmall.gif"; } }
31 public override string PartType {
get {
return "XBeeCommander"; }}
32 public override string ModuleName {
get {
return "RoboticsAnimatSim"; } }
34 public virtual string Port
42 SetSimData(
"Port", value,
true);
47 public virtual int BaudRate
56 throw new System.Exception(
"Invalid baud rate specified. Rate: " + value.ToString());
58 SetSimData(
"BaudRate", value.ToString(),
true);
63 public virtual int ChangeSimStepCount
72 throw new System.Exception(
"Invalid pulse sim step count specified. Rate: " + value.ToString());
74 SetSimData(
"ChangeSimStepCount", value.ToString(),
true);
75 m_iChangeSimStepCount = value;
83 public XBeeCommander(AnimatGUI.Framework.DataObject doParent)
86 m_strName =
"XBee Commander";
88 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"WalkV",
"Walk Vertical",
"",
"", -128, 128));
89 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"WalkVStart",
"Walk Vertical Start",
"",
"", -128, 128));
90 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"WalkVStop",
"Walk Vertical Stop",
"",
"", -128, 128));
92 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"WalkH",
"Walk Horizontal",
"",
"", -128, 128));
93 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"WalkHStart",
"Walk Horizontal Start",
"",
"", -128, 128));
94 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"WalkHStop",
"Walk Horizontal Stop",
"",
"", -128, 128));
96 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LookV",
"Look Vertical",
"",
"", -128, 128));
97 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LookVStart",
"Look Vertical Start",
"",
"", -128, 128));
98 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LookVStop",
"Look Vertical Stop",
"",
"", -128, 128));
100 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LookH",
"Look Horizontal",
"",
"", -128, 128));
101 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LookHStart",
"Look Horizontal Start",
"",
"", -128, 128));
102 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LookHStop",
"Look Horizontal Stop",
"",
"", -128, 128));
104 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"Pan",
"Pan",
"",
"", -128, 128));
105 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"PanStart",
"Pan Start",
"",
"", -128, 128));
106 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"PanStop",
"Pan Stop",
"",
"", -128, 128));
108 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"Tilt",
"Tilt",
"",
"", -128, 128));
109 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"TiltStart",
"Tilt Start",
"",
"", -128, 128));
110 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"TiltStop",
"Tilt Stop",
"",
"", -128, 128));
112 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R1",
"R1",
"",
"", 0, 1));
113 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R1Start",
"R1 Start",
"",
"", 0, 1));
114 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R1Stop",
"R1 Stop",
"",
"", 0, 1));
116 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R2",
"R2",
"",
"", 0, 1));
117 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R2Start",
"R2 Start",
"",
"", 0, 1));
118 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R2Stop",
"R2 Stop",
"",
"", 0, 1));
120 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R3",
"R3",
"",
"", 0, 1));
121 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R3Start",
"R3 Start",
"",
"", 0, 1));
122 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"R3Stop",
"R3 Stop",
"",
"", 0, 1));
124 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L4",
"L4",
"",
"", 0, 1));
125 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L4Start",
"L4 Start",
"",
"", 0, 1));
126 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L4Stop",
"L4 Stop",
"",
"", 0, 1));
128 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L5",
"L5",
"",
"", 0, 1));
129 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L5Start",
"L5 Start",
"",
"", 0, 1));
130 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L5Stop",
"L5 Stop",
"",
"", 0, 1));
132 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L6",
"L6",
"",
"", 0, 1));
133 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L6Start",
"L6 Start",
"",
"", 0, 1));
134 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"L6Stop",
"L6 Stop",
"",
"", 0, 1));
136 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"RT",
"RT",
"",
"", 0, 1));
137 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"RTStart",
"RT Start",
"",
"", 0, 1));
138 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"RTStop",
"RT Stop",
"",
"", 0, 1));
140 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LT",
"LT",
"",
"", 0, 1));
141 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LTStart",
"LT Start",
"",
"", 0, 1));
142 m_thDataTypes.DataTypes.Add(
new AnimatGUI.DataObjects.DataType(
"LTStop",
"LT Stop",
"",
"", 0, 1));
146 AnimatGUI.DataObjects.Gains.Polynomial doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
147 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 0.0390625;
148 doGain.D.Scale = ScaledNumber.enumNumericScale.nano; doGain.D.Value = 5;
149 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doWalkV =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"WalkV",
"WalkV", doGain,
true);
150 doWalkV.Name =
"WalkV";
151 m_aryLinks.Add(doWalkV.ID, doWalkV,
false);
153 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
154 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 0.0390625;
155 doGain.D.Scale = ScaledNumber.enumNumericScale.nano; doGain.D.Value = 5;
156 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doWalkH =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"WalkH",
"WalkH", doGain,
true);
157 doWalkH.Name =
"WalkH";
158 m_aryLinks.Add(doWalkH.ID, doWalkH,
false);
160 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
161 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 0.0390625;
162 doGain.D.Scale = ScaledNumber.enumNumericScale.nano; doGain.D.Value = 5;
163 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doLookV =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"LookV",
"LookV", doGain,
true);
164 doLookV.Name =
"LookV";
165 m_aryLinks.Add(doLookV.ID, doLookV,
false);
167 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
168 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 0.0390625;
169 doGain.D.Scale = ScaledNumber.enumNumericScale.nano; doGain.D.Value = 5;
170 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doLookH =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"LookH",
"LookH", doGain,
true);
171 doLookH.Name =
"LookH";
172 m_aryLinks.Add(doLookH.ID, doLookH,
false);
174 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
175 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
176 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doR1 =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"R1",
"R1", doGain,
true);
178 m_aryLinks.Add(doR1.ID, doR1,
false);
180 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
181 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
182 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doR2 =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"R2",
"R2", doGain,
true);
184 m_aryLinks.Add(doR2.ID, doR2,
false);
186 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
187 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
188 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doR3 =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"R3",
"R3", doGain,
true);
190 m_aryLinks.Add(doR3.ID, doR3,
false);
192 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
193 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
194 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doL4 =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"L4",
"L4", doGain,
true);
196 m_aryLinks.Add(doL4.ID, doL4,
false);
198 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
199 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
200 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doL5 =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"L5",
"L5", doGain,
true);
202 m_aryLinks.Add(doL5.ID, doL5,
false);
204 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
205 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
206 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doL6 =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"L6",
"L6", doGain,
true);
208 m_aryLinks.Add(doL6.ID, doL6,
false);
210 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
211 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
212 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doRT =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"RT",
"RT", doGain,
true);
214 m_aryLinks.Add(doRT.ID, doRT,
false);
216 doGain =
new AnimatGUI.DataObjects.Gains.Polynomial(null,
"Gain",
"",
"Current",
false);
217 doGain.C.Scale = ScaledNumber.enumNumericScale.nano; doGain.C.Value = 10;
218 AnimatGUI.DataObjects.Robotics.PassThroughLinkage doLT =
new AnimatGUI.DataObjects.Robotics.PassThroughLinkage(
this,
"LT",
"LT", doGain,
true);
220 m_aryLinks.Add(doLT.ID, doLT,
false);
223 public override AnimatGUI.Framework.DataObject Clone(AnimatGUI.Framework.DataObject doParent,
bool bCutData, AnimatGUI.Framework.DataObject doRoot)
225 XBeeCommander doInterface =
new XBeeCommander(doParent);
229 protected override void CloneInternal(DataObject doOriginal,
bool bCutData, DataObject doRoot)
231 base.CloneInternal(doOriginal, bCutData, doRoot);
233 XBeeCommander doOrig = (XBeeCommander)doOriginal;
237 m_strPort = doOrig.m_strPort;
238 m_iBaudRate = doOrig.m_iBaudRate;
239 m_iChangeSimStepCount = doOrig.m_iChangeSimStepCount;
243 public override void BuildProperties(ref AnimatGuiCtrls.Controls.PropertyTable propTable)
245 base.BuildProperties(ref propTable);
247 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Com Port",
this.Port.GetType(),
"Port",
"Properties",
"Com port", this.Port));
248 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Baud Rate",
this.BaudRate.GetType(),
"BaudRate",
"Properties",
"Baud rate to use for communications", this.BaudRate));
249 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Pulse Sim Step Count",
this.ChangeSimStepCount.GetType(),
"ChangeSimStepCount",
"Properties",
"Number of simulation step slices to keep a start/stop signal active", this.ChangeSimStepCount));
258 m_strPort = oXml.GetChildString(
"Port", m_strPort);
259 m_iBaudRate = oXml.GetChildInt(
"BaudRate", m_iBaudRate);
260 m_iChangeSimStepCount = oXml.GetChildInt(
"ChangeSimStepCount", m_iChangeSimStepCount);
271 oXml.AddChildElement(
"Port", m_strPort);
272 oXml.AddChildElement(
"BaudRate", m_iBaudRate);
273 oXml.AddChildElement(
"ChangeSimStepCount", m_iChangeSimStepCount);
280 base.SaveSimulationXml(oXml, ref nmParentControl, strName);
284 oXml.AddChildElement(
"Port", m_strPort);
285 oXml.AddChildElement(
"BaudRate", m_iBaudRate);
286 oXml.AddChildElement(
"ChangeSimStepCount", m_iChangeSimStepCount);
int m_iChangeSimStepCount
The number of time slices to keep a start/stop signal active.