C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyCharacterGesture.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  **
30  *t diguyCharacterGesture
31  **
32  */
33 
34 #ifndef __diguyCharacterGesture_H
35 #define __diguyCharacterGesture_H
36 
37 
38 #ifdef SWIG
40 #else
41 #define CPLUSPLUS_ONLY
42 #endif
43 
44 #ifdef CPLUSPLUS_ONLY
45 class bdiGestureInstance;
46 class bdiScenarioCharacter;
48 
51 
52 /****************************************************************************/
54  int callback_id,
55  void* callback_params,
56  void* callback_user_data);
57 
58 #endif
59 
60 
61 #include <declspec_diguy.h>
62 
63 /****************************************************************************/
64 class BDI_DECLSPEC_diguy diguyCharacterGesture
65 {
66 
67 public:
68 
69 /*****************************************************************************/
75  /*l
76  *b Returns:
77  **
78  ** name of the gesture
79  **
80  *b Callable For Gesture Types:
81  **
82  *- - all
83  **
84  *b Callable From:
85  **
86  *- - C++
87  *- - Script
88  */
89  const char* get_name();
90 
91  /*l
92  *b Returns:
93  **
94  ** type of the gesture
95  **
96  *b Callable For Gesture Types:
97  **
98  *- - all
99  **
100  *b Callable From:
101  **
102  *- - C++
103  *- - Script
104  */
105  diguyCharacterGestureType get_gesture_type();
106 
107  /*l
108  *b Description:
109  **
110  ** This function causes the gesture to begin immediately.
111  ** The gesture will continue until it has completed or
112  ** is aborted.
113  **
114  ** Calling this function on a gesture that has already
115  ** begun will result in a warning message and have no other
116  ** effect.
117  **
118  *i Progression Gestures:
119  **
120  ** The overall duration of the gesture can be set by calling
121  ** set_overall_duration(). The durations of each stage will be
122  ** set proportionately over the overall duration.
123  **
124  ** Alternatively, the durations of individual stages of the
125  ** gesture can be set by calling set_stage_duration().
126  **
127  ** The number of repetitions of the gesture can be set
128  ** by calling set_max_reps().
129  **
130  *b Returns:
131  **
132  ** 0 on success, -1 on failure
133  **
134  *b Callable For Gesture Types:
135  **
136  *- - all
137  **
138  *b Callable From:
139  **
140  *- - C++
141  *- - Script
142  */
143  int begin_now();
144 
145  /*l
146  *b Description:
147  **
148  ** This function returns the time at which the gesture began.
149  **
150  *b Returns:
151  **
152  ** time in seconds when scenario began
153  **
154  *b Callable For Gesture Types:
155  **
156  *- - all
157  **
158  *b Callable From:
159  **
160  *- - C++
161  *- - Script
162  */
163  float get_tin();
164 
165  /*l
166  *b Returns:
167  **
168  ** 1 if the gesture has begun; 0 if not
169  **
170  *b Callable For Gesture Types:
171  **
172  *- - all
173  **
174  *b Callable From:
175  **
176  *- - C++
177  *- - Script
178  */
179  int get_has_begun_flag();
180 
181  /*l
182  *b Description:
183  **
184  ** This function notifies the gesture that it should complete
185  ** as soon as possible. To end a gesture immediately, call
186  ** abort_now().
187  **
188  *b Returns:
189  **
190  ** 0 on success, -1 on failure
191  **
192  *b Callable For Gesture Types:
193  **
194  *- - all
195  **
196  *b Callable From:
197  **
198  *- - C++
199  *- - Script
200  */
201  int end_gesture();
202 
203  /*l
204  *b Returns:
205  **
206  ** 1 if the gesture has completed; 0 if not
207  **
208  *b Callable For Gesture Types:
209  **
210  *- - all
211  **
212  *b Callable From:
213  **
214  *- - C++
215  *- - Script
216  */
217  int get_has_completed_flag();
218 
219  /*l
220  *b Description:
221  **
222  ** This function causes this gesture to abort. Aborting a gesture
223  ** doesn't destroy it. The gesture can be begun again if desired.
224  ** To end a gesture gracefully call end_gesture().
225  **
226  *b Arguments:
227  **
228  *a max_rampdown_interval - max amount of time spent trying to
229  *a smooth over any motion seams; pass
230  *a 0.5 for a smooth transition, pass
231  *a 0 for an immediate abort
232  **
233  *b Returns:
234  **
235  ** 0 on success, -1 on failure
236  **
237  *b Callable For Gesture Types:
238  **
239  *- - all
240  **
241  *b Callable From:
242  **
243  *- - C++
244  *- - Script
245  */
246  int abort_now(float max_rampdown_interval);
247 
248  /*l
249  *b Description:
250  **
251  ** This function causes the gesture object to be automatically
252  ** deleted when the gesture has completed. No further calls
253  ** through the diguyCharacterGesture object can or should
254  ** be made, so this function should only be called once all
255  ** durations, reps, etc. have been set.
256  **
257  *a automatic_destroy_flag - pass 1 to enable automatic
258  *a deletion
259  **
260  *b Returns:
261  **
262  ** 0 on success, -1 on failure
263  **
264  *b Callable For Gesture Types:
265  **
266  *- - all
267  **
268  *b Callable From:
269  **
270  *- - C++
271  *- - Script
272  */
273  int set_automatic_destroy_flag(int automatic_destroy_flag);
274 
275  /*l
276  *b Description:
277  **
278  ** This function sets whether joint angles in the gesture
279  ** will be interpolated. This takes more time, but results
280  ** in smoother motion at high frame rates.
281  **
282  *b Arguments:
283  **
284  *a flag - pass 1 to turn on interpolation, pass 0 to turn
285  *a off interpolation
286  **
287  *b Returns:
288  **
289  ** 0 on success, -1 on failure
290  **
291  *b Callable For Gesture Types:
292  **
293  *- - all
294  **
295  *b Callable From:
296  **
297  *- - C++
298  *- - Script
299  */
300  int set_interpolation_flag(int flag);
301 
302  /*l
303  *b Returns:
304  **
305  ** the most recent setting of set_interpolation_flag()
306  **
307  *b Callable For Gesture Types:
308  **
309  *- - all
310  **
311  *b Callable From:
312  **
313  *- - C++
314  *- - Script
315  */
316  int get_interpolation_flag();
317 
318  /*l
319  *b Returns:
320  **
321  ** how many channels are in the gesture
322  **
323  *b Callable For Gesture Types:
324  **
325  *- - all
326  **
327  *b Callable From:
328  **
329  *- - C++
330  *- - Script
331  */
332  int get_num_channels();
333 
334  /*l
335  *b Description:
336  **
337  ** This function sets the weight of the specified channel. The other
338  ** channel weights in a multi-channel gesture will be affected by this
339  ** call so that all channel weight add to 1.
340  **
341  ** If the gesture does not have the channel, this function has no
342  ** effect.
343  **
344  *b Arguments:
345  **
346  *a channel - which channel to affect; pass a single upper
347  *a case character (e.g., 'A')
348  *a channel_weight - value between 0 and 1; 1 means gesture is
349  *a entirely driven by specified channel, 0 means
350  *a specified channel has no effect on gesture
351  **
352  *b Returns:
353  **
354  ** 0 on success, -1 on failure
355  **
356  *b Callable For Gesture Types:
357  **
358  *- - all
359  **
360  *b Callable From:
361  **
362  *- - C++
363  *- - Script
364  */
365  int set_channel_weight(char channel, float channel_weight);
366 
367  /*l
368  *b Returns:
369  **
370  ** the current weight of the specified channel; see set_channel_weight()
371  **
372  *b Callable For Gesture Types:
373  **
374  *- - all
375  **
376  *b Callable From:
377  **
378  *- - C++
379  *- - Script
380  */
381  float get_channel_weight(char channel);
382 
383  /*l
384  *b Description:
385  **
386  ** This function schedules a smooth ramp of the channel weight
387  ** from its current value to the specified target value.
388  **
389  ** This function is equivalent to calling set_channel_weight()
390  ** many times over the course of a gesture.
391  **
392  ** Calling this function removes any pending channel weight targets
393  ** added by calls to either set_channel_weight_target() or
394  ** add_channel_weight_target().
395  **
396  *b Arguments:
397  **
398  *a channel - which channel to affect; pass a single upper
399  *a case character (e.g., 'A')
400  *a channel_weight_target - target channel weight; a value between
401  *a 0 and 1
402  *a blend_tin - when, relative to the start of the gesture,
403  *a the channel weight should begin moving
404  *a toward channel_weight_target
405  *a blend_tout - when, relative to the start of the gesture,
406  *a the channel weight should arrive at
407  *a channel_weight_target
408  *a blend_function_name - name of the curve to use to move between
409  *a current channel weight and target channel
410  *a weight
411  **
412  ** The possible blend function names are:
413  **
414  *a "HalfSine" - half of a sine curve going from 0 to 1;
415  *a good blend function for smooth entry and exit
416  *a "Linear" - linear line from 0 to 1
417  **
418  *b Returns:
419  **
420  ** 0 on success, -1 on failure
421  **
422  *b Callable For Gesture Types:
423  **
424  *- - all
425  **
426  *b Callable From:
427  **
428  *- - C++
429  *- - Script
430  */
431  int set_channel_weight_target(char channel,
432  float channel_weight_target,
433  float blend_tin,
434  float blend_tout,
435  const char* blend_function_name = 0);
436 
437  /*l
438  *b Description:
439  **
440  ** This function is similar to set_channel_weight_target(),
441  ** but adds the channel weight target to a queue of pending
442  ** targets. The gesture will not begin moving the current
443  ** channel weight to the specified target until all pending
444  ** channel weight targets from previous calls to
445  ** set_channel_weight_target() and add_channel_weight_target()
446  ** have been reached.
447  **
448  *b Arguments:
449  **
450  *a channel - which channel to affect; pass a single upper
451  *a case character (e.g., 'A')
452  *a channel_weight_target - target channel weight; a value between
453  *a 0 and 1
454  *a blend_tin - when, relative to the start of the gesture,
455  *a the channel weight should begin moving
456  *a toward channel_weight_target
457  *a blend_tout - when, relative to the start of the gesture,
458  *a the channel weight should arrive at
459  *a channel_weight_target
460  *a blend_function_name - name of the curve to use to move between
461  *a current channel weight and target channel
462  *a weight
463  **
464  *b Lua Example:
465  **
466  *e -- Create a gesture.
467  *e local gesture1 = character:create_gesture("example_gesture");
468  *e
469  *e -- Set the starting channel weight of channel 'A' to 0.2.
470  *e gesture1:set_channel_weight('A', 0.2);
471  *e
472  *e --
473  *e -- Set a channel weight target. This call essentially does this:
474  *e --
475  *e -- Smoothly change the channel A weight of the gesture from its
476  *e -- current value (0.2) to 0, starting at 1.5 seconds into the
477  *e -- gesture, finishing 3.5 seconds into the gesture.
478  *e --
479  *e gesture1:set_channel_weight_target(
480  *e 'A', -- channel to change
481  *e 0.0, -- target weight
482  *e 1.5, -- when to start changing
483  *e 3.5, -- when to stop changing
484  *e "HalfSine"); -- curve to use for blend
485  *e
486  *e --
487  *e -- Add another channel weight target. This call essentially does this:
488  *e --
489  *e -- Smoothly change the channel A weight of the gesture from its
490  *e -- last set channel weight (0) to 0.8, starting at 3.5 seconds into
491  *e -- the gesture, finishing 5.5 seconds into the gesture.
492  *e --
493  *e gesture1:add_channel_weight_target(
494  *e 'A',
495  *e 0.8,
496  *e 3.5,
497  *e 5.5,
498  *e "HalfSine");
499  *e
500  *e --
501  *e -- We're done tweaking the gesture. Set its automatic destroy flag
502  *e -- so that it will be deleted when the gesture has completed.
503  *e --
504  *e gesture1:set_automatic_destroy_flag(1);
505  **
506  *b Returns:
507  **
508  ** 0 on success, -1 on failure
509  **
510  *b Callable For Gesture Types:
511  **
512  *- - all
513  **
514  *b Callable From:
515  **
516  *- - C++
517  *- - Script
518  */
519  int add_channel_weight_target(char channel,
520  float channel_weight_target,
521  float blend_tin,
522  float blend_tout,
523  const char* blend_function_name = 0);
524 
525  /*l
526  *b Description:
527  **
528  ** This function sets how long the gesture will take to
529  ** "rampup" control of joints from the base motion to the
530  ** gesture. A longer rampup will result in a smoother
531  ** transition into the gesture.
532  **
533  ** If the rampup duration is longer than the first motion
534  ** of the gesture, it will be shortened to be the same
535  ** duration as the first motion. Motion motions are 0.5
536  ** seconds or shorter.
537  **
538  ** The default duration is 0.5 seconds.
539  **
540  *b Arguments:
541  **
542  *a duration - rampup duration, in seconds
543  **
544  *b Returns:
545  **
546  ** 0 on success, -1 on failure
547  **
548  *b Callable For Gesture Types:
549  **
550  *- - all
551  **
552  *b Callable From:
553  **
554  *- - C++
555  *- - Script
556  */
557  int set_rampup_duration(float duration);
558 
559  /*l
560  *b Returns:
561  **
562  ** the rampup duration as set by set_rampup_duration()
563  **
564  *b Callable For Gesture Types:
565  **
566  *- - all
567  **
568  *b Callable From:
569  **
570  *- - C++
571  *- - Script
572  */
573  float get_rampup_duration();
574 
575  /*l
576  *b Description:
577  **
578  ** This function sets which blend function will be used during
579  ** rampup to transition control of joints from the base motion
580  ** to the gesture.
581  **
582  ** The default blend function is "HalfSine".
583  **
584  *b Arguments:
585  **
586  *a blend_function_name - new rampup blend function
587  **
588  *b Returns:
589  **
590  ** 0 on success, -1 on failure
591  **
592  *b Callable For Gesture Types:
593  **
594  *- - all
595  **
596  *b Callable From:
597  **
598  *- - C++
599  *- - Script
600  */
601  int set_rampup_blend_function_name(const char* blend_function_name);
602 
603  /*l
604  *b Returns:
605  **
606  ** the rampup blend function as set by
607  ** set_rampup_blend_function_name()
608  **
609  *b Callable For Gesture Types:
610  **
611  *- - all
612  **
613  *b Callable From:
614  **
615  *- - C++
616  *- - Script
617  */
618  const char* get_rampup_blend_function_name();
619 
620  /*l
621  *b Description:
622  **
623  ** This function sets how long the gesture will take to
624  ** "rampdown" control of joints from the gesture to the
625  ** base motion. A longer rampdown will result in a smoother
626  ** transition out of the gesture.
627  **
628  *b Arguments:
629  **
630  *a duration - rampdown duration, in seconds
631  **
632  *b Returns:
633  **
634  ** 0 on success, -1 on failure
635  **
636  *b Callable For Gesture Types:
637  **
638  *- - all
639  **
640  *b Callable From:
641  **
642  *- - C++
643  *- - Script
644  */
645  int set_rampdown_duration(float duration);
646 
647  /*l
648  *b Returns:
649  **
650  ** the rampdown duration as set by set_rampdown_duration()
651  **
652  *b Callable For Gesture Types:
653  **
654  *- - all
655  **
656  *b Callable From:
657  **
658  *- - C++
659  *- - Script
660  */
661  float get_rampdown_duration();
662 
663  /*l
664  *b Description:
665  **
666  ** This function sets which blend function will be used during
667  ** rampdown to transition control of joints from the gesture
668  ** to the base motion.
669  **
670  ** The default blend function is "HalfSine".
671  **
672  *b Arguments:
673  **
674  *a blend_function_name - new rampdown blend function
675  **
676  *b Returns:
677  **
678  ** 0 on success, -1 on failure
679  **
680  *b Callable For Gesture Types:
681  **
682  *- - all
683  **
684  *b Callable From:
685  **
686  *- - C++
687  *- - Script
688  */
689  int set_rampdown_blend_function_name(const char* blend_function_name);
690 
691  /*l
692  *b Returns:
693  **
694  ** the rampdown blend function as set by
695  ** set_rampdown_blend_function_name()
696  **
697  *b Callable For Gesture Types:
698  **
699  *- - all
700  **
701  *b Callable From:
702  **
703  *- - C++
704  *- - Script
705  */
706  const char* get_rampdown_blend_function_name();
707 
708  /*l
709  *b Description:
710  **
711  ** This function returns the default blend duration. This
712  ** is the amount of time the gesture will take to blend
713  ** motions together to produce more seamless motions.
714  **
715  *b Returns:
716  **
717  ** default blend duration, in seconds
718  **
719  *b Callable For Gesture Types:
720  **
721  *- - all
722  **
723  *b Callable From:
724  **
725  *- - C++
726  *- - Script
727  */
728  float get_default_blend_duration();
729 
730 
731 /*****************************************************************************/
737  /*l
738  *b Description:
739  **
740  ** This function sets the number of times the gesture will
741  ** be repeated. The optimal overall duration can be optionally
742  ** computed based on the number of repetitions specified.
743  **
744  *i Table Gestures:
745  **
746  ** Table gestures do not yet make use of the overall duration.
747  ** The derive_duration_flag should be given a value of 0.
748  **
749  *b Arguments:
750  **
751  *a max_reps - number of times gesture will be repeated
752  *a derive_duration_flag - pass 1 to derive optimal overall duration
753  *a from passed max_reps
754  **
755  *b Returns:
756  **
757  ** 0 on success, -1 on failure
758  **
759  *b Callable For Gesture Types:
760  **
761  *- - progression
762  **
763  *b Callable From:
764  **
765  *- - C++
766  *- - Script
767  */
768  int set_max_reps(int max_reps,
769  int derive_duration_flag = 1);
770 
771  /*l
772  *b Returns:
773  **
774  ** the number of times the gesture will be repeated
775  **
776  *b Callable For Gesture Types:
777  **
778  *- - progression
779  **
780  *b Callable From:
781  **
782  *- - C++
783  *- - Script
784  */
785  int get_max_reps();
786 
787  /*l
788  *b Description:
789  **
790  ** This function sets the overall duration the gesture will
791  ** have. The optimal number of repetitions can be optionally
792  ** computed based on the specified duration.
793  **
794  ** Calling this function will override any previous calls
795  ** that set specific stage durations (e.g., as set by a call
796  ** to set_stage_duration()).
797  **
798  *i Table Gestures:
799  **
800  ** Table gestures do not yet make use of the overall duration.
801  **
802  *b Arguments:
803  **
804  *a overall_duration - duration of all stages of the gesture,
805  *a in seconds
806  *a derive_max_reps_flag - pass 1 to derive optimal number of
807  *a reps for the given duration
808  **
809  *b Returns:
810  **
811  ** 0 on success, -1 on failure
812  **
813  *b Callable For Gesture Types:
814  **
815  *- - progression
816  **
817  *b Callable From:
818  **
819  *- - C++
820  *- - Script
821  */
822  int set_overall_duration(float overall_duration,
823  int derive_max_reps_flag = 1);
824 
825  /*l
826  *b Returns:
827  **
828  ** the overall duration in seconds of the gesture
829  **
830  *i Table Gestures:
831  **
832  ** Table gestures do not yet make use of the overall duration.
833  **
834  *b Callable For Gesture Types:
835  **
836  *- - progression
837  **
838  *b Callable From:
839  **
840  *- - C++
841  *- - Script
842  */
843  float get_overall_duration();
844 
845  /*l
846  *b Returns:
847  **
848  ** the number of stages in the gesture
849  **
850  *b Callable For Gesture Types:
851  **
852  *- - progression
853  **
854  *b Callable From:
855  **
856  *- - C++
857  *- - Script
858  */
859  int get_num_progression_stages();
860 
861  /*l
862  *b Description:
863  **
864  ** This function sets the exact duration of the specified stage
865  ** of the gesture.
866  **
867  *b Arguments:
868  **
869  *a stage - stage; an integer between 1 and 3
870  *a duration - duration of stage, in seconds
871  **
872  *b Returns:
873  **
874  ** 0 on success, -1 on failure
875  **
876  *b Callable For Gesture Types:
877  **
878  *- - progression
879  **
880  *b Callable From:
881  **
882  *- - C++
883  *- - Script
884  */
885  int set_progression_stage_duration(int stage, float duration);
886 
887  /*l
888  *b Returns:
889  **
890  ** the duration in seconds of specified stage of the gesture
891  **
892  *b Arguments:
893  **
894  *a stage - stage; an integer between 1 and 3
895  **
896  *b Callable For Gesture Types:
897  **
898  *- - progression
899  **
900  *b Callable From:
901  **
902  *- - C++
903  *- - Script
904  */
905  float get_progression_stage_duration(int stage);
906 
907  /*l
908  *b Returns:
909  **
910  ** the optimal duration in seconds of specified stage of the gesture
911  **
912  *b Arguments:
913  **
914  *a stage - stage; an integer between 1 and 3
915  **
916  *b Callable For Gesture Types:
917  **
918  *- - progression
919  **
920  *b Callable From:
921  **
922  *- - C++
923  *- - Script
924  */
925  float get_progression_stage_optimal_duration(int stage);
926 
927 
928 /*****************************************************************************/
934  /*l
935  *b Description:
936  **
937  ** This function sets the desired action for table gestures.
938  ** The gesture will begin a transition to the desired action
939  ** as soon as it can.
940  **
941  ** The time required to reach the desired action can be
942  ** determined by calling the
943  ** get_time_required_to_reach_table_action_desired() function.
944  **
945  *b Arguments:
946  **
947  *a action_name - name of desired action
948  **
949  *b Returns:
950  **
951  ** 0 on success, -1 on failure
952  **
953  *b Callable For Gesture Types:
954  **
955  *- - table
956  **
957  *b Callable From:
958  **
959  *- - C++
960  *- - Script
961  */
962  int set_table_action_desired(const char* action_name);
963 
964  /*l
965  *b Description:
966  **
967  ** This function returns the desired action for table gestures.
968  **
969  ** If this gesture is not a table gesture the string "error"
970  ** will be returned.
971  **
972  ** The desired action can be set using the
973  ** set_table_action_desired() function.
974  **
975  *b Returns:
976  **
977  ** name of desired action, "error" on error
978  **
979  *b Callable For Gesture Types:
980  **
981  *- - table
982  **
983  *b Callable From:
984  **
985  *- - C++
986  *- - Script
987  */
988  const char* get_table_action_desired();
989 
990  /*l
991  *b Description:
992  **
993  ** This function returns how much time it will take to reach
994  ** the desired action for table gestures.
995  **
996  *b Returns:
997  **
998  ** time in seconds needed to reach desired action
999  **
1000  *b Callable For Gesture Types:
1001  **
1002  *- - table
1003  **
1004  *b Callable From:
1005  **
1006  *- - C++
1007  *- - Script
1008  */
1009  float get_time_required_to_reach_table_action_desired();
1010 
1011  /*l
1012  *b Description:
1013  **
1014  ** This function returns how many actions a table gesture contains.
1015  ** The function get_table_action_at_index() can be called to
1016  ** get the name of the actions.
1017  **
1018  *b Returns:
1019  **
1020  ** number of actions in table gesture
1021  **
1022  *b Callable For Gesture Types:
1023  **
1024  *- - table
1025  **
1026  *b Callable From:
1027  **
1028  *- - C++
1029  *- - Script
1030  */
1031  int get_num_table_actions();
1032 
1033  /*l
1034  *b Description:
1035  **
1036  ** This function returns the name of the table action at the
1037  ** specified index.
1038  **
1039  *b Returns:
1040  **
1041  ** name of table action; NULL if no action at given index
1042  **
1043  *b Callable For Gesture Types:
1044  **
1045  *- - table
1046  **
1047  *b Callable From:
1048  **
1049  *- - C++
1050  *- - Script
1051  */
1052  const char* get_table_action_at_index(int index);
1053 
1054  /*l
1055  *b Description:
1056  **
1057  ** This function returns how long a single repetition of a
1058  ** table action takes.
1059  **
1060  *b Arguments:
1061  **
1062  *a action_name - name of action
1063  **
1064  *b Returns:
1065  **
1066  ** duration of single rep, in seconds
1067  **
1068  *b Callable For Gesture Types:
1069  **
1070  *- - table
1071  **
1072  *b Callable From:
1073  **
1074  *- - C++
1075  *- - Script
1076  */
1077  float get_table_action_rep_duration(const char* action_name);
1078 
1079  /*l
1080  *b Description:
1081  **
1082  ** This function returns how long the transition motion(s)
1083  ** take between two table actions.
1084  **
1085  *b Arguments:
1086  **
1087  *a action_from - name of origin action
1088  *a action_to - name of destination action
1089  **
1090  *b Returns:
1091  **
1092  ** duration of transition, in seconds
1093  **
1094  *b Callable For Gesture Types:
1095  **
1096  *- - table
1097  **
1098  *b Callable From:
1099  **
1100  *- - C++
1101  *- - Script
1102  */
1103  float get_table_transition_duration(const char* action_from,
1104  const char* action_to);
1105 
1106  /*l
1107  *b Description:
1108  **
1109  ** This function sets which action a table gesture should
1110  ** begin at when begin_now() is called. The gesture's first
1111  ** motion will be the transition motion from the beginning
1112  ** action to the desired action if the actions differ, or
1113  ** the looping motion of the desired action if they are the
1114  ** same.
1115  **
1116  ** The default beginning action is the action at index 0.
1117  **
1118  *b Arguments:
1119  **
1120  *a action_name - name of beginning action
1121  **
1122  *b Returns:
1123  **
1124  ** 0 on success, -1 on failure
1125  **
1126  *b Callable For Gesture Types:
1127  **
1128  *- - table
1129  **
1130  *b Callable From:
1131  **
1132  *- - C++
1133  *- - Script
1134  */
1135  int set_table_action_begin(const char* action_name);
1136 
1137  /*l
1138  *b Returns:
1139  **
1140  ** the name of the beginning action of a table gesture,
1141  ** as set by set_table_action_begin()
1142  **
1143  *b Callable For Gesture Types:
1144  **
1145  *- - table
1146  **
1147  *b Callable From:
1148  **
1149  *- - C++
1150  *- - Script
1151  */
1152  const char* get_table_action_begin();
1153 
1154  /*l
1155  *b Description:
1156  **
1157  ** This function sets which action a table gesture should
1158  ** end with when end_gesture() is called. The default ending
1159  ** action is the action at index 0.
1160  **
1161  *b Arguments:
1162  **
1163  *a action_name - name of ending action
1164  **
1165  *b Returns:
1166  **
1167  ** 0 on success, -1 on failure
1168  **
1169  *b Callable For Gesture Types:
1170  **
1171  *- - table
1172  **
1173  *b Callable From:
1174  **
1175  *- - C++
1176  *- - Script
1177  */
1178  int set_table_action_end(const char* action_name);
1179 
1180  /*l
1181  *b Returns:
1182  **
1183  ** the name of the ending action of a table gesture,
1184  ** as set by set_table_action_end()
1185  **
1186  *b Callable For Gesture Types:
1187  **
1188  *- - table
1189  **
1190  *b Callable From:
1191  **
1192  *- - C++
1193  *- - Script
1194  */
1195  const char* get_table_action_end();
1196 
1197  /*l
1198  *b Returns:
1199  **
1200  ** the name of the action the table gesture is currently
1201  ** playing
1202  **
1203  *b Callable For Gesture Types:
1204  **
1205  *- - table
1206  **
1207  *b Callable From:
1208  **
1209  *- - C++
1210  *- - Script
1211  */
1212  const char* get_table_action_now();
1213 
1214  /*l
1215  *b Returns:
1216  **
1217  ** the name of the action the table gesture will play next
1218  **
1219  *b Callable For Gesture Types:
1220  **
1221  *- - table
1222  **
1223  *b Callable From:
1224  **
1225  *- - C++
1226  *- - Script
1227  */
1228  const char* get_table_action_next();
1229 
1230  /*l
1231  *b Description:
1232  **
1233  ** This function forces the current action of the table gesture
1234  ** to be the action identified by action_name.
1235  **
1236  *b Arguments:
1237  **
1238  *a action_name - name of the action to be performed by
1239  *a the gesture
1240  *a include_transition_arc - flag for whether the transition
1241  *a motion from the current action to
1242  *a the new action is included;
1243  *a pass 1 for best chance of good looking
1244  *a transition;
1245  *a pass 0 for fastest response
1246  *a max_rampdown_interval - max amount of time spent trying to
1247  *a smooth over any motion seams; set
1248  *a to 0.5 for a smooth transition, set
1249  *a to 0 for a potentially rough transition
1250  **
1251  *b Returns:
1252  **
1253  ** 0 on success, -1 on failure
1254  **
1255  *b Callable From:
1256  **
1257  *- - C++
1258  *- - Script
1259  */
1260  int force_table_action(const char* action_name,
1261  int include_transition_arc = 1,
1262  float max_rampdown_interval = 0.5f);
1263 
1264 
1265 /*****************************************************************************/
1271  /*l
1272  *b Description:
1273  **
1274  ** This is an enumeration of the different callbacks
1275  ** that can be registered with add_callback() and
1276  ** add_callback_script().
1277  **
1278  *b Usable From:
1279  **
1280  *- - C++
1281  *- - Script
1282  */
1283  enum {
1284  CALLBACK_ID_CREATE = 1,
1285  CALLBACK_ID_DESTROY,
1286  CALLBACK_ID_ATTAINED_DESIRED_ACTION
1287  };
1288 
1289 #ifdef CPLUSPLUS_ONLY
1290 
1291  /*l
1292  *b Description:
1293  **
1294  ** This function adds a user callback.
1295  **
1296  *b Arguments:
1297  **
1298  *a callback - pointer to function with prototype
1299  *a diguyCharacterGestureCallback (typedefed above)
1300  *a callback_id - integer id of when this callback is to be called
1301  *a callback_params - not currently used; pass NULL
1302  *a callback_user_data - pointer for user's own use; DI-Guy will
1303  *a do nothing to the contents of this pointer
1304  *a beyond passing it back when the callback is
1305  *a invoked
1306  **
1307  ** callback_id should be one of the following values:
1308  **
1309  *i CALLBACK_ID_CREATE
1310  **
1311  ** This callback will be called when a new gesture is created.
1312  **
1313  *i CALLBACK_ID_DESTROY
1314  **
1315  ** This callback will be called when the gesture is destroyed.
1316  **
1317  *i CALLBACK_ID_ATTAINED_DESIRED_ACTION
1318  **
1319  ** This callback will be called when a table gesture has reached
1320  ** its desired action as set by set_table_action_desired().
1321  **
1322  *i Callback Return Values:
1323  **
1324  ** Callbacks return a value of type diguyCallbackReturn,
1325  ** which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE.
1326  ** If the callback returns DIGUY_CALLBACK_STOP, the default handler
1327  ** of the function will not be called; the callback is asserting
1328  ** that it has done everything necessary for the function call.
1329  ** If the callback returns DIGUY_CALLBACK_CONTINUE, the default
1330  ** handler for the function will be called after the callback.
1331  **
1332  *b Returns:
1333  **
1334  ** 0 on success, -1 on failure
1335  **
1336  *b Callable From:
1337  **
1338  *- - C++
1339  */
1340  int add_callback(int callback_id,
1342  void* callback_params = 0,
1343  void* callback_user_data = 0);
1344 
1345  /*l
1346  *b Description:
1347  **
1348  ** This function removes a user callback. All callbacks matching
1349  ** the specified callback_id and callback function will be removed.
1350  **
1351  *b Arguments:
1352  **
1353  *a callback_id - integer id of when this callback is to be called
1354  *a callback - pointer to function with prototype
1355  *a diguyCharacterGestureCallback (typedefed above)
1356  **
1357  *b Returns:
1358  **
1359  ** 0 on success, -1 on failure
1360  **
1361  *b Callable From:
1362  **
1363  *- - C++
1364  */
1365  int remove_callback(int callback_id,
1366  diguyCharacterGestureCallback* callback);
1367 
1368  /*l
1369  *b Description:
1370  **
1371  ** This function removes a user callback. All callbacks matching
1372  ** the specified callback_id and callback_user_data pointer will
1373  ** be removed.
1374  **
1375  *b Arguments:
1376  **
1377  *a callback_id - integer id of when this callback is to be called
1378  *a callback_user_data - pointer for user's own use
1379  **
1380  *b Returns:
1381  **
1382  ** 0 on success, -1 on failure
1383  **
1384  *b Callable From:
1385  **
1386  *- - C++
1387  */
1388  int remove_callback_with_user_data(int callback_id,
1389  void* callback_user_data);
1390 
1391 #endif /* CPLUSPLUS_ONLY */
1392 
1393  /*l
1394  *b Description:
1395  **
1396  ** This function adds a user callback script. Callback scripts can
1397  ** be removed with remove_callback_script().
1398  **
1399  ** See diguyCharacter::add_callback_script() for an example
1400  ** of use.
1401  **
1402  *b Arguments:
1403  **
1404  *a callback_id - integer id of the callback
1405  *a callback_script - script text of callback to be added
1406  *a callback_script_type - the type of script contained in
1407  *a callback_script
1408  **
1409  ** If NULL is passed for callback_script_type, a default script type
1410  ** will be derived based on the default script interpreter of the
1411  ** scenario.
1412  **
1413  *i lua specific:
1414  **
1415  ** When the script is called, the object for which it is being called
1416  ** will be in the $callback_object scalar.
1417  **
1418  ** To pass NULL when calling from a lua script, use nil.
1419  **
1420  *b Returns:
1421  **
1422  ** 0 on success, -1 on failure
1423  **
1424  *b Callable From:
1425  **
1426  *- - C++
1427  *- - Script
1428  */
1429  int add_callback_script(int callback_id,
1430  const char* callback_script,
1431  const char* callback_script_type = NULL);
1432 
1433  /*l
1434  *b Description:
1435  **
1436  ** This function removes a user callback script previously added with
1437  ** add_callback_script().
1438  **
1439  ** See diguyCharacter::remove_callback_script() for an example
1440  ** of use.
1441  **
1442  *b Arguments:
1443  **
1444  *a callback_id - integer id of the callback
1445  *a callback_script - script text of callback previously added
1446  *a callback_script_type - the type of script contained in
1447  *a callback_script
1448  **
1449  ** If NULL is passed for callback_script, all callback
1450  ** scripts whose ids match callback_id and whose types match
1451  ** callback_script_type will be removed.
1452  **
1453  ** If NULL is passed for callback_script_type, a default script type
1454  ** will be derived based on the default script interpreter of the
1455  ** scenario.
1456  **
1457  *i lua specific:
1458  **
1459  ** To pass NULL when calling from a lua script, use nil.
1460  **
1461  *b Returns:
1462  **
1463  ** 0 on success, -1 on failure
1464  **
1465  *b Callable From:
1466  **
1467  *- - C++
1468  *- - Script
1469  */
1470  int remove_callback_script(int callback_id,
1471  const char* callback_script,
1472  const char* callback_script_type = NULL);
1473 
1474 
1475 /****************************************************************************/
1476 /****************************************************************************/
1477 /*****************************************************************************/
1488 /****************************************************************************/
1489 /****************************************************************************/
1490 /****************************************************************************/
1491 
1492  /*l
1493  *b Description:
1494  **
1495  ** This function is deprecated. Use get_num_progression_stages()
1496  ** instead.
1497  */
1498  int get_num_stages();
1499 
1500  /*l
1501  *b Description:
1502  **
1503  ** This function is deprecated. Use set_progression_stage_duration()
1504  ** instead.
1505  */
1506  int set_stage_duration(int stage, float duration);
1507 
1508  /*l
1509  *b Description:
1510  **
1511  ** This function is deprecated. Use get_progression_stage_duration()
1512  ** instead.
1513  */
1514  float get_stage_duration(int stage);
1515 
1516  /*l
1517  *b Description:
1518  **
1519  ** This function is deprecated. Use
1520  ** get_progression_stage_optimal_duration() instead.
1521  */
1522  float get_stage_optimal_duration(int stage);
1523 
1524 
1529 #ifdef CPLUSPLUS_ONLY
1530 
1531  bdiGestureInstance* get_scripted_object() {return m_scripted_object;}
1532 
1533 private:
1534 
1535  /*l
1536  ** A private constructor. Call diguyCharacter::create_gesture()
1537  ** to create this object.
1538  */
1539  diguyCharacterGesture(bdiGestureInstance* scripted_object,
1540  bdiScenarioCharacter* character);
1541 
1542  /*l
1543  ** A private destructor. Call diguyCharacter::destroy_gesture()
1544  ** to destroy this object.
1545  */
1547 
1548  /*l
1549  ** A pointer to internal data.
1550  */
1551  bdiGestureInstance* m_scripted_object;
1552  bdiScenarioCharacter* m_character;
1553 
1554  friend class bdiScenarioCharacter;
1555  friend class bdiGestureInstance;
1556  friend class diguyCharacter;
1557 
1558 #endif
1559 
1560 };
1561 
1562 
1563 #endif /* __diguyCharacterGesture_H */
1564 
1565 
1566 /*
1567  * Copyright (C) 1992-2013 Boston Dynamics
1568  * ALL RIGHTS RESERVED.
1569  *
1570  * These coded instructions, statements, and computer programs
1571  * contain unpublished proprietary information of Boston Dynamics
1572  * and are protected by Copyright Laws of the United States.
1573  * They may not be used, duplicated, or disclosed in any form, in
1574  * whole or in part, without the prior written consent from Boston
1575  * Dynamics.
1576  *
1577  * RESTRICTED RIGHTS LEGEND
1578  * Use, duplication, or disclosure by the government is subject
1579  * to restrictions as set forth in FAR 52.227.19(c)(2) or
1580  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
1581  * Computer Software clause at DFARS 252.227-7013 and/or in
1582  * similar or successor clauses in the FAR, or the DOD or NASA
1583  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
1584  * Commercial Computer Software--Restricted Rights at 48 CFR
1585  * 52.227-19, as applicable. Unpublished-rights reserved under
1586  * the Copyright Laws of the United States.
1587  * Contractor/Manufacturer is:
1588  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
1589  */
1590