genericroboticarm.control.graph_manager module

class genericroboticarm.control.graph_manager.GraphManager(name: str)[source]

Bases: object

add_connection(head: str, tail: str)[source]
Parameters:
  • head

  • tail

Returns:

add_intermediates(from_pos: str, to_pos: str, num: int, name_generator: Callable[[int], str])[source]

Adds a specified number of intermediate positions between two specified positions. The new positions will be equidistant points on a straight line between the two positions. You need to add a name generator function. This function will receive the number of the intermediate position as an integer starting at 0. The intermediate positions will be enumerated starting near the ‘from_pos’ position. :return:

add_position(identifier: str, pos: Dict[str, float])[source]
Parameters:
  • pos

  • identifier

Returns:

change_position(identifier: str, pos: Dict[str, float])[source]
Parameters:
  • identifier

  • pos

Returns:

dist: Callable[[Dict[str, float], Dict[str, float]], float]
g: Graph
get_coordinates(identifier: str) Dict[str, float][source]
Parameters:

identifier

Returns:

get_nearest_position(pos: Dict[str, float]) str[source]
Parameters:

pos

Returns:

get_shortest_path(start: str, target: str) List[str][source]

Returns the shortest path from start to target as a list of node identifiers including the target but not the start. Returns an empty list if no path exists. :param start: :param target: :return:

load(file_name: str | None = None)[source]

Loads a networkx graph :param file_name: :return:

position_known(identifier: str) bool[source]
remove_connection(head: str, tail: str)[source]
Parameters:
  • head

  • tail

Returns:

remove_position(identifier: str)[source]
Parameters:

identifier

Returns:

save(filename: str)[source]

Saves the current networkx graph :param filename: :return:

update_distances()[source]

Applies the distance function to all edges :return:

genericroboticarm.control.graph_manager.default_dist(p: Dict[str, float], q: Dict[str, float]) float[source]