C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyExerciseInterface.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************
28  **
29  *t diguyExerciseInterface
30  **
31  *b Link against: libdiguy
32  */
33 
34 #ifndef __diguyExerciseInterface_H
35 #define __diguyExerciseInterface_H
36 
37 #ifdef SWIG
39 #else
40 #define CPLUSPLUS_ONLY
41 #endif
42 
43 #include <diguyExerciseInterface.h>
44 
45 #ifdef CPLUSPLUS_ONLY
46 
47 class bdiExerciseInterface;
48 class diguyCharacter;
49 
50 #include <stdio.h> // for NULL
51 #include <diguy_constants.h>
52 
53 #endif /* CPLUSPLUS_ONLY */
54 
55 
56 #include <declspec_diguy.h>
57 
58 /****************************************************************************/
59 class BDI_DECLSPEC_diguy diguyExerciseInterface
60 {
61 
62 public:
63 
64 /*****************************************************************************/
68  /*l
69  *b Description:
70  **
71  ** This function sends an xc_set_tin_tod PDU. This PDU
72  ** tells a remote DI-Guy application the simulated time of day
73  ** at which its scenario is supposed to begin. Doing this
74  ** provides a conceptual link between scenario time, which
75  ** nominally starts at zero, and wall-clock time. This makes
76  ** it possible for a scenario to be run under different
77  ** simulated lighting conditions.
78  **
79  ** The remote DI-Guy application essentially does a
80  ** diguyScenario::set_tin_time_of_day() call.
81  **
82  *b Arguments:
83  **
84  *a site - destination host id (65535 for all sites)
85  *a host - destination host id (65535 for all hosts)
86  *a ttod - tin time of day (seconds after midnight)
87  **
88  *b Callable From:
89  **
90  *- - C++
91  *- - Script
92  */
93  void send_pdu_xc_set_tin_tod(unsigned short site,
94  unsigned short host,
95  float ttod);
96 
97  /*l
98  *b Description:
99  **
100  ** This function sends an xc_load_scenario PDU. This PDU
101  ** tells a remote DI-Guy application to load a particular
102  ** scenario file.
103  **
104  ** The remote DI-Guy application essentially does a
105  ** diguyScenario::load() call.
106  **
107  *b Arguments:
108  **
109  *a site - destination host id (65535 for all sites)
110  *a host - destination host id (65535 for all hosts)
111  *a filename - scenario to load
112  *a refname - scenario reference name
113  **
114  *b Callable From:
115  **
116  *- - C++
117  *- - Script
118  */
119  void send_pdu_xc_load_scenario(unsigned short site,
120  unsigned short host,
121  const char* filename,
122  const char* refname);
123 
124  /*l
125  *b Description:
126  **
127  ** This function sends an xc_save_scenario PDU. This PDU
128  ** tells a remote DI-Guy application to save a particular
129  ** scenario file.
130  **
131  ** The remote DI-Guy application essentially does a
132  ** diguyScenario::save_as() call.
133  **
134  *b Arguments:
135  **
136  *a site - destination host id (65535 for all sites)
137  *a host - destination host id (65535 for all hosts)
138  *a filename - scenario to load
139  *a use_user_name - user name to uniquely identify the file
140  **
141  *b Callable From:
142  **
143  *- - C++
144  *- - Script
145  */
146  void send_pdu_xc_save_scenario(unsigned short site,
147  unsigned short host,
148  const char* filename,
149  const int use_user_name);
150 
151  /*l
152  *b Description:
153  **
154  ** This function sends an xc_reset_scenario PDU. This PDU
155  ** tells a remote DI-Guy application to reset the current
156  ** scenario file.
157  **
158  ** The remote DI-Guy application essentially does a
159  ** diguyScenario::reset() call.
160  **
161  *b Arguments:
162  **
163  *a site - destination host id (65535 for all sites)
164  *a host - destination host id (65535 for all hosts)
165  **
166  *b Callable From:
167  **
168  *- - C++
169  *- - Script
170  */
171  void send_pdu_xc_reset_scenario(unsigned short site,
172  unsigned short host);
173 
174  /*l
175  *b Description:
176  **
177  ** This function sends an xc_merge_scenario PDU. This PDU
178  ** tells a remote DI-Guy application to merge a particular
179  ** scenario file.
180  **
181  ** The remote DI-Guy application essentially does a
182  ** diguyScenario::merge() call.
183  **
184  *b Arguments:
185  **
186  *a site - destination host id (65535 for all sites)
187  *a host - destination host id (65535 for all hosts)
188  *a ttod - tin time of day for the merged scenario
189  *a (seconds after midnight)
190  *a refx, refy, refz - transformation reference point in merged
191  *a scenario (point around which translation
192  *a and rotation will occur)
193  *a tx, ty, tz - translation of reference point in merged
194  *a scenario
195  *a rz, rx, ry - rotation of reference point in merged scenario
196  *a filename - filename of scenario to merge
197  *a collision_suffix - suffix to be used in event of name
198  *a conflicts
199  **
200  *b Callable From:
201  **
202  *- - C++
203  *- - Script
204  */
205  void send_pdu_xc_merge_scenario(unsigned short site,
206  unsigned short host,
207  float ttod,
208  float refx, float refy, float refz,
209  float tx, float ty, float tz,
210  float rz, float rx, float ry,
211  const char* filename,
212  const char* suffix);
213 
214  /*l
215  *b Description:
216  **
217  ** This function sends an xc_trigger_script PDU. This PDU
218  ** tells a remote DI-Guy application to trigger the named
219  ** script.
220  **
221  ** The remote DI-Guy application essentially does a
222  ** diguyScenario::trigger_script() call.
223  **
224  *b Arguments:
225  **
226  *a site - destination host id (65535 for all sites)
227  *a host - destination host id (65535 for all hosts)
228  *a script_name - name of the script to be triggered
229  **
230  *b Callable From:
231  **
232  *- - C++
233  *- - Script
234  */
235  void send_pdu_xc_trigger_script(unsigned short site,
236  unsigned short host,
237  const char* script_name);
238 
239  /*l
240  *b Description:
241  **
242  ** This function sends an xc_control PDU. This PDU tells a
243  ** remote DI-Guy application to PLAY, STOP, RESET, etc.
244  **
245  *b Arguments:
246  **
247  *a site - destination host id (65535 for all sites)
248  *a host - destination host id (65535 for all hosts)
249  *a command - command string. Valid values are "RESET",
250  *a "RUN", "STOP", "FF", "REWIND"
251  **
252  *b Callable From:
253  **
254  *- - C++
255  *- - Script
256  */
257  void send_pdu_xc_control(unsigned short site,
258  unsigned short host,
259  const char* command);
260 
261  /*l
262  *b Description:
263  **
264  ** This function sends an xc_time_now PDU. This PDU tells all
265  ** remote DI-Guy applications what the simulated time of day is
266  ** right now. There is no way to target this message at
267  ** particular DI-Guy hosts. It is received and processed by all
268  ** DI-Guy applications in the DIS exercise.
269  **
270  *b Arguments:
271  **
272  *a tod - time of day: number of seconds since midnight,
273  *a where 0.0 <= tod < 86400.0
274  *a smooth_period - how many real seconds should be taken to get
275  *a into sync
276  **
277  ** Scenarios can proceed from one day to the next, up to a length of
278  ** 24 hours. When midnight comes, tod should be specified AS ZERO,
279  ** and should increase from there. Values less than zero or greater
280  ** than or equal to 86400.0 will NOT be sent over the network. In
281  ** the case nothing will be sent.
282  **
283  *b Callable From:
284  **
285  *- - C++
286  *- - Script
287  */
288  void send_pdu_xc_time_now(float tod, float smooth_period);
289 
290  /*l
291  *b Description:
292  **
293  ** This function sends an xc_eval_script PDU. This PDU tells a
294  ** remote DI-Guy application to evaluate a literal piece of
295  ** script text.
296  **
297  *b Arguments:
298  **
299  *a site - destination host id (65535 for all sites)
300  *a host - destination host id (65535 for all hosts)
301  *a text - text of the script to be executed
302  **
303  *b Callable From:
304  **
305  *- - C++
306  *- - Script
307  */
308  void send_pdu_xc_eval_script(unsigned short site,
309  unsigned short host,
310  const char* text);
311 
312  /*l
313  *b Description:
314  **
315  ** This function sends an xc_enter_slave PDU. This PDU tells a remote
316  ** DI-Guy application to start slaving it's camera to incoming
317  ** camera/time packets.
318  **
319  *b Arguments:
320  **
321  *a site - destination host id (65535 for all sites)
322  *a host - destination host id (65535 for all hosts)
323  **
324  *b Callable From:
325  **
326  *- - C++
327  *- - Script
328  */
329  void send_pdu_xc_enter_slave_mode(unsigned short site, unsigned short host);
330 
331  /*l
332  *b Description:
333  **
334  ** This function sends an xc_exit_slave PDU. This PDU tells a remote
335  ** DI-Guy application to stop slaving it's camera to incoming
336  ** camera/time packets.
337  **
338  *b Arguments:
339  **
340  *a site - destination host id (65535 for all sites)
341  *a host - destination host id (65535 for all hosts)
342  **
343  *b Callable From:
344  **
345  *- - C++
346  *- - Script
347  */
348  void send_pdu_xc_exit_slave_mode(unsigned short site, unsigned short host);
349 
350 
355  /*l
356  *b Description:
357  **
358  ** This function sends a custom AI message PDU. This PDU is mapped
359  ** into a diguyCharacter::agent_accept_message() function call on
360  ** the receiving side.
361  **
362  *b Arguments:
363  **
364  *a character - pointer to the remote diguyCharacter
365  *a sender_name - who is sending the message
366  *a message_type - type of message is being sent
367  *a message - message string
368  *a message_params - optional parameter string
369  **
370  ** Use diguyExerciseInterface::get_net_id() to get the name of the
371  ** character that the remote machine will see the sender as.
372  **
373  *b Callable From:
374  **
375  *- - C++
376  *- - Script
377  */
378  int send_message_to_character(diguyCharacter* character,
379  const char* sender_name,
380  const char* message_type,
381  const char* message,
382  const char* message_params = NULL);
383 
384  /*l
385  *b Description:
386  **
387  ** This function sends a custom AI message PDU. This PDU is mapped
388  ** into a diguyCharacterGroup::send_message_to_all_members() on all
389  ** clients.
390  **
391  *b Arguments:
392  **
393  *a group_name - name of the diguyCharacterGroup to target
394  *a sender_name - who is sending the message
395  *a message_type - what type of message is being sent
396  *a message - the message string
397  *a message_params - optional parameter string
398  **
399  ** Use diguyExerciseInterface::get_net_id() to get the name of the
400  ** character that the remote machine will see the sender as.
401  **
402  *b Callable From:
403  **
404  *- - C++
405  *- - Script
406  */
407  int send_message_to_group(const char* group_name,
408  const char* sender_name,
409  const char* message_type,
410  const char* message,
411  const char* message_params = NULL);
412 
413  /*l
414  *b Description:
415  **
416  ** This function sends a custom AI message PDU. This PDU is mapped
417  ** into a diguyCharacter::agent_broadcast_message() on all clients.
418  **
419  *b Arguments:
420  **
421  *a sender - pointer to the diguyCharacter that is broadcasting
422  *a the message
423  *a radius - how far to broadcast the message
424  *a message_type - what type of message is being sent
425  *a message - the message string
426  *a message_params - optional parameter string
427  **
428  *b Callable From:
429  **
430  *- - C++
431  *- - Script
432  */
433  int broadcast_message(diguyCharacter* sender,
434  float radius,
435  const char* message_type,
436  const char* message,
437  const char* message_params = NULL);
438 
439  /*l
440  *b Description:
441  **
442  ** This function sends a custom AI message PDU. This PDU is mapped
443  ** into a diguyCharacter::agent_broadcast_message_to_group() on all
444  ** clients.
445  **
446  *b Arguments:
447  **
448  *a sender - pointer to the diguyCharacter that is broadcasting
449  *a the message
450  *a group_name - the group that receive the message
451  *a radius - how far to broadcast the message
452  *a message_type - what type of message is being sent
453  *a message - the message string
454  *a message_params - optional parameter string
455  **
456  *b Callable From:
457  **
458  *- - C++
459  *- - Script
460  */
461  int broadcast_message_to_group(diguyCharacter* sender,
462  const char* group_name,
463  float radius,
464  const char* message_type,
465  const char* message,
466  const char* message_params = NULL);
467 
468  /*l
469  *b Returns:
470  **
471  ** "sitenum_hostnum_idnum" as a string
472  **
473  ** Useful for knowing the name that this entity will have on remote
474  ** machines. This string should be copied.
475  */
476  const char* get_net_id(diguyCharacter* character);
477 
478 
479 /****************************************************************************/
480 /****************************************************************************/
485 /****************************************************************************/
487  // Documentation Pending
488  int convert_mgrs_to_local(const char* MGRS_str, float* x, float* y, float* z);
489 
490  const char* convert_local_to_mgrs(float x, float y, float z);
491 
492  // returns straightforward latitude and longitude coordinates
493  float convert_local_to_lat(float x, float y, float z);
494  float convert_local_to_long(float x, float y, float z);
495 
496  // returns latitude and longitude in degrees, minutes, seconds
497  const char* convert_local_to_lat_long_string(float x, float y, float z);
498 
499  int convert_lat_long_to_local(float lat, float lon, float* x, float* y, float* z);
501 
506 #ifdef CPLUSPLUS_ONLY
507 
508  bdiExerciseInterface* get_scripted_object() {return m_bdiExerciseInterface;}
509 
510 private:
511 
512  friend class bdiExerciseInterface;
513 
514  /*l
515  ** A private constructor.
516  */
517  diguyExerciseInterface(bdiExerciseInterface* ei);
518 
519  /*l
520  ** A pointer to internal data.
521  */
522  bdiExerciseInterface* m_bdiExerciseInterface;
523 
524 #endif /* CPLUSPLUS_ONLY */
525 
526 };
527 
528 
529 #endif /* __diguyExerciseInterface_H */
530