jaak-peterson / autoware_mini_practice

MIT License
0 stars 0 forks source link

Practice 5 - cluster_detector - simplifying the code #11

Closed geopimik closed 5 months ago

geopimik commented 5 months ago

Some comments how you could make the code a bit simpler

  1. If you would bring the lines 62 and 63 out of the if and placing them just after creating the Header() https://github.com/jaak-peterson/autoware_mini_practice/blob/8136687018f903b9cee09250bd1b6d785b69cf3b/practice_5/nodes/detection/lidar_cluster/cluster_detector.py#L61-L65

  2. You would not need to create the same thing any more here - can delete https://github.com/jaak-peterson/autoware_mini_practice/blob/8136687018f903b9cee09250bd1b6d785b69cf3b/practice_5/nodes/detection/lidar_cluster/cluster_detector.py#L100-L101

  3. You could also skip creating this https://github.com/jaak-peterson/autoware_mini_practice/blob/8136687018f903b9cee09250bd1b6d785b69cf3b/practice_5/nodes/detection/lidar_cluster/cluster_detector.py#L67

  4. And add detected objects straight to objects_msg.objects using append

  5. And then you could also delete this: https://github.com/jaak-peterson/autoware_mini_practice/blob/8136687018f903b9cee09250bd1b6d785b69cf3b/practice_5/nodes/detection/lidar_cluster/cluster_detector.py#L102

geopimik commented 5 months ago

OK