add_constraints()¶
Add a constraint to the arm.
Reference¶
Arguments¶
Arguments |
Type |
Default value |
Description |
|---|---|---|---|
arm |
|
The arm to add constraints for. |
|
joi nt_constraints |
|
|
List of joint constraints. |
orientati on_constraints |
|
|
List of orientation constraints. |
positi on_constraints |
|
|
List of position constraints. |
units |
|
|
Unit 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.