@@ -68,6 +68,9 @@ def __init__(self):
6868 # Pusblisher for point cloud of maximum payloads in the workspace area
6969 self .publisher_maximum_payloads = self .create_publisher (MarkerArray , '/maximum_payloads' , 10 )
7070
71+ # Publisher for point cloud of all analyzed points
72+ self .publisher_analyzed_points = self .create_publisher (MarkerArray , '/analyzed_points' , 10 )
73+
7174 # subscription to joint states
7275 self .joint_states_subscription = self .create_subscription (JointState , '/joint_states' , self .joint_states_callback , 10 )
7376
@@ -103,6 +106,9 @@ def __init__(self):
103106 # variable to store if there is a selected configuration from the workspace menu to visualize
104107 self .selected_configuration = None
105108
109+ # variable to store analyzed points of the workspace area
110+ self .marker_analyzed_points = None
111+
106112 # timer to compute the valid workspace area
107113 self .timer_workspace_calculation = self .create_timer (1.0 , self .workspace_calculation )
108114 # timer to publish the selected configuration in joint states
@@ -113,6 +119,8 @@ def __init__(self):
113119 self .timer_publish_force = self .create_timer (1.0 , self .publish_payload_force )
114120 # timer to update items in the menu for payload selection
115121 self .timer_update_payload_selection = self .create_timer (0.5 , self .update_payload_selection )
122+ # timer to publish all analyzed points in the workspace area
123+ self .timer_publish_analyzed_points = self .create_timer (2 , self .publish_analyzed_points )
116124
117125 self .get_logger ().info ('Robot description subscriber node started' )
118126
@@ -161,6 +169,53 @@ def update_payload_selection(self):
161169
162170 self .links = links # Update the links to the current ones
163171
172+
173+ def publish_analyzed_points (self ):
174+ """
175+ Publish the analyzed points in the workspace area.
176+ This will publish all the points in the workspace area where the robot can reach with the current configuration.
177+ """
178+ if self .menu is not None :
179+
180+ if len (self .robot_handler .get_analyzed_points ()) == 0 :
181+ return
182+ else :
183+ if self .marker_analyzed_points is None :
184+
185+ self .marker_analyzed_points = MarkerArray ()
186+
187+ # publish the analyzed points
188+ for i , analyzed_point in enumerate (self .robot_handler .get_analyzed_points ()):
189+ point = Marker ()
190+ point .header .frame_id = self .robot_handler .get_root_name ()
191+ point .header .stamp = Time ()
192+ point .ns = f"analyzed_points_ns"
193+ point .id = i
194+ point .type = Marker .SPHERE
195+ point .action = Marker .ADD
196+ point .scale .x = 0.01
197+ point .scale .y = 0.01
198+ point .scale .z = 0.01
199+ point .pose .position .x = analyzed_point ['position' ][0 ]
200+ point .pose .position .y = analyzed_point ['position' ][1 ]
201+ point .pose .position .z = analyzed_point ['position' ][2 ]
202+ point .pose .orientation .w = 1.0
203+ point .color .a = 1.0 # Alpha
204+ point .color .r = 1.0 # Red
205+ point .color .g = 1.0 # Green
206+ point .color .b = 1.0 # Blue
207+
208+ self .marker_analyzed_points .markers .append (point )
209+
210+ self .publisher_analyzed_points .publish (self .marker_analyzed_points )
211+
212+ else :
213+ # update with current time
214+ for marker in self .marker_analyzed_points .markers :
215+ marker .header .stamp = Time ()
216+
217+ self .publisher_analyzed_points .publish (self .marker_analyzed_points )
218+
164219 def publish_payload_force (self ):
165220 """
166221 Publish the gravity force on the frame with id `id_force`.
0 commit comments