-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OGRID: add size param and visuals #278
Conversation
RustyBamboo
commented
Jun 8, 2017
- publish blueview pings as a plane (point_cloud/plane)
- param for waypointvalidity check size (sub_ogrid_size)
- publish ogrid for desired waypoint (green if unoccupied, red if invalid) and publish ogrid for current waypoint (orange)
b121d13
to
5c2eac5
Compare
Signed-off-by: RustyBamboo <dvolya@gmail.com>
5c2eac5
to
3dea811
Compare
Reference to #277 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like your rationale for separate ogrid's and a couple requested changes.
@@ -32,6 +39,10 @@ class WaypointValidity | |||
|
|||
// Usage: Store the reference to the previous ogrid in publisher | |||
void ogrid_callback(const nav_msgs::OccupancyGridConstPtr &ogrid_map); | |||
void odom_callback(const nav_msgs::OdometryConstPtr &odom); | |||
|
|||
void pub_size_ogrid(int d = 200); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should document these too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more descriptive name like vehicle_odom_ogrid_pub
would make the code more readable imo.
@@ -70,9 +86,48 @@ std::pair<bool, WAYPOINT_ERROR_TYPE> WaypointValidity::is_waypoint_valid(const g | |||
return std::make_pair(true, WAYPOINT_ERROR_TYPE::UNOCCUPIED); | |||
} | |||
|
|||
void WaypointValidity::pub_size_ogrid(int d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the following two functions duplicate most of the code, I would suggest making the function take a raw pointer to a geometry_msgs::Pose
object. If the pointer is null you use odom, otherwise you would use the pose object.
Add documentation in the header also.
@@ -45,12 +45,17 @@ std::pair<bool, WAYPOINT_ERROR_TYPE> WaypointValidity::is_waypoint_valid(const g | |||
return std::make_pair(false, WAYPOINT_ERROR_TYPE::NO_OGRID); | |||
} | |||
|
|||
cv::Point where_sub = cv::Point(waypoint.position.x / ogrid_map_->info.resolution + ogrid_map_->info.width / 2, | |||
waypoint.position.y / ogrid_map_->info.resolution + ogrid_map_->info.height / 2); | |||
cv::Point center_of_ogird = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misspelled ogrid
WaypointValidity::WaypointValidity(ros::NodeHandle &nh) | ||
{ | ||
nh_ = &nh; | ||
sub_ = nh_->subscribe<nav_msgs::OccupancyGrid>("/ogrid_pointcloud/ogrid", 1, | ||
boost::bind(&WaypointValidity::ogrid_callback, this, _1)); | ||
nh_->param<double>("sub_ogrid_size", sub_ogrid_size_, 1.5); | ||
pub_waypoint_ogrid_ = nh_->advertise<nav_msgs::OccupancyGrid>("/c3_trajectory_generator/waypoint_ogrid", 1, true); | ||
pub_sub_ogrid_ = nh_->advertise<nav_msgs::OccupancyGrid>("/c3_trajectory_generator/sub_ogrid", 1, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What made you switch? Could you describe the benfit to having two ogrids?
I'm thinking it would be good to have an occupation type that encoded space being occupied by the sub but within the same ogrid.
rosGrid.info.origin.position.x = waypoint.position.x - sub_ogrid_size_ / 2; | ||
rosGrid.info.origin.position.y = waypoint.position.y - sub_ogrid_size_ / 2; | ||
rosGrid.data = sub_ogrid_data; | ||
if (d == 200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't branch on arbitrary magic constants like this. Consider using a flag parameter.
@@ -40,7 +40,7 @@ class Classification | |||
pcl::PointCloud<pcl::PointXYZI>::Ptr filtered(pcl::PointCloud<pcl::PointXYZI>::ConstPtr pointCloud); | |||
|
|||
// Usage: Find all the first occupied points in an expanding circle, then color the ogrid | |||
void zonify(cv::Mat &mat_ogrid, float resolution, const tf::StampedTransform &transform); | |||
void zonify(cv::Mat &mat_ogrid, float resolution, const tf::StampedTransform &transform, cv::Point &mat_origin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should describe the parameters for this function.
@@ -27,29 +27,39 @@ | |||
|
|||
#include <Classification.hpp> | |||
|
|||
#include <mil_msgs/RangeStamped.h> | |||
#include <ros_alarms/listener.hpp> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class needs better documentation.
@@ -80,14 +96,15 @@ void OGridGen::publish_ogrid(const ros::TimerEvent &) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This publish_ogrid
function is getting a bit long, consider refactoring. For example, this loop could be replaced with a call to OGridGen::project_point_cloud_to_ogrid()
I guess they're not really occupancy grids... they visualize the "buffer zone" for the current trajectory (orange) and the designated set waypoint (green for good, red for bad)...I believe this is similar to how we did it on Navigator. I want to test out persistent ogrid tomorrow and will probably put that into this PR too. |
Signed-off-by: RustyBamboo <dvolya@gmail.com>
3cb4788
to
054024f
Compare