ros-industrial / ur_modern_driver

(deprecated) ROS 1 driver for CB1 and CB2 controllers with UR5 or UR10 robots from Universal Robots
Apache License 2.0
301 stars 341 forks source link

Code for circular path planning #349

Closed addy1997 closed 4 years ago

addy1997 commented 4 years ago

I have written a circular path planning code in python for ur5e robotic arm to simulate it in rviz I would like to contribute to your repository. Please check my code and revert any possible changes.

def Circular_path(self,pos_x,pos_y,pos_z,waypoint,radius): group = self.group scene = self.scene eef_link = self.eef_link robot = self.robot radius = self.radius waypoints = self.waypoints

x_center, y_center = input("Enter a two value: ").split() 
print("X Coordinate is: ", x_center) 
print("Y Coordiante is: ", y_center) 
print() 

# Defining trajectory parameters. 
double angle1 = angle_resolution*3.14/180
double angle = 0

# Main logic for circular trajectory.
for i in range(0, 360/angle_resolution)
angle+=angle1
eef_link.pos_x = x_center + r*cos(angle)
eef_link.pos_y = y_center + r*sin(angle)
eef_link.pos_z = 0 # because circle is 2-d i.e, we have to follow the trajectory of the cross-section of the sphere.

waypoints.append(copy.deepcopy(eef_link))

plan = move_group.compute_cartesian_path(
                           waypoints,   # waypoints to follow  
                           0.0) 

display_trajectory = moveit_msgs.msg.Circular_path()
display_trajectory.trajectory_start = robot.get_current_state()
display_trajectory.trajectory.append(plan)

# Publish
display_trajectory_publisher.publish(display_trajectory)

# To Execute the Planned Path 
move_group.execute(plan, wait=True)

print('The robot moves in a circular path')
gavanderhoorn commented 4 years ago

Please refer to my https://github.com/ros-industrial/ur_modern_driver/issues/346#issuecomment-530282367 for why I'm closing this.