add_constraints()
  • 1 Minute to read

add_constraints()


Article summary

Add a constraint to the arm.

Reference

Arguments

ArgumentsTypeDefault valueDescription
armstrThe arm to add constraints for.
joint_constraintslist[]List of joint constraints.
orientation_constraintslist[]List of orientation constraints.
position_constraintslist[]List of position constraints.
unitsANG_UNITANG_UNIT.DEGUnit for angles (DEG or RAD).

Return

None

Exceptions

  • RayaWrongArgument

See the complete list of arms exceptions

Usage Example

async def setup(self):
    self.arms: ArmsController = await self.enable_controller('arms')
    self.constraints_1 = {
            'joint_constraints': [
                {
                    'position': 0,
                    'joint_name': 'arm_right_shoulder_FR_joint',
                    'tolerance_above': 15,
                    'tolerance_below': 15,
                    'weight': 1.0,
                },
                {
                    'position': 0,
                    'joint_name': 'arm_right_shoulder_rail_joint',
                    'tolerance_above': 0.1,
                    'tolerance_below': 0,
                    'weight': 1.0,
                }
            ],
            'orientation_constraints': [
                {
                    'orientation': {'roll': 90},
                    'weight': 1.0,
                    'absolute_x_axis_tolerance': 20.0,
                    'absolute_y_axis_tolerance': 20.0,
                    'absolute_z_axis_tolerance': 180.0
                }
            ],
            'position_constraints': [
                {
                    'constraint_region': {
                        'types': [SHAPE_TYPE.BOX],
                        'shapes_poses': [{'position': {'x': 0,
                                                       'y': -1.02,
                                                       'z': 0.5},
                                          'orientation': {'pitch': 90}}],
                        'dimensions': [[2.0,
                                        1.0,
                                        0.95]]
                    },
                    'target_point_offset': {'x': 0.1, 'y': 0, 'z': 0},
                    'weight': 1.0,
                }
            ],
        }
...    
async def loop(self):
    await self.arms.add_constraints(arm='right_arm', **self.constraints_1)

See the add constraints Example to see how to use this function.


Was this article helpful?