diguyCharacterPoseOverride Class Declaration

diguyCharacterPoseOverride.h

DI-Guy API Version 5.1.26

This file was automatically generated from comments in the C/C++ header file diguyCharacterPoseOverride.h. Do not edit this file directly; the changes will be lost. Please mail suggestions or corrections to diguy@bdi.com

Alphabetical Index

Includes: stdlib.h | declspec_diguy.h

class diguyCharacterPoseOverride

class BDI_DECLSPEC_diguy diguyCharacterPoseOverride
{
public:
    float* allocate_pose_array();
   
    int free_pose_array(float* array);
    int get_num_vars();
    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);
    float get_default_weight();
    int set_default_weight(float default_weight);
#ifdef CPLUSPLUS_ONLY
    bdiPoseOverride* get_scripted_object() {return m_scripted_object;}
};

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 unitialized 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.

Callable From:

None.
Returns:

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

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().

Callable From:

Arguments:

arrayarray of pose angles to be freed
Returns:

0 on success, -1 on failure.

function diguyCharacterPoseOverride::get_num_vars

Prototype:

int get_num_vars();
Description:

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

Callable From:

None.
Returns:

An integer representing the number of joint angles.

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().

Callable From:

None.
Returns:

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

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.

Callable From:

Arguments:

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

0 on success, -1 on failure.

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_pose_array().

Callable From:

Arguments:

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

0 on success, -1 on failure.

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.

Callable From:

Arguments:

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

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

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 current pose. Angles will be expressed in radians. This pose can be stored for later use, or altered and then passed back into set_pose_in_radians().

Callable From:

Arguments:

pose_arrayarray of floats allocated by allocate_pose_array()
Returns:

0 on success, -1 on failure.

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:

Specify the joint angle data that will modify or override the joint angles the character normally computes. The replacment 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: All weights for an Euler triple (e.g. - q.cervical_rz/rx/ry) must be equal to ensure proper interpolation.

Callable From:

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
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);
Returns:

0 on success, -1 on failure.

function diguyCharacterPoseOverride::get_default_weight

Prototype:

float get_default_weight();
Description:

Get the default weight for pose angles.

Callable From:

None.
Returns:

The default pose angle weight.

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.

Callable From:

Arguments:

default_weightthe desired default weight.
Returns:

0 on success, -1 on failure.

function diguyCharacterPoseOverride::get_scripted_object

Prototype:

bdiPoseOverride* get_scripted_object();

Alphabetical Index


Copyright (C) 1992-2003

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/515 Massachusetts Avenue/Cambridge MA 02139.