Graph builder

Wrappers

class BlockWrapper

class rostok.graph_grammar.node.BlockWrapper(block_cls, *args, **kwargs)

Class is interface between node and interpretation in simulation.

The interface allows you to create an interpretation of terminal nodes in the simulation. Interpretation classes is in node_render. The instance must be specified when creating the node. When assembling a robot from a graph, an object is created by the BlockWrapper.create_block() method. When the object is created, the desired arguments of the interpretation object are set.

Parameters:
  • block_cls – Interpretation class of node in simulation

  • args – Arguments py:attr:BlockWrapper.block_cls

  • kwargs – Additional arguments py:attr:BlockWrapper.block_cls

Chrono body classes

class ChronoBody

class rostok.block_builder.node_render.ChronoBody(builder: ChSystem, body: ChBody, in_pos_marker: ChVectorD, out_pos_marker: ChVectorD, random_color: bool, is_collide: bool = True)

Abstract class, that interpreting nodes of a robot body part in a physics engine (pychrono).

body

Pychrono object of the solid body. It defines visualisation,

Type:

pychrono.ChBody

collision shape, position on the world frame and etc in simulation system.
builder

Pychrono object of system, which hosts the body.

Type:

pychrono.ChSystem

Parameters:
  • builder (pychrono.ChSystem) – Arg sets the system, which hosth the body

  • body (pychrono.ChBody) – Solid body define nodes of the body part in the physics system

  • in_pos_marker (pychrono.ChVectorD) – Arg defines position input frame the body

  • out_pos_marker (chrono.ChVectorD) – Arg defines position output frame the body

  • random_color (bool) – Flag of the random color of the body

  • is_collide (bool, optional) – Flag of collision body with other objects in system.

  • True. (Defaults to) –

apply_transform(in_block: BlockTransform)

Applied input transformation to the output frame of the body.

Parameters:

in_block (BlockTransform) – The block which define transformations

property list_n_forces: list

Return a list of all the contact forces.

Returns:

List normal forces of all the contacts points

Return type:

list

make_fix_joint(in_block)

Create weld joint (fixing relative posiotion and orientation) between input block and the body.

Parameters:
  • in_block (Block) – The block which define relative fixing position and orientation the

  • system (body in) –

move_to_out_frame(in_block: Block)

Move the input frame body to output frame position input block.

Parameters:

in_block (Block) – The block defines relative movming to output frame

property normal_force: float

Return value normal forces of random collision point.

Returns:

Value normal forces of random collision point

Return type:

float

property ref_frame_in: ChMarker

Return the input frame of the body.

Returns:

The input frame of the body

Return type:

pychrono.ChMarker

reset_transformed_frame_out()

Reset all transforms output frame of the body and back to initial state.

class BoxChronoBody

class rostok.block_builder.node_render.BoxChronoBody(builder: ChSystem, shape: Box | Cylinder | Sphere | Ellipsoid = Box(width_x=0.1, length_y=0.2, height_z=0.2), random_color: bool = True, mass: float = 1, material: Material = DefaultChronoMaterial(name='default', type_class='ChMaterialSurfaceNSC'), is_collide: bool = True)

Class of the simple box body shape of robot on pychrono engine. It defines interpretation of node of body part in physic system pychrono

Parameters:
  • builder (chrono.ChSystem) – Arg sets the system, which hosth the body

  • size (BoxSize, optional) – Size of the body box. Defaults to BoxSize(0.1, 0.1, 0.1).

  • random_color (bool, optional) – Flag of the random color of the body. Defaults to True.

  • mass (float, optional) – Value mass of the body box. Defaults to 1.

  • material (Material, optional) – Surface material, which define contact friction and etc.

  • DefaultChronoMaterial. (Defaults to) –

  • is_collide (bool, optional) – Flag of collision body with othe object in system.

  • True. (Defaults to) –

class LinkChronoBody

class rostok.block_builder.node_render.LinkChronoBody(builder: ChSystem, width_x: float = 0.1, length_y: float = 2, depth_z: float = 0.3, random_color: bool = True, mass: float = 1, material: Material = DefaultChronoMaterial(name='default', type_class='ChMaterialSurfaceNSC'), is_collide: bool = True)

Class interpretation of node of the link robot in physic engine pychrono.12

Parameters:
  • builder (chrono.ChSystem) – Arg sets the system, which hosting the body

  • length_y (float) – Length of the robot link. Defaults to 2.

  • width_x (float) – Width of the robot link. Defaults to 0.1.

  • depth_z (float) – Height of the robot link. Defaults to 0.3.

  • random_color (bool, optional) – Flag of the random color of the body. Defaults to True.

  • mass (float, optional) – Value mass of the body box. Defaults to 1.

  • material (Material, optional) – Surface material, which define contact friction and etc.

  • DefaultChronoMaterial. (Defaults to) –

  • is_collide (bool, optional) – Flag of collision body with other object in system.

  • True. (Defaults to) –

class FlatChronoBody

class rostok.block_builder.node_render.FlatChronoBody(builder, width_x=0.1, height_y=0.1, depth_z=0.3, random_color=True, mass=1, material=DefaultChronoMaterial(name='default', type_class='ChMaterialSurfaceNSC'), is_collide: bool = True)

Class interprets node of robot flat (palm) in physic engine pychrono.

Parameters:
  • builder (chrono.ChSystem) – Arg sets the system, which hosting the body

  • height_y (float) – Length of the robot link. Defaults to 2.

  • width_x (float) – Width of the robot link. Defaults to 0.1.

  • depth_z (float) – Height of the robot link. Defaults to 0.3.

  • random_color (bool, optional) – Flag of the random color of the body. Defaults to True.

  • mass (float, optional) – Value mass of the body box. Defaults to 1.

  • material (Material, optional) – Surface material, which define contact friction and etc.

  • DefaultChronoMaterial. (Defaults to) –

  • is_collide (bool, optional) – Flag of collision body with other object in system.

  • True. (Defaults to) –

class MountChronoBody

class rostok.block_builder.node_render.MountChronoBody(builder, width_x=0.1, length_y=0.1, depth_z=0.3, random_color=True, mass=1, material=DefaultChronoMaterial(name='default', type_class='ChMaterialSurfaceNSC'), is_collide: bool = True)

Class is interprets node of robot end limbs in physic engine pychrono.

Parameters:
  • builder (chrono.ChSystem) – Arg sets the system, which hosting the body

  • length_y (float) – Length of the robot link. Defaults to 0.1.

  • width_x (float) – Width of the robot link. Defaults to 0.1.

  • depth_z (float) – Height of the robot link. Defaults to 0.3.

  • random_color (bool, optional) – Flag of the random color of the body. Defaults to True.

  • mass (float, optional) – Value mass of the body box. Defaults to 1.

  • material (Material, optional) – Surface material, which define contact friction and etc.

  • DefaultChronoMaterial. (Defaults to) –

  • is_collide (bool, optional) – Flag of collision body with other object in system.

  • True. (Defaults to) –

class ChronoBodyEnv

class rostok.block_builder.node_render.ChronoBodyEnv(builder, shape: Box | Cylinder | Sphere | Ellipsoid = Box(width_x=0.1, length_y=0.2, height_z=0.2), random_color=True, mass=1, material=DefaultChronoMaterial(name='default', type_class='ChMaterialSurfaceNSC'), pos: FrameTransform = FrameTransform(position=[0, 0.0, 0], rotation=[1, 0, 0, 0]))

Class of environments bodies with standard shape, like box, ellipsoid, cylinder. It adds solid body in pychrono physical system that is not robot part.

Parameters:
  • builder (chrono.ChSystem) – Arg sets the system, which hosting the body

  • shape (SimpleBody) – Args define the shape of the body. Defaults to SimpleBody.BOX

  • random_color (bool, optional) – Flag of the random color of the body. Defaults to True.

  • mass (float, optional) – Value mass of the body box. Defaults to 1.

  • material (Material, optional) – Surface material, which define contact friction and etc.

  • DefaultChronoMaterial. (Defaults to) –

  • pos (FrameTransform) – The frame define initial position and orientation .

Chrono joint classes

class ChronoRevoluteJoint

class rostok.block_builder.node_render.ChronoRevolveJoint(builder: ChSystem, axis: Axis = Axis.Z, type_of_input: InputType = InputType.POSITION, stiffness: float = 0.0, damping: float = 0.0, equilibrium_position: float = 0.0)

The class representing revolute joint object in pychrono physical engine. It is the embodiment of joint nodes from the mechanism graph in simulation.

Args:

builder (pychrono.ChSystem): Arg sets the system, which hosth the body axis (Axis, optional): Define rotation axis. Defaults to Axis.Z. type_of_input (InputType, optional): Define type of input joint control. Defaults to InputType.POSITION. Instead of, can changes to torque, that more realistic. stiffness (float, optional): Optional arg add a spring with stiffness to joint. Defaults to 0. damping (float, optional): Optional arg add a dempher to joint. Defaults to 0. equilibrium_position (float, optional): Define equilibrium position of the spring. Defaults to 0.

Attributes:

joint (pychrono.ChLink): Joint define nodes of the joint part in the system axis (Axis): The axis of the rotation input_type (InputType): The type of input

class Axis(value)

An enumeration.

class InputType(value)

An enumeration.

apply_transform(in_block)

Aplied input tranformation to the output frame of the body.

Parameters:

in_block (BlockTransform) – The block which define transormations

connect(in_block: ChronoBody, out_block: ChronoBody)

Joint is connected two bodies.

If we have two not initialize joints engine crash

Parameters:

Chrono transformation classes

class ChronoTransform

class rostok.block_builder.node_render.ChronoTransform(builder: ChSystem, transform)

Class representing node of the transformation in pychrono physical engine

Parameters:
  • builder (pychrono.ChSystem) – Arg sets the system, which hosth the body

  • transform (FrameTransform) – Define tranformation of the instance