AnimatLab  2
Test
RbXBeeCommander.h
1 // RbDynamixelUSB.h: interface for the RbDynamixelUSB class.
2 //
4 
5 #pragma once
6 
7 /* bitmasks for buttons array */
8 #define BUT_R1 0x01
9 #define BUT_R2 0x02
10 #define BUT_R3 0x04
11 #define BUT_L4 0x08
12 #define BUT_L5 0x10
13 #define BUT_L6 0x20
14 #define BUT_RT 0x40
15 #define BUT_LT 0x80
16 
17 #define BUT_ID_WALKV 0
18 #define BUT_ID_WALKH 1
19 #define BUT_ID_LOOKV 2
20 #define BUT_ID_LOOKH 3
21 #define BUT_ID_PAN 4
22 #define BUT_ID_TILT 5
23 #define BUT_ID_R1 6
24 #define BUT_ID_R2 7
25 #define BUT_ID_R3 8
26 #define BUT_ID_L4 9
27 #define BUT_ID_L5 10
28 #define BUT_ID_L6 11
29 #define BUT_ID_RT 12
30 #define BUT_ID_LT 13
31 #define BUT_ID_TOTAL 14
32 
33 namespace RoboticsAnimatSim
34 {
35  namespace Robotics
36  {
37  namespace RobotIOControls
38  {
39 
41 {
42 protected:
44  std::string m_strPort;
45 
48 
50  unsigned char m_iButtons; //
51  unsigned char m_iExt; // Extended function set
52 
53  ofSerial m_Port;
54 
55  // internal variables used for reading messages
56  unsigned char vals[7]; // temporary values, moved after we confirm checksum
57  int index; // -1 = waiting for new packet
58  int checksum;
59  unsigned char status;
60 
61  virtual void StepIO();
62  virtual bool OpenIO();
63  virtual void CloseIO();
64 
65  virtual void ResetData();
66  virtual void WaitForThreadNotifyReady();
67 
68  virtual void CreateDataIDMap();
69 
70 public:
72  virtual ~RbXBeeCommander();
73 
74  virtual void Port(std::string strPort);
75  virtual std::string Port();
76 
77  virtual void BaudRate(int iRate);
78  virtual int BaudRate();
79 
80 #pragma region DataAccesMethods
81 
82  virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
83  virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
84 
85 #pragma endregion
86 
87  virtual void SimStarting();
88 
89  virtual void Initialize();
90  virtual void Load(StdUtils::CStdXml &oXml);
91 };
92 
93  } //RobotIOControls
94  } // Robotics
95 } //RoboticsAnimatSim
96 
int m_iBaudRate
The baud rate of communications for this XBee.
A standard xml manipulation class.
Definition: StdXml.h:19
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
std::string m_strPort
The serial port this Xbee communicates on.
unsigned char m_iButtons
buttons are 0 or 1 (PRESSED), and bitmapped