- skbot.ignition.sdformat.to_frame_graph(sdf, *, unwrap=True, insert_world_frame=True, shape=(3,), axis=- 1)¶
Create a frame graph from a sdformat string.
New in version 0.8.0: Added the ability to limit loading to worlds
New in version 0.6.0: This function has been added to the library.
A SDFormat XML string describing one (or many) worlds.
If True (default) and the sdf only contains a single light, model, or world element return that element’s frame. If the sdf contains multiple lights, models, or worlds a list of root frames is returned. If False, always return a list of frames.
False, creation of frame graphs is restricted to world elements contained in the provided SDF. This is because non-world elements (simulation fragments) may refer to a
worldframe that is defined outside of the provided SDF and hence the full graph can’t be determined. As a consequence, any
lightelements are ignored.
True(default), this function will insert a
worldframe into the graph of each simulation fragment (non-world element) to allow smooth construction of the frame graph.
The default is
True; however, it will change to
Falsestarting with scikit-bot v1.0.
A tuple describing the shape of elements that the resulting graph should transform. This can be used to add batch dimensions to the graph, for example to perform vectorized computation on multiple instances of the same world in different states, or for batched coordinate transformation. Defaults to (3,), which is the shape of a single 3D vector in euclidian space.
The axis along which elements are stored. The axis must have length 3 (since SDFormat describes 3 dimensional worlds), and all other axis are considered batch dimensions. Defaults to -1.
- frame_graphUnion[Frame, List[Frame]]
skbot.transform.Frameor list of Frames depending on the value of
unwrapand the number of elements in the SDF’s root element.
Frames inside the graph are named after the frames defined by the SDF. You can retrieve them by searching for them using
Joins are implicit within the frame graph. The joint frame that is attached to the child frame is named after the joint (<joint_name>), and the (implicit) joint frame attached to the parent is named (<joint_name>_parent). The link between the two frames can be retrieved via
skbot.transform.Frame.links_between(). For example if there is a joint named “robot_joint0” its link can be retrieved using:
child_frame = frame_graph.find_frame(".../robot_joint0") parent_frame = frame_graph.find_frame(".../robot_joint0_parent") link = child_frame.links_between(child_frame)