YouBotSlaveMailboxMsg.hpp
Go to the documentation of this file.
1 /****************************************************************
2  *
3  * Copyright (c) 2011
4  * All rights reserved.
5  *
6  * Hochschule Bonn-Rhein-Sieg
7  * University of Applied Sciences
8  * Computer Science Department
9  *
10  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11  *
12  * Author:
13  * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov
14  * Supervised by:
15  * Gerhard K. Kraetzschmar
16  *
17  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18  *
19  * This sofware is published under a dual-license: GNU Lesser General Public
20  * License LGPL 2.1 and BSD license. The dual-license implies that users of this
21  * code may choose which terms they prefer.
22  *
23  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24  *
25  * Redistribution and use in source and binary forms, with or without
26  * modification, are permitted provided that the following conditions are met:
27  *
28  * * Redistributions of source code must retain the above copyright
29  * notice, this list of conditions and the following disclaimer.
30  * * Redistributions in binary form must reproduce the above copyright
31  * notice, this list of conditions and the following disclaimer in the
32  * documentation and/or other materials provided with the distribution.
33  * * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its
34  * contributors may be used to endorse or promote products derived from
35  * this software without specific prior written permission.
36  *
37  * This program is free software: you can redistribute it and/or modify
38  * it under the terms of the GNU Lesser General Public License LGPL as
39  * published by the Free Software Foundation, either version 2.1 of the
40  * License, or (at your option) any later version or the BSD license.
41  *
42  * This program is distributed in the hope that it will be useful,
43  * but WITHOUT ANY WARRANTY; without even the implied warranty of
44  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  * GNU Lesser General Public License LGPL and the BSD license for more details.
46  *
47  * You should have received a copy of the GNU Lesser General Public
48  * License LGPL and BSD license along with this program.
49  *
50  ****************************************************************/
51 
52 #ifndef _YOUBOT_SLAVE_MAILBOX_MESSAGE_H
53 #define _YOUBOT_SLAVE_MAILBOX_MESSAGE_H
54 
56 #include <string>
57 #include <time.h>
59 
60 namespace youbot {
61 
63 
64  PACKED_BEGIN
66  uint8 moduleAddress; //0 = Drive 1 = Gripper
69  uint8 motorNumber; //always zero
70  uint32 value; //MSB first!
71 
72  mailboxOutputBuffer() : moduleAddress(0), commandNumber(0), typeNumber(0), motorNumber(0), value(0) {};
73  } PACKED;
74  PACKED_END
75 
77 
78  PACKED_BEGIN
82  uint8 status; //(e.g. 100 means “no error”)
84  uint32 value; //MSB first!
85 
86  mailboxInputBuffer() : replyAddress(0), moduleAddress(0), status(0), commandNumber(0), value(0) {};
87  } PACKED;
88  PACKED_END
89 
93 
95  public:
96 
99 
100  // Constructor
102  slaveNumber = 1000;
103  }
104 
105  // Constructor
106 
107  YouBotSlaveMailboxMsg(unsigned int slaveNo) {
108  slaveNumber = slaveNo;
109  }
110  // Copy-Constructor
111 
113  stctOutput = copy.stctOutput;
114  stctInput = copy.stctInput;
115  slaveNumber = copy.slaveNumber;
116  parameterName = copy.parameterName;
117  }
118 
119 
120  // Destructor
121 
123  }
124 
125  // assignment operator
126 
128  stctOutput = copy.stctOutput;
129  stctInput = copy.stctInput;
130  slaveNumber = copy.slaveNumber;
131  parameterName = copy.parameterName;
132  return *this;
133  }
134 
135  std::string parameterName;
136  unsigned int slaveNumber;
137  };
138 
139 
144  public:
145 
148 
149  // Constructor
151  slaveNumber.Set(1000);
152  }
153 
154  // Constructor
155 
156  YouBotSlaveMailboxMsgThreadSafe(unsigned int slaveNo) {
157  slaveNumber.Set(slaveNo);
158  }
159  // Copy-Constructor
160 
162  mailboxOutputBuffer tempStctOutput;
163  mailboxInputBuffer tempStctInput;
164  std::string tempParameterName;
165  unsigned int SlaveNumber;
166 
167 
168  copy.stctOutput.Get(tempStctOutput);
169  stctOutput.Set(tempStctOutput);
170 
171  copy.stctInput.Get(tempStctInput);
172  stctInput.Set(tempStctInput);
173 
174  copy.slaveNumber.Get(SlaveNumber);
175  slaveNumber.Set(SlaveNumber);
176 
177  copy.parameterName.Get(tempParameterName);
178  parameterName.Set(tempParameterName);
179  }
180 
181  // Destructor
182 
184  }
185 
186  // assignment operator
187 
189  mailboxOutputBuffer tempStctOutput;
190  mailboxInputBuffer tempStctInput;
191  std::string tempParameterName;
192  unsigned int SlaveNumber;
193 
194 
195  copy.stctOutput.Get(tempStctOutput);
196  stctOutput.Set(tempStctOutput);
197 
198  copy.stctInput.Get(tempStctInput);
199  stctInput.Set(tempStctInput);
200 
201  copy.slaveNumber.Get(SlaveNumber);
202  slaveNumber.Set(SlaveNumber);
203 
204  copy.parameterName.Get(tempParameterName);
205  parameterName.Set(tempParameterName);
206  return *this;
207  }
208 
210 
212  };
213 
214 
215 
216 } // namespace youbot
217 
218 #endif /* _YOUBOT_SLAVE_MESSAGE_H */
YouBotSlaveMailboxMsg & operator=(const YouBotSlaveMailboxMsg &copy)
Input part from the EtherCAT mailbox message of the youBot slaves.
uint8_t uint8
Definition: osal.h:33
YouBotSlaveMailboxMsgThreadSafe(const YouBotSlaveMailboxMsgThreadSafe &copy)
PACKED_BEGIN struct youbot::mailboxOutputBuffer PACKED
YouBotSlaveMailboxMsg(const YouBotSlaveMailboxMsg &copy)
YouBotSlaveMailboxMsgThreadSafe & operator=(const YouBotSlaveMailboxMsgThreadSafe &copy)
virtual DataType Get() const
Output part from the EtherCAT mailbox message of the youBot slaves.
General typedefs and defines for EtherCAT.
DataObjectLockFree< mailboxOutputBuffer > stctOutput
DataObjectLockFree< std::string > parameterName
YouBotSlaveMailboxMsg(unsigned int slaveNo)
This DataObject is a Lock-Free implementation, such that reads and writes can happen concurrently wit...
DataObjectLockFree< unsigned int > slaveNumber
EtherCAT mailbox message of the youBot slaves (thread safe)
EtherCAT mailbox message of the youBot slaves.
virtual void Set(const DataType &push)
DataObjectLockFree< mailboxInputBuffer > stctInput
uint32_t uint32
Definition: osal.h:35


youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Jun 10 2019 15:46:26