Skip to content

Conversation

@jayson-poirier
Copy link

Added obstacle detection with ROS2

Copy link

@nicolaslauzon nicolaslauzon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job les boys 🎉

Comment on lines 58 to 60
x_r = ranges * np.cos(angles) # (N,)
y_r = ranges * np.sin(angles) # (N,)
robot_coords = np.stack((x_r, y_r), axis=1) # (N,2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est les coords des points du scan Lidar, pas les robot_coords. Mais tu as raison que c'est par rapport au référentiel du robot. Je changerais le nom pour scan_points ou scan_points_in_robot_frame

Comment on lines 73 to 75
rotation = np.array([[cos_yaw, -sin_yaw], [sin_yaw, cos_yaw]]) # (2,2)
reference_coords = robot_coords @ rotation.T # (N,2)
reference_coords += np.array([pose.position.x, pose.position.y])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ici je rendrais explicite la transformation. On veut passer du frame du robot au frame de la map. J'utiliserais aussi une transformation homogène pour combiner la rotation et la translation dans une seule matrice 4x4.

Comment on lines 216 to 218
# Destroy the node explicitly
# (optional - otherwise it will be done automatically
# when the garbage collector destroys the node object)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Destroy the node explicitly
# (optional - otherwise it will be done automatically
# when the garbage collector destroys the node object)

Comment on lines 237 to 247
void publish_obstacle_points(const std::vector<cv::Point2d>& points, const rclcpp::Time& stamp) {
geometry_msgs::msg::PoseArray pose_array;
pose_array.header.stamp = stamp;
pose_array.header.frame_id = map_->header.frame_id;
pose_array.poses.resize(points.size());
for (size_t i = 0; i < points.size(); ++i) {
pose_array.poses[i].position.x = points[i].x;
pose_array.poses[i].position.y = points[i].y;
}
obstacles_pub_->publish(pose_array);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour pouvoir être utilisé dans d'autres algos qui vont dynamiquement changer le comportement du robot, il va falloir implémenter ce publisher de pose_array dans le noeud python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants