|
@@ -171,24 +171,24 @@ class MoveIt_Control:
|
|
|
return pose
|
|
|
|
|
|
#TODO move_p_path_constraints
|
|
|
- def create_path_constraints(self,start_point,end_point,r):#创建路径约束
|
|
|
+ def create_path_constraints(self,start_point,end_point,r):
|
|
|
#计算起点指向终点的向量
|
|
|
vector = np.array([end_point[0]- start_point[0], end_point[1]- start_point[1], end_point[2]- start_point[2]])
|
|
|
- height = np.linalg.norm(vector)+0.16 #高度延长16cm
|
|
|
+ height = np.linalg.norm(vector)+0.16
|
|
|
radius = r
|
|
|
|
|
|
# 位置约束
|
|
|
- position_constraint = PositionConstraint()#创建点位约束
|
|
|
- position_constraint.header.frame_id = "base_link"#此约束所指的机器人链接
|
|
|
+ position_constraint = PositionConstraint()
|
|
|
+ position_constraint.header.frame_id = "base_link"
|
|
|
position_constraint.link_name = self.end_effector_link
|
|
|
- position_constraint.target_point_offset = Vector3(0, 0, 0)#目标点的偏移量
|
|
|
- position_constraint.weight = 1.0#质量 OR 加权因子?
|
|
|
+ position_constraint.target_point_offset = Vector3(0, 0, 0)
|
|
|
+ position_constraint.weight = 1.0
|
|
|
|
|
|
#构建 shape_msgs/SolidPrimitive 消息
|
|
|
bounding_volume = SolidPrimitive()
|
|
|
bounding_volume.type = SolidPrimitive.CYLINDER#圆柱
|
|
|
# bounding_volume.dimensions = [0.003,1]
|
|
|
- bounding_volume.dimensions = [height,radius]#尺寸 高度 半径
|
|
|
+ bounding_volume.dimensions = [height,radius]
|
|
|
position_constraint.constraint_region.primitives.append(bounding_volume)
|
|
|
|
|
|
#构建 geometry_msgs/Pose 消息,用于指定圆柱体在空间中的位置和姿态
|
|
@@ -207,7 +207,7 @@ class MoveIt_Control:
|
|
|
pose.orientation.w = q[3]
|
|
|
position_constraint.constraint_region.primitive_poses.append(pose)
|
|
|
|
|
|
- constraints = Constraints()#创建一个新的约束信息
|
|
|
+ constraints = Constraints()
|
|
|
constraints.position_constraints.append(position_constraint)
|
|
|
|
|
|
return constraints
|
|
@@ -216,7 +216,7 @@ class MoveIt_Control:
|
|
|
def move_p_flexible(self,point,points,trajectory,trajectory_with_type,a=1,v=1):
|
|
|
self.arm.set_max_acceleration_scaling_factor(a)
|
|
|
self.arm.set_max_velocity_scaling_factor(v)
|
|
|
- rrr=0.09#初始允许半径 9cm
|
|
|
+ rrr=0.09 #初始允许半径 9cm
|
|
|
er=0
|
|
|
if trajectory:
|
|
|
#起点位置设置为规划组最后一个点
|