Animation File To Proto

A tool to convert animation files into protobuf messages which can be uploaded to the robot and used within choreography sequences.

class bosdyn.choreography.client.animation_file_to_proto.Animation[source]

Bases: object

Helper class to track values read from the animation file that are important to choreographer and necessary when uploading animated moves.

create_move_info_proto()[source]

Creates the MoveInfo protobuf message from the parsed animation file.

Returns

The choreography_sequence.MoveInfo protobuf message for the animation as generated by the different animation fields in the Animation proto.

bosdyn.choreography.client.animation_file_to_proto.set_proto(proto_object, attribute_name, attribute_value)[source]

Helper function to set a field to a specific value in the protobuf message.

Parameters
  • proto_object (Protobuf message) – Any generic protobuf message.

  • attribute_name (String) – The field name within the protobuf message.

  • attribute_value – A value with type matching the field type defined in the protobuf message definition. This will be saved in the attribute_name field.

Returns

Nothing. Mutates the input proto_object to update the specified field name to the provided value.

bosdyn.choreography.client.animation_file_to_proto.handle_nested_double_value_params(proto_object, name, attribute_value)[source]

Helper function to set a field to a DoubleValue protobuf in a protobuf message.

Parameters
  • proto_object (Protobuf message) – Any generic protobuf message.

  • name (String) – The field name within the protobuf message. This name should be both the field name and sub-field name separated by a period. For example, for the Vec3 velocity field, the name would be ‘velocity.x’.

  • attribute_value – A value with type matching the field type defined in the protobuf message definition. This will be saved in the attribute_name field.

Returns

Nothing. Mutates the input proto_object to update the specified field name to the provided value.

bosdyn.choreography.client.animation_file_to_proto.read_animation_params(animation)[source]

Parses the set of lines that are the parameters section of the file.

Reads the parameter lines into the min/max/default values in the Animation proto.

Parameters

animation (Animation) – The animation class structure containing the parameter lines.

Returns

The mutated animation class, which now contains populated params fields in the animation’s protobuf.

bosdyn.choreography.client.animation_file_to_proto.read_and_find_animation_params(animate_move_params_file, filepath_input=True)[source]

Create a mapping of the parameter name to the default parameter values.

Parameters
  • animate_move_params_file (string) – filepath to the default parameters file, or a string representing the contents of the parameters file.

  • filepath_input (boolean) – With filepath_input set to True, the animate_move_params_file argument will be interpreted as a file path to the default parameters file. When set to False, the animate_move_params_file argument will be read as the information in the default parameters file passed as a string.

Returns

A dictionary containing the parameter name as the key, and the full parameter line from the file as the value.

bosdyn.choreography.client.animation_file_to_proto.convert_animation_file_to_proto(animated_file, animate_move_params_file='')[source]

Parses a file into the animation proto that will be uploaded to the robot.

Parameters
  • animated_file (string) – The filepath to the animation text file.

  • animate_move_params_file (string) – [Optional] The filepath to a default set of move parameters.

Returns

The Animation class, which contains the animation proto to be uploaded to the robot, as well as additional information to be used by Choreographer.

bosdyn.choreography.client.animation_file_to_proto.write_animation_to_dest(animation, destination)[source]

Write the new animation proto to a .cap file.

Parameters
  • animation (Animation class) – The animation class object generated by the cha file conversion helpers to save the protobuf from.

  • destination (string) – The full filepath to the location to save the animation protobuf message.

bosdyn.choreography.client.animation_file_to_proto.main()[source]