diguyCharacterPoseOverride

Generated from diguyCharacterPoseOverride.h

DI-Guy API Version 12.5.1

This file was automatically generated from diguyCharacterPoseOverride.h. Do not edit this file directly; the changes will be lost.
Includes: stdlib.h | declspec_diguy.h

Contents:

Alphabetical Index

class diguyCharacterPoseOverride

class BDI_DECLSPEC_diguy diguyCharacterPoseOverride
{
public:
#ifdef CPLUSPLUS_ONLY
    float* allocate_pose_array();
    int free_pose_array(float* array);
#endif
    int get_num_vars();
#ifdef CPLUSPLUS_ONLY
    char** allocate_var_names();
    int get_var_names(char** var_names);
    int free_var_names(char** var_names);
    int get_var_index(const char* varname);
    int get_pose_in_radians(float* pose_array);
    int set_pose_in_radians(float* pose_array,
        float* weights_array = NULL,
        float default_weight = 1.0f);
#endif
    float get_default_weight();
    int set_default_weight(float default_weight);

function diguyCharacterPoseOverride::allocate_pose_array

Prototype:

float* allocate_pose_array();
Description:

Allocates an array of floats to hold the joint angles for each degree of freedom, or weights to specify how pose angles will affect a character. The size of the array will be equal to the value returned by get_num_vars().

The allocated array should be freed by calling free_pose_array().

The allocated array will contain uninitialized values.

If the array is to hold weights, each entry in the array should be set to a valid value between 0.0 and 1.0.

If the array is to hold pose angles, each pose variable whose corresponding weight is going to be non-0 should be set to a valid value.

Returns:

pointer to array of floats, NULL if the array cannot be allocated

Callable From:

C++ Example:

See example for set_pose_in_radians().

function diguyCharacterPoseOverride::free_pose_array

Prototype:

int free_pose_array(float* array);
Description:

Frees an array allocated with allocate_pose_array().

Arguments:

arrayarray of pose angles to be freed
Returns:

0 on success, -1 on failure

Callable From:

function diguyCharacterPoseOverride::get_num_vars

Prototype:

int get_num_vars();
Description:

This function returns the number of the variables representing joint angles.

Returns:

an integer representing the number of joint angles

Callable From:

function diguyCharacterPoseOverride::allocate_var_names

Prototype:

char** allocate_var_names();
Description:

This function allocates an array of pointer to char*s (i.e., C-style strings).

This array can then be passed to get_var_names().

It should be freed using the function free_var_names(). The size of the array will be equal to the value returned by get_num_vars().

Returns:

an array of pointers to char*'s (i.e. pointers to strings)

Callable From:

C++ Example:

See example for get_var_names().

function diguyCharacterPoseOverride::get_var_names

Prototype:

int get_var_names(char** var_names);
Description:

This function fills out the passed array of strings with the list of the names of the variables representing joint angles.

Arguments:

var_namesan array of strings as allocated by allocate_var_names()
Returns:

0 on success, -1 on failure

Callable From:

C++ Example:

//
// Create a pose override for character.
//
pose_override = character1->create_pose_override();

//
// Allocate a list of joint angle names and fill it.
//  Print the joint angle names, then destroy the array.
//
char** varnames = pose_override->allocate_var_names();
pose_override->get_var_names(varnames);

for (i = 0; i < character1->get_pose_array_size(); i++)
bdi_log_printf(BDI_LOG_INFO, "%s\n", varnames[i]);

pose_override->free_var_names(varnames);

function diguyCharacterPoseOverride::free_var_names

Prototype:

int free_var_names(char** var_names);
Description:

This function frees the array of strings allocated by allocate_var_names().

Arguments:

var_namesan array of strings as allocated by allocate_var_names()
Returns:

0 on success, -1 on failure

Callable From:

function diguyCharacterPoseOverride::get_var_index

Prototype:

int get_var_index(const char* varname);
Description:

Get the index of the given variable in the array of pose angles.

Arguments:

varnamethe name of the pose angle variable whose index is desired
Returns:

index of the pose variable, if it exists, -1 if not

Callable From:

C++ Example:

See example for set_pose_in_radians().

function diguyCharacterPoseOverride::get_pose_in_radians

Prototype:

int get_pose_in_radians(float* pose_array);
Description:

This function fills out the passed array of floats with the most recent values passed in a call to set_pose_in_radians().

Note that this may not be the actual pose of the character; this is only the pose angles for this specific pose override. Other pose overrides, gazing, etc., will also affect the pose of the character. Use the function diguyCharacter::get_pose_in_radians() to read the "real" pose of the character, as computed by the DI-Guy motion engine.

Arguments:

pose_arrayarray of floats allocated by allocate_pose_array()
Returns:

0 on success, -1 on failure

Callable From:

function diguyCharacterPoseOverride::set_pose_in_radians

Prototype:

int set_pose_in_radians(float* pose_array,
    float* weights_array = NULL,
    float default_weight = 1.0f);
Description:

This function specifies the joint angle data that will modify or override the joint angles the character normally computes. The replacement data is in pose_array.

If weights array is non-NULL, then each element specifies the proportion of the value on pose array to mix in with the value normally computed by the character. A weight of 0.0 means to ignore the value in pose_array. A weight of 1.0 means fully override the value computed by the character.

If weights_array is NULL, then default_weight will be used for all of the joint angles.

Note that all weights for an Euler triple (e.g. - q.cervical_rzrxry) must be equal to ensure proper interpolation.

Also note that the first six variables that contain the character's overall position and orientation cannot be changed using a pose override. These values must be changed using the functions diguyCharacter::set_position() and diguyCharacter::set_orientation().

Arguments:

pose_array the array containing the pose angles for this override object
weight_array the multiplier used to determine how the new pose_array values are to be combined with the existing pose
default_weightthe value to be used to set the weights if weights_array is NULL
Returns:

0 on success, -1 on failure

Callable From:

C++ Example:

//
// Create a pose override for character.
//
pose_override = character1->create_pose_override();

//
// Allocate an array for pose angles.
//
pose_array = pose_override->allocate_pose_array();
for (i=0; i<pose_override->get_num_vars(); i++)
pose_array[i] = 0.0f;

//
// Allocate a weights_array, and initialize it to all 0s.
//
weights_array = pose_override->allocate_pose_array();
for (i=0; i<pose_override->get_num_vars(); i++)
weights_array[i] = 0.0f;

//
// Find the indices of the character's back angles.  Set the
//  weights for these angles in weights_array to 1.0.  This
//  means that when we call set_pose_in_radians(), the values
//  in pose_array will completely override the original
//  data for the back.
//
back_rz_index = pose_override->get_var_index("q.back_rz");
back_rx_index = pose_override->get_var_index("q.back_rx");
back_ry_index = pose_override->get_var_index("q.back_ry");

pose_array[back_rz_index] = 0.57f; // angle measured in radians
pose_array[back_rx_index] = 0.0f;  // angle measured in radians
pose_array[back_ry_index] = 0.0f;  // angle measured in radians

weights_array[back_rz_index] = 1.0f;
weights_array[back_rx_index] = 1.0f;
weights_array[back_ry_index] = 1.0f;

pose_override->set_pose_in_radians(pose_array,
weights_array,
0.0f);

function diguyCharacterPoseOverride::get_default_weight

Prototype:

float get_default_weight();
Description:

Get the default weight for pose angles.

Returns:

the default pose angle weight

Callable From:

function diguyCharacterPoseOverride::set_default_weight

Prototype:

int set_default_weight(float default_weight);
Description:

Set the default weight for pose angles.

The default weight will be used to set values in a pose's weights array if the array passed in, for instance, set_pose_in_radians(), is NULL.

Arguments:

default_weightthe desired default weight
Returns:

0 on success, -1 on failure

Callable From:


Alphabetical Index




Copyright (C) 1992-2012 Boston Dynamics

ALL RIGHTS RESERVED.

These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.

Contractor/Manufacturer is:

Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.