2 using System.Collections.Generic;
5 using AnimatGUI.Framework;
9 namespace RobotIOControls
14 public class DynamixelUSB : AnimatGUI.DataObjects.Robotics.RobotIOControl
16 #region " Attributes "
18 protected int m_iPortNumber = 3;
19 protected int m_iBaudRate = 1;
23 #region " Attributes "
25 public override string Description {
get {
return "Performs IO with the Dynamixel USB controller using their SDK to control servo motors. Implements angular or linear motor systems.";} set { }}
26 public override string ButtonImageName {
get {
return "RoboticsGUI.Graphics.DynamixelUSB.gif";}}
27 public override string WorkspaceImageName {
get {
return "RoboticsGUI.Graphics.DynamixelUSBSmall.gif";}}
28 public override string PartType {
get {
return "DynamixelUSB"; }}
29 public override string ModuleName {
get {
return "RoboticsAnimatSim"; } }
31 public virtual int PortNumber
39 SetSimData(
"PortNumber", value.ToString(),
true);
40 m_iPortNumber = value;
44 public virtual int BaudRate
52 if (!((value == 1) || (value == 3) || (value == 4) || (value == 7) || (value == 9) ||
53 (value == 9) || (value == 16) || (value == 34) || (value == 103) || (value == 207)))
54 throw new System.Exception(
"Invalid baud rate specified. Rate: " + value.ToString());
56 SetSimData(
"BaudRate", value.ToString(),
true);
65 public DynamixelUSB(AnimatGUI.Framework.DataObject doParent)
68 m_strName =
"Dynamixel USB";
75 public override AnimatGUI.Framework.DataObject Clone(AnimatGUI.Framework.DataObject doParent,
bool bCutData, AnimatGUI.Framework.DataObject doRoot)
81 protected override void CloneInternal(DataObject doOriginal,
bool bCutData, DataObject doRoot)
83 base.CloneInternal(doOriginal, bCutData, doRoot);
89 m_iPortNumber = doOrig.m_iPortNumber;
90 m_iBaudRate = doOrig.m_iBaudRate;
94 public override void BuildProperties(ref AnimatGuiCtrls.Controls.PropertyTable propTable)
96 base.BuildProperties(ref propTable);
98 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Com Port",
this.PortNumber.GetType(),
"PortNumber",
"Properties",
"Com port number", this.PortNumber));
99 propTable.Properties.Add(
new AnimatGuiCtrls.Controls.PropertySpec(
"Baud Rate",
this.BaudRate.GetType(),
"BaudRate",
"Properties",
"Baud rate to use for communications", this.BaudRate));
108 m_iPortNumber = oXml.GetChildInt(
"PortNumber", m_iPortNumber);
109 m_iBaudRate = oXml.GetChildInt(
"BaudRate", m_iBaudRate);
120 oXml.AddChildElement(
"PortNumber", m_iPortNumber);
121 oXml.AddChildElement(
"BaudRate", m_iBaudRate);
128 base.SaveSimulationXml(oXml, ref nmParentControl, strName);
132 oXml.AddChildElement(
"PortNumber", m_iPortNumber);
133 oXml.AddChildElement(
"BaudRate", m_iBaudRate);