Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
bsDyna.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Dynamixel
4 //
5 // Library: libbsclient_dyna
6 //
7 // File: bsDyna.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2015-01-12 10:56:06 -0700 (Mon, 12 Jan 2015) $
12  * $Rev: 3845 $
13  *
14  * \brief \h_botsense bsProxy client library Dynamixel interface.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  *
18  * \copyright
19  * \h_copy 2011-2017. RoadNarrows LLC.\n
20  * http://www.roadnarrows.com\n
21  * All Rights Reserved
22  */
23 /*
24  * @EulaBegin@
25  *
26  * Unless otherwise stated explicitly, all materials contained are copyrighted
27  * and may not be used without RoadNarrows LLC's written consent,
28  * except as provided in these terms and conditions or in the copyright
29  * notice (documents and software) or other proprietary notice provided with
30  * the relevant materials.
31  *
32  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
33  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
34  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
35  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
36  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
40  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
41  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
42  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
43  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
44  *
45  * @EulaEnd@
46  */
47 ////////////////////////////////////////////////////////////////////////////////
48 
49 #ifndef _BSDYNA_H
50 #define _BSDYNA_H
51 
52 #include "rnr/rnrconfig.h"
53 
54 #include "botsense/BotSense.h"
55 #include "botsense/libBotSense.h"
56 
57 #include "Dynamixel/Dynamixel.h"
58 #include "Dynamixel/DynaTypes.h"
59 
60 #ifndef SWIG
61 C_DECLS_BEGIN
62 #endif // SWIG
63 
64 #define BS_DYNA_SERVER_MOD "libbsserver_dyna" ///< server plugin dll module
65 #define BS_DYNA_CLIENT_LIB "libbsclient_dyna" ///< client app library
66 
67 /*!
68  * \brief Get the Dynamixel message name.
69  *
70  * Each (virtual connection, message id) 2-tuple provides a unique server
71  * mapping that can be used associate a name string to the message
72  * (provided the id is valid and an application provides the information).
73  *
74  * \param pClient \h_botsense client.
75  * \param hndVConn Virtual connection handle.
76  * \param uMsgId Message id.
77  *
78  * \return
79  * Returns message name if it can be determined. Otherwise returns "unknown".
80  */
81 extern const char *bsDynaGetMsgName(BsClient_P pBsClient,
82  BsVConnHnd_T hndVConn,
83  uint_t uMsgId);
84 
85 
86 /*!
87  * \brief Request proxy server to establish a virtual connection to the
88  * Dynamixel servo chain using the USB2Dynamixel serial dongle.
89  *
90  * \param pClient \h_botsense client.
91  * \param sDevName Proxied USB serial device name (e.g. /dev/ttyUSB0).
92  * \param nBaudRate Baud rate.
93  * \param bInitTrace Initial message tracing enable(true)/disable(false) state.
94  *
95  * \return
96  * On success, the virtual connection handle is returned.\n
97  * \copydoc doc_return_bs_ecode
98  */
99 extern int bsDynaOpen(BsClient_P pBsClient,
100  const char *sDevName,
101  int nBaudRate,
102  bool_t bInitTrace);
103 
104 /*!
105  * \brief Request proxy server to close client's proxied Dynamixel servo chain
106  * vitual connection.
107  *
108  * \param pClient \h_botsense client.
109  * \param hndVConn Handle to virtual connection to close.
110  *
111  * \copydoc doc_return_bs_std
112  */
113 extern int bsDynaClose(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn);
114 
115 /*!
116  * \brief Proxied request to set the Dynamixel Bus baud rate.
117  *
118  * \param pClient \h_botsense client.
119  * \param hndVConn Handle to virtual connection to close.
120  * \param nBaudRate New baud rate.
121  *
122  * \return doc_return_bs_std
123  */
124 extern int bsDynaSetBaudRate(BsClient_P pBsClient,
125  BsVConnHnd_T hndBsVConn,
126  int nBaudRate);
127 
128 /*!
129  * \brief Proxied request to read an 8-bit value from a servo's control table.
130  *
131  * \param pClient \h_botsense client.
132  * \param hndVConn Handle to virtual connection to close.
133  * \param nServoId Servo id.
134  * \param uAddr Control table address.
135  * \param [out] pVal Value read.
136  * \param [out] pAlarms Current servo alarms, if any.
137  *
138  * \copydoc doc_return_bs_std
139  */
140 extern int bsDynaRead8(BsClient_P pBsClient,
141  BsVConnHnd_T hndBsVConn,
142  int nServoId,
143  uint_t uAddr,
144  byte_t *pVal,
145  uint_t *pAlarms);
146 
147 /*!
148  * \brief Proxied request to write an 8-bit value to a servo's control table.
149  *
150  * \param pClient \h_botsense client.
151  * \param hndVConn Handle to virtual connection to close.
152  * \param nServoId Servo id.
153  * \param uAddr Control table address.
154  * \param [in] byVal Value to write.
155  * \param [out] pAlarms Current servo alarms, if any.
156  *
157  * \copydoc doc_return_bs_std
158  */
159 extern int bsDynaWrite8(BsClient_P pBsClient,
160  BsVConnHnd_T hndBsVConn,
161  int nServoId,
162  uint_t uAddr,
163  byte_t byVal,
164  uint_t *pAlarms);
165 
166 /*!
167  * \brief Proxied request to read a 16-bit value from a servo's control table.
168  *
169  * \param pClient \h_botsense client.
170  * \param hndVConn Handle to virtual connection to close.
171  * \param nServoId Servo id.
172  * \param uAddr Control table address.
173  * \param [out] pVal Value read.
174  * \param [out] pAlarms Current servo alarms, if any.
175  *
176  * \copydoc doc_return_bs_std
177  */
178 extern int bsDynaRead16(BsClient_P pBsClient,
179  BsVConnHnd_T hndBsVConn,
180  int nServoId,
181  uint_t uAddr,
182  ushort_t *pVal,
183  uint_t *pAlarms);
184 
185 /*!
186  * \brief Proxied request to write a 16-bit value to a servo's control table.
187  *
188  * \param pClient \h_botsense client.
189  * \param hndVConn Handle to virtual connection to close.
190  * \param nServoId Servo id.
191  * \param uAddr Control table address.
192  * \param [in] huVal Value to write.
193  * \param [out] pAlarms Current servo alarms, if any.
194  *
195  * \copydoc doc_return_bs_std
196  */
197 extern int bsDynaWrite16(BsClient_P pBsClient,
198  BsVConnHnd_T hndBsVConn,
199  int nServoId,
200  uint_t uAddr,
201  ushort_t huVal,
202  uint_t *pAlarms);
203 
204 /*!
205  * \brief Proxied request to synchronously write values to servos.
206  *
207  * \param pClient \h_botsense client.
208  * \param hndVConn Handle to virtual connection to close.
209  * \param uAddr Control table address.
210  * \param uDataSize Size (bytes) of data to write.
211  * \param tuples Servo Id, Value 2-tuples
212  * \param uCount Number of 2-tuples
213  *
214  * \copydoc doc_return_bs_std
215  */
216 extern int bsDynaSyncWrite(BsClient_P pBsClient,
217  BsVConnHnd_T hndBsVConn,
218  uint_t uAddr,
219  uint_t uDataSize,
220  DynaSyncWriteTuple_T tuples[],
221  uint_t uCount);
222 
223 /*!
224  * \brief Proxied request to ping a servo.
225  *
226  * \param pClient \h_botsense client.
227  * \param hndVConn Handle to virtual connection to close.
228  * \param nServoId Servo id.
229  *
230  * \return Returns true if the servo responded, else false.
231  */
232 extern int bsDynaPing(BsClient_P pBsClient,
233  BsVConnHnd_T hndBsVConn,
234  int nServoId,
235  bool_t *pPong);
236 
237 /*!
238  * \brief Proxied request to reset a servo to defaults.
239  *
240  * \param pClient \h_botsense client.
241  * \param hndVConn Handle to virtual connection to close.
242  * \param nServoId Servo id.
243  *
244  * \return doc_return_bs_std
245  */
246 extern int bsDynaReset(BsClient_P pBsClient,
247  BsVConnHnd_T hndBsVConn,
248  int nServoId);
249 
250 /*!
251  * \brief Proxied request to set the half-duplex control signal.
252  *
253  * \param pClient \h_botsense client.
254  * \param hndVConn Handle to virtual connection to close.
255  * \param nSignal Signal number.
256  *
257  * \return doc_return_bs_std
258  */
259 int bsDynaSetHalfDuplexCtl(BsClient_P pClient,
260  BsVConnHnd_T hndVConn,
261  int nSignal);
262 
263 #ifndef SWIG
264 C_DECLS_END
265 #endif // SWIG
266 
267 #endif // _BSDYNA_H
int bsDynaWrite8(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, int nServoId, uint_t uAddr, byte_t byVal, uint_t *pAlarms)
Proxied request to write an 8-bit value to a servo&#39;s control table.
int bsDynaReset(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, int nServoId)
Proxied request to reset a servo to defaults.
int bsDynaOpen(BsClient_P pBsClient, const char *sDevName, int nBaudRate, bool_t bInitTrace)
Request proxy server to establish a virtual connection to the Dynamixel servo chain using the USB2Dyn...
int bsDynaSetHalfDuplexCtl(BsClient_P pClient, BsVConnHnd_T hndVConn, int nSignal)
Proxied request to set the half-duplex control signal.
int bsDynaClose(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn)
Request proxy server to close client&#39;s proxied Dynamixel servo chain vitual connection.
int bsDynaPing(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, int nServoId, bool_t *pPong)
Proxied request to ping a servo.
int bsDynaSetBaudRate(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, int nBaudRate)
Proxied request to set the Dynamixel Bus baud rate.
int bsDynaRead16(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, int nServoId, uint_t uAddr, ushort_t *pVal, uint_t *pAlarms)
Proxied request to read a 16-bit value from a servo&#39;s control table.
RoadNarrows Dynamixel Fundatmental Types.
int bsDynaSyncWrite(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, uint_t uAddr, uint_t uDataSize, DynaSyncWriteTuple_T tuples[], uint_t uCount)
Proxied request to synchronously write values to servos.
int bsDynaWrite16(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, int nServoId, uint_t uAddr, ushort_t huVal, uint_t *pAlarms)
Proxied request to write a 16-bit value to a servo&#39;s control table.
RoadNarrows Dynamixel Top-Level Package Header File.
const char * bsDynaGetMsgName(BsClient_P pBsClient, BsVConnHnd_T hndVConn, uint_t uMsgId)
Get the Dynamixel message name.
int bsDynaRead8(BsClient_P pBsClient, BsVConnHnd_T hndBsVConn, int nServoId, uint_t uAddr, byte_t *pVal, uint_t *pAlarms)
Proxied request to read an 8-bit value from a servo&#39;s control table.