tbp.monty#
- tbp.monty.conf
- tbp.monty.frameworks
- tbp.monty.frameworks.actions
- tbp.monty.frameworks.actions.action_samplers
- tbp.monty.frameworks.actions.actions
ActionLookDownLookDownActionSamplerLookDownActuatorLookUpLookUpActionSamplerLookUpActuatorMoveForwardMoveForwardActionSamplerMoveForwardActuatorMoveTangentiallyMoveTangentiallyActionSamplerMoveTangentiallyActuatorOrientHorizontalOrientHorizontalActionSamplerOrientHorizontalActuatorOrientVerticalOrientVerticalActionSamplerOrientVerticalActuatorSetAgentPitchSetAgentPitchActionSamplerSetAgentPitchActuatorSetAgentPoseSetAgentPoseActionSamplerSetAgentPoseActuatorSetSensorPitchSetSensorPitchActionSamplerSetSensorPitchActuatorSetSensorPoseSetSensorPoseActionSamplerSetSensorPoseActuatorSetSensorRotationSetSensorRotationActionSamplerSetSensorRotationActuatorSetYawSetYawActionSamplerSetYawActuatorTurnLeftTurnLeftActionSamplerTurnLeftActuatorTurnRightTurnRightActionSamplerTurnRightActuator
- tbp.monty.frameworks.config_utils
- tbp.monty.frameworks.environment_utils
- tbp.monty.frameworks.environments
- tbp.monty.frameworks.experiments
- tbp.monty.frameworks.loggers
- tbp.monty.frameworks.models
- tbp.monty.frameworks.models.evidence_matching
- tbp.monty.frameworks.models.evidence_matching.feature_evidence
- tbp.monty.frameworks.models.evidence_matching.features_for_matching
- tbp.monty.frameworks.models.evidence_matching.burst_sampling
- tbp.monty.frameworks.models.evidence_matching.graph_memory
- tbp.monty.frameworks.models.evidence_matching.hypotheses
- tbp.monty.frameworks.models.evidence_matching.hypotheses_displacer
- tbp.monty.frameworks.models.evidence_matching.hypotheses_updater
- tbp.monty.frameworks.models.evidence_matching.learning_module
- tbp.monty.frameworks.models.evidence_matching.model
- tbp.monty.frameworks.models.mixins
- tbp.monty.frameworks.models.salience
- tbp.monty.frameworks.models.abstract_monty_classes
- tbp.monty.frameworks.models.buffer
- tbp.monty.frameworks.models.displacement_matching
- tbp.monty.frameworks.models.evidence_sdr_matching
- tbp.monty.frameworks.models.feature_location_matching
- tbp.monty.frameworks.models.goal_generation
- tbp.monty.frameworks.models.graph_matching
- tbp.monty.frameworks.models.monty_base
- tbp.monty.frameworks.models.motor_policies
- tbp.monty.frameworks.models.motor_policy_selectors
- tbp.monty.frameworks.models.motor_system
- tbp.monty.frameworks.models.motor_system_state
- tbp.monty.frameworks.models.no_reset_evidence_matching
- tbp.monty.frameworks.models.object_model
- tbp.monty.frameworks.models.sensor_modules
- tbp.monty.frameworks.models.evidence_matching
- tbp.monty.frameworks.utils
- tbp.monty.frameworks.utils.communication_utils
- tbp.monty.frameworks.utils.dataclass_utils
- tbp.monty.frameworks.utils.evidence_matching
- tbp.monty.frameworks.utils.graph_matching_utils
add_pose_features_to_tolerances()create_exponential_kernel()detect_new_object_exponential()detect_new_object_k_steps()find_step_on_new_object()get_correct_k_n()get_custom_distances()get_initial_possible_poses()get_relevant_curvature()get_scaled_evidences()get_uniform_initial_possible_poses()get_unique_paths()is_in_ranges()possible_sensed_directions()process_delta_evidence_values()
- tbp.monty.frameworks.utils.live_plotter
- tbp.monty.frameworks.utils.logging_utils
accuracy_stats_for_compositional_objects()add_evidence_lm_episode_stats()add_policy_episode_stats()add_pose_lm_episode_stats()calculate_fpr()calculate_performance()calculate_tpr()check_detection_accuracy_at_step()check_rotation_accuracy()compositional_stats_for_all_lms()compute_pose_error()compute_pose_errors()compute_unsupervised_stats()consistent_child_objects_accuracy()deserialize_json_chunks()format_columns_for_wandb()get_graph_lm_episode_stats()get_object_graph_stats()get_reverse_rotation()get_rgba_frames_single_sm()get_stats_per_lm()get_time_stats()get_unique_euler_poses()lm_stats_to_dataframe()load_models_from_dir()load_stats()matches_to_target_str()maybe_rename_existing_dir()maybe_rename_existing_file()mean_num_steps_for_lm()overall_accuracy()print_overall_stats()print_unsupervised_stats()target_data_to_dict()total_size()
- tbp.monty.frameworks.utils.object_model_utils
- tbp.monty.frameworks.utils.plot_utils
- tbp.monty.frameworks.utils.plot_utils_analysis
- tbp.monty.frameworks.utils.plot_utils_dev
- tbp.monty.frameworks.utils.profile_utils
- tbp.monty.frameworks.utils.sensor_processing
center_neighbors()curvature_at_point()directional_curvature()is_coplanar()is_orthogonal()is_unit_vector()log_sign()pixel_dist_to_center()point_pair_features()principal_curvatures()scale_clip()surface_normal_naive()surface_normal_ordinary_least_squares()surface_normal_total_least_squares()weight_matrix()
- tbp.monty.frameworks.utils.spatial_arithmetics
TangentFramealign_multiple_orthonormal_vectors()align_orthonormal_vectors()apply_rf_transform_to_points()check_orthonormal()euler_to_quats()get_angle()get_angle_beefed_up()get_angle_torch()get_angles_for_all_hypotheses()get_more_directions_in_plane()get_right_hand_angle()get_unique_rotations()is_parallel()non_singular_mat()normalize()pose_is_new()project_onto_tangent_plane()rot_mats_to_quats()rotate_multiple_pose_dependent_features()rotate_pose_dependent_features()rotations_to_quats()
- tbp.monty.frameworks.utils.transform_utils
- tbp.monty.frameworks.agents
- tbp.monty.frameworks.run
- tbp.monty.frameworks.run_env
- tbp.monty.frameworks.run_parallel
- tbp.monty.frameworks.sensors
- tbp.monty.frameworks.actions
- tbp.monty.simulators
- tbp.monty.simulators.habitat
- tbp.monty.simulators.mujoco
- tbp.monty.simulators.resources
- tbp.monty.simulators.tacto
- tbp.monty.simulators.simulator
tbp.monty.cmp#
- class Goal(location: np.ndarray | None, morphological_features: dict[str, Any] | None, non_morphological_features: dict[str, Any] | None, confidence: float, use_state: bool, sender_id: str, sender_type: str, goal_tolerances: dict[str, Any] | None, info: dict[str, Any] | None = None)[source]#
Bases:
MessageSpecialization of
Messagefor goals with null (None) values allowed.Specialized form of message that still adheres to the cortical messaging protocol, but can have null (None) values associated with the location and morphological features.
Used by goal generators (GSGs) to communicate goals to other GSGs, and to motor actuators.
The message variables generally have the same meaning as for the base
Messageclass, and they represent the target values for the receiving system. Thus if a goal specifies a particular object ID (non-morphological feature) in a particular pose (location and morphological features), then the receiving system should attempt to achieve that state.Note however that for the goal, the confidence corresponds to the conviction with which a GSG believes that the current goal should be acted upon. Float bound in [0.0, 1.0].
- __init__(location: np.ndarray | None, morphological_features: dict[str, Any] | None, non_morphological_features: dict[str, Any] | None, confidence: float, use_state: bool, sender_id: str, sender_type: str, goal_tolerances: dict[str, Any] | None, info: dict[str, Any] | None = None)[source]#
Initialize a goal.
- Parameters:
location (np.ndarray | None) – the location to move to in global/body-centric coordinates, or None if the location is not specified as part of the goal. For example, this may be a point on an object’s surface or a location nearby from which a sensor would have a good view of the target point.
morphological_features (dict[str, Any] | None) – dictionary of morphological features or None. For example, it may include pose vectors, whether the pose is fully defined, etc.
non_morphological_features (dict[str, Any] | None) – a dictionary containing non-morphological features at the target location or None.
confidence (float) – a float between 0 and 1 representing the confidence in the goal.
use_state (bool) – a boolean indicating whether the goal should be used.
sender_id (str) – the ID of the sender of the goal (e.g., “LM_0”).
sender_type (str) – the type of sender of the goal (e.g., “GSG”).
goal_tolerances (dict[str, Any] | None) – Dictionary of tolerances that GSGs use when determining whether the current state of the LM matches the driving goal or None. As such, a GSG can send a goal with more or less strict tolerances if certain elements of the message (e.g. the location of a mug vs its orientation) are more or less important.
info (dict[str, Any] | None) – Optional metadata for logging purposes.
- class Message(location, morphological_features, non_morphological_features, confidence, use_state, sender_id, sender_type)[source]#
Bases:
objectMessage class used as message packages passed in Monty using CMP.
The cortical messaging protocol (CMP) is used to pass messages between Monty components and makes sure we can easily set up arbitrary configurations of them. This class makes it easier to define the CMP in one place and defines the content and structure of messages passed between Monty components. It also contains some helper functions to access and modify the message content.
States are represented in this format but can be interpreted by the receiver in different ways:
Observed states: states output by sensor modules Hypothesized states: states output by learning modules Goals: motor output of learning modules
- location#
3D vector representing the location
- morphological_features#
dictionary of morphological features. Should include pose_vectors of shape (3,3) and pose_fully_defined (bool).
- non_morphological_features#
dictionary of non-morphological features.
- confidence#
message confidence. In range [0,1].
- use_state#
boolean indicating whether the message should be used or not.
- sender_id#
string identifying the sender of the message.
- sender_type#
string identifying the type of sender. Can be “SM” or “LM”.
- __init__(location, morphological_features, non_morphological_features, confidence, use_state, sender_id, sender_type)[source]#
Initialize a message.
- get_curvature_directions()[source]#
Return the curvature direction vectors.
- Raises:
ValueError – If self.sender_type is not SM
- get_nth_pose_vector(pose_vector_index)[source]#
Return the nth pose vector.
When self.sender_type == “SM”, the first pose vector is the surface normal and the second and third are the curvature directions. When self.sender_type == “LM”, the pose vectors correspond to the rotation of the object relative to the model learned of it.
- get_on_object()[source]#
Return whether we think we are on the object or not.
This is currently used in the policy to stay on the object.
- get_surface_normal()[source]#
Return the surface normal vector.
- Raises:
ValueError – If self.sender_type is not SM
tbp.monty.context#
- class RuntimeContext(rng: numpy.random.RandomState, suppress_runtime_errors: bool = False) None[source]#
Bases:
objectMonty’s runtime context.
The RuntimeContext carries runtime-scoped values used throughout Monty.
- rng#
The random number generator.
- suppress_runtime_errors#
Whether to suppress runtime errors. Runtime errors can be raised when goal is None or invalid. When in an experimental mode, we want to raise runtime errors by default. When in a production mode, we want to suppress runtime errors by default. Currently, we run a lot of experiments, so the current default is to raise runtime errors.
- __init__(rng: numpy.random.RandomState, suppress_runtime_errors: bool = False) None#
-
rng:
RandomState#
tbp.monty.hydra#
- monty_class_resolver(class_name: str) type[source]#
Returns a class object by fully qualified path.
- Return type:
- TODO: This is an interim solution to retrieve my_class in
the my_class(**my_args) pattern.
- ndarray_resolver(list_or_tuple: list | tuple) np.ndarray[source]#
Returns a numpy array from a list or tuple.
- Return type:
np.ndarray
- ones_resolver(n: int) numpy.ndarray[source]#
Returns a numpy array of ones.
- Return type:
- path_expanduser_resolver(path: str) str[source]#
Returns a path with ~ expanded to the user’s home directory.
- Return type:
- register_resolvers() None[source]#
Register custom OmegaConf resolvers for Monty configs.
Skips resolvers that are already registered rather than raising a ValueError, since multiple entry points (e.g. tests/__init__.py and update_snapshots.py) may call this function in the same process.
- Return type:
tbp.monty.math#
tbp.monty.path#
- monty_data_path(custom_data_path: str | Path | None, default_subpath: str | Path) Path[source]#
Get data path, using custom path if provided, or return the default.
- Parameters:
custom_data_path (str | Path | None) – Custom data path provided by the user, or None to use default_subpath.
default_subpath (str | Path) – Default subpath within MONTY_DATA to use if no custom path.
- Return type:
Path
- Returns:
Full data path.