-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
102 lines (61 loc) · 2.46 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import numpy as np
import rospy
from ur5_dual import UR5DualPlanner
'''
three main parts in the code:
1. realtime refreash obstacles and robots
2. offline path_planning
3. collision avoidance during moving
'''
def get_obstacles():
'''
get obstacles from ros topic
octomap_full (octomap_msgs/Octomap)
Get an OctoMap. Available only if rtabmap_ros is built with octomap.
octomap_binary (octomap_msgs/Octomap)
Get an OctoMap. Available only if rtabmap_ros is built with octomap.
octomap_occupied_space (sensor_msgs/PointCloud2)
A point cloud of the occupied space (obstacles and ground) of the OctoMap. Available only if rtabmap_ros is built with octomap.
octomap_obstacles (sensor_msgs/PointCloud2)
A point cloud of the obstacles of the OctoMap. Available only if rtabmap_ros is built with octomap.
octomap_ground (sensor_msgs/PointCloud2)
A point cloud of the ground of the OctoMap. Available only if rtabmap_ros is built with octomap.
octomap_empty_space (sensor_msgs/PointCloud2)
A point cloud of empty space of the OctoMap. Available only if rtabmap_ros is built with octomap.
octomap_grid (nav_msgs/OccupancyGrid)
The projection of the OctoMap into a 2D occupancy grid map. Available only if rtabmap_ros is built with octomap.
return:
obstacles: octotree
'''
pass
def get_robots(robot_id):
'''
get robots poses from ros topic
return:
robots: list of robots poses
'''
pass
class AvoidObstacles():
def __init__(self, UR5DualEnv) -> None:
'''
args:
env: UR5DualEnv class
'''
self.env = UR5DualEnv
def update_env(self):
'''
update obstacles and robots in the environment
'''
obstacles = get_obstacles()
self.env.update_obstacles(obstacles)
def update_robot_pose(self):
'''
update robot poses in the environment
'''
#todo: get robot poses from ros topic
robot1_pose = get_robots(1)
robot2_pose = get_robots(2)
self.env.robot1._set_joint_positions(robot1_pose)
self.env.robot2._set_joint_positions(robot2_pose)
def path_planning(self, start1,start2,goal1,goal2):
pass