Phase2 (b): Perception for TurtleBot 4 Open CV and MediaPipe: 3D Objects#12
Phase2 (b): Perception for TurtleBot 4 Open CV and MediaPipe: 3D Objects#12sumedhreddy90 wants to merge 12 commits intoturtlebot:mainfrom
Conversation
Rebase perception branch with motion planner branch
kscottz
left a comment
There was a problem hiding this comment.
This is mostly acceptable but it would be great if we could remove the window / wait keycode and replace it with just publishing the results as new topic. Perhaps something like '\perception\blobs' and 'perception\objects'
You should get familiar with RVIZ and this RQT utility.
| current_frame = self.bridge.imgmsg_to_cv2(frames_data) | ||
|
|
||
| # Poping each and every frame | ||
| cv2.imshow("TurtleBot4 Camera View", current_frame) |
There was a problem hiding this comment.
We really shouldn't do this. You should use RVIZ or RQT to view the image as a topic.
| cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2) | ||
|
|
||
| else: | ||
| cv2.putText(process_frames, 'circle', (x_point, y_point), |
| cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2) | ||
|
|
||
| # displaying the image after drawing contours | ||
| cv2.imshow('Turtlebot 4 Simple Object Detection', process_frames) |
There was a problem hiding this comment.
Like I said, I would publish this as a topic.
| i = 0 | ||
|
|
||
| # list for storing names of shapes | ||
| for contour in contours: |
There was a problem hiding this comment.
You're going to want to cap the number of contours you process here. You can get in a degenerate situation where you have a large number of "blobs". I would make that number a node parameter and only highlight the n-most largest blobs by area.
|
|
||
| resized_image = cv2.resize(current_frame, (720, 480)) | ||
|
|
||
| # Poping each and every frame |
| cv2.putText(image, f'FPS: {int(fps)}', (20,70), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0,255,0), 2) | ||
| # displaying the image after drawing contours | ||
| cv2.imshow('Turtlebot 4 Simple Object Detection', image) | ||
| cv2.waitKey(1) |
There was a problem hiding this comment.
Don't do this. You shouldn't wait inside a node loop. Same goes for the other node. Just spit the data out to a topic.
|
One thing I might add, it is a bit too late now, is that it would have been nice to output the detected objects as some sort of topic. The drawback here is that doing this well is a bit of a rabbit hole in terms of what the messages should look like. |



[In Progress] [(TODO) Update Description]
Implementation of the 3D object detection using openCV and MediaPipe