phobos utils module¶
Submodules¶
phobos.utils.commandline_logging module¶
phobos.utils.git module¶
- class phobos.utils.git.MergeRequest¶
Bases:
object
- description = ''¶
- get_options()¶
- mention = ''¶
- target = 'master'¶
- title = ''¶
- phobos.utils.git.add_remote(repo, target_remote_url, target_remote_name='target_remote')¶
- phobos.utils.git.add_submodule(repo, remote, path, commit=None, branch='master')¶
- phobos.utils.git.checkout(commit_id, repo, force=False)¶
- phobos.utils.git.clear_repo(repo)¶
Deletes everything in this repo
- phobos.utils.git.clone(repo, target, branch=None, cwd=None, recursive=False, ignore_failure=False, commit_id=None, shallow=1, pipeline=None)¶
- phobos.utils.git.commit(repo, message=None, origin_repo=None)¶
- phobos.utils.git.create_pipeline_badge(pipeline, label, message, color, target, filename=None)¶
Creates a badge with label as name and saves it to the target directory
- phobos.utils.git.get_branch(repo)¶
- phobos.utils.git.get_commit_message(repo)¶
- phobos.utils.git.get_previous_commit_hash(repo)¶
- phobos.utils.git.get_repo_data(directory)¶
- phobos.utils.git.get_root(cwd)¶
- phobos.utils.git.has_diff(repo, file=None)¶
- phobos.utils.git.ignore(repo, ignore)¶
- phobos.utils.git.install_lfs(repo, track)¶
- phobos.utils.git.push(repo, remote='target_remote', branch='$CI_UPDATE_TARGET_BRANCH', merge_request=None)¶
- phobos.utils.git.reset(repo, remote, branch)¶
- phobos.utils.git.revision(repo)¶
- phobos.utils.git.update(repo, update_remote='autobuild', update_target_branch='$CI_UPDATE_TARGET_BRANCH')¶
phobos.utils.hyrodyn module¶
- phobos.utils.hyrodyn.debug_report(report, urdf_file, submech_file, raise_error_failure=False)¶
- phobos.utils.hyrodyn.get_load_report(urdf_file, submechs)¶
phobos.utils.inertia module¶
- phobos.utils.inertia.calculateBoxInertia(mass, size)¶
Returns upper diagonal of inertia tensor of a box as tuple.
- Parameters:
mass (float) – The box’ mass.
size (iterable) – The box’ size.
- Returns:
tuple(6)
- phobos.utils.inertia.calculateCylinderInertia(mass, r, h)¶
Returns upper diagonal of inertia tensor of a cylinder as tuple.
- Parameters:
mass (float) – The cylinders mass.
r (float) – The cylinders radius.
h (float) – The cylinders height.
- Returns:
tuple(6)
- phobos.utils.inertia.calculateEllipsoidInertia(mass, size)¶
Returns upper diagonal of inertia tensor of an ellipsoid as tuple.
- Parameters:
mass (float) – The ellipsoids mass.
size – The ellipsoids size.
- Returns:
tuple(6)
- phobos.utils.inertia.calculateMeshInertia(mass, data, scale=None)¶
Calculates and returns the inertia tensor of arbitrary mesh objects.
Implemented after the general idea of ‘Finding the Inertia Tensor of a 3D Solid Body, Simply and Quickly’ (2004) by Jonathan Blow (1) with formulas for tetrahedron inertia from ‘Explicit Exact Formulas for the 3-D Tetrahedron Inertia Tensor in Terms of its Vertex Coordinates’ (2004) by F. Tonon. (2). The latter has an issue, according the element order of the inertia tensor: b’ and c’ are exchanged. According to ‘Technische Mechanik 3 - Dynamik’ (2012) by Russel C. Hibbeler this has been fixed.
- Parameters:
data (bpy.types.BlendData) – mesh data of the object
mass (float) – mass of the object
scale (list) – scale vector
- Returns:
inertia tensor
- Return type:
6
- phobos.utils.inertia.calculateSphereInertia(mass, r)¶
Returns upper diagonal of inertia tensor of a sphere as tuple.
- Parameters:
mass (float) – The spheres mass.
r (float) – The spheres radius.
- Returns:
tuple(6)
phobos.utils.misc module¶
- phobos.utils.misc.append_string(s, *args, **kwargs)¶
Replacement for print so that the printed string is put to s
- phobos.utils.misc.check_for_iterable(check_object)¶
- phobos.utils.misc.color_parser(*args, rgba=None)¶
- phobos.utils.misc.copy(pipeline, src, dst, silent=False)¶
- phobos.utils.misc.create_dir(pipeline, directory)¶
- phobos.utils.misc.create_symlink(pipeline, target, link)¶
- phobos.utils.misc.deepen_dict(input_dict)¶
- phobos.utils.misc.duplicate(obj, link_obj=False)¶
- phobos.utils.misc.edit_name_string(name, prefix=None, suffix=None, replacements=None)¶
- phobos.utils.misc.execute_shell_command(cmd, cwd=None, dry_run=False, silent=False)¶
- phobos.utils.misc.flatten_dict(input_dict)¶
- phobos.utils.misc.get_thumbnail(robotfile, icon_size=512)¶
- phobos.utils.misc.is_binary_file(filepath)¶
- phobos.utils.misc.list_files(startpath, ignore=['\\.git'], resolve_symlinks=False, abs_path=False)¶
- phobos.utils.misc.make_icon(im, thumbnail_path, size=512, trim=True)¶
- phobos.utils.misc.merge_default(input_dict, default_dict)¶
- phobos.utils.misc.posix_path(path)¶
- phobos.utils.misc.read_number_from_config(config_input)¶
Converts [“rad”/”deg”, value] into the rad value, computes *+/- and pi in input string
- phobos.utils.misc.recreate_dir(pipeline, directory)¶
- phobos.utils.misc.regex_replace(string, replacements, verbose=False)¶
In string applies all replacements defined in replacements dict. It can be a list of dicts or a dict of strings that shall be replaced.0 Regular expressions can be used.
- phobos.utils.misc.remove_dir(pipeline, directory)¶
- phobos.utils.misc.restore_persisting_files(pipeline, repo, list_of_files, temp_dir)¶
- phobos.utils.misc.store_persisting_files(pipeline, repo, list_of_files, temp_dir)¶
- phobos.utils.misc.sys_path(path)¶
- phobos.utils.misc.to_hex_color(color_as_list)¶
- phobos.utils.misc.to_pretty_xml_string(xml)¶
- phobos.utils.misc.trunc(values, decimals=0)¶
phobos.utils.xml module¶
- phobos.utils.xml.adapt_mesh_pathes(robot, new_urdf_dir, copy_to=None)¶
- phobos.utils.xml.get_joint_info_dict(robot, joint_list)¶
Gets the joint information used for joint_limits file from the robot
- phobos.utils.xml.read_relative_filename(filename, start_file_path)¶
- phobos.utils.xml.sort_children_by(parent, attr)¶
Recursively sorts the children of the parent by the given attr.ibute
- phobos.utils.xml.transform_object(obj, T, relative_to)¶
Transform a given object with a given homogeneous transformation T.
phobos.utils.transform module¶
- phobos.utils.transform.angle_between_vectors(a, b, acute=True)¶
- phobos.utils.transform.create_transformation(xyz=None, rpy=None)¶
- phobos.utils.transform.get_adjoint(T: ndarray)¶
- phobos.utils.transform.inv(T)¶
- phobos.utils.transform.matrix_to_quaternion(rotation)¶
- phobos.utils.transform.matrix_to_rpy(R)¶
- phobos.utils.transform.order_angles(angles, in_order, out_order)¶
- phobos.utils.transform.quaternion_to_angle_axis(quat)¶
- phobos.utils.transform.quaternion_to_matrix(quat)¶
- phobos.utils.transform.quaternion_to_rpy(quaternion)¶
- phobos.utils.transform.round_array(array, dec=16)¶
- phobos.utils.transform.rpy_to_matrix(rpy)¶
- phobos.utils.transform.rpy_to_quaternion(rotation)¶
- phobos.utils.transform.skew_symmetric(x)¶
phobos.utils.tree module¶
- phobos.utils.tree.find_close_ancestor_links(robot, linkname)¶
Returns list of ancestors for the given linkname, that are only a rotational transformation apart. This is used to exclude collision checking for those links.
- phobos.utils.tree.find_common_root(input_model, input_spanningtree)¶
Finds the closest common root of the given input spanning tree :param input_model: :param input_spanningtree: :return:
- phobos.utils.tree.find_leaves(input_model, input_spanningtree)¶
Finds the leaves in the given spanning tree :param input_model: :param input_spanningtree: :return:
- phobos.utils.tree.get_joints(robot, joint_desc)¶
Provides a list of jointnames from the given robot specified by the given joint descriptor :param robot: the robot instance :param joint_desc: joint descriptor: ALL, INDEPENDENT, ACTIVE, list of jointnames
- Returns:
list of jointnames
- phobos.utils.tree.get_joints_depth_first(robot, start_link, independent_joints=None)¶
- phobos.utils.tree.skip_downwards_over_fixed(robot, link_name, submechanism)¶
Starting from the given joint names returns the end of all branches that are fixed and not already present in any submechanism
- phobos.utils.tree.skip_upwards_over_fixed(robot, link_name, only_single_parents=True)¶
From the given link upwards gets the rootest joint while skipping any fixed joint that is not yet in a submechanism