-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Obstacle Layer Port #318
Obstacle Layer Port #318
Conversation
@bpwilcox please squash my commits - the naming of at least cough the first one isn't ideal. |
|
||
if (!(data_type == "PointCloud2" || data_type == "PointCloud" || data_type == "LaserScan")) { | ||
ROS_FATAL("Only topics that use point clouds or laser scans are currently supported"); | ||
node_->get_parameter_or<std::string>("topic", topic, source); |
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 is in the stream of inputs from configuring multiple sensor inputs (or types if some are to only clear or mark). I dont see here where node_
or source
are updated to go up and down into new sensor namespaces to get the parameters. Maybe I'm missing something.
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 think you are right, I overlooked the updated namespace of the parameters, however since only one node is being spun here, the parameters must exist on this node (or some other node also being spun for which we can create a client). I can add a prefix to the param names which will effectively do the same, though they will all live on the costmap node. This should be fine since yaml files support prefix namespaces on parameters. The only other solution I think would be to create (and spin) separate nodes for each source, which I don't believe we want to do.
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.
Yeah, that would be not good. The reason to have multiple sensors in the same node is so different sensors can clear out each other as the robot moves relative to obstacles (or obstacles themselves move). It's a pretty important feature that you can configure multiple marking/clearing sources in each layer.
The parameters would still exist in this node, however there's mulitiple sources that represents (hence why there's a subscriber vector) See a simple example here of multiple sensors. I can't share our internal ones, but suffice to say that any robot with > 1 sensor uses this
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.
Yes, I understand the use case as you describe. I plan to update to prefix a parameter namespace as the source for the sensor.
"Created an observation buffer for source %s, topic %s, global frame: %s, " | ||
"expected update rate: %.2f, observation persistence: %.2f", | ||
source.c_str(), topic.c_str(), | ||
global_frame_.c_str(), expected_update_rate, observation_keep_time); | ||
|
||
rmw_qos_profile_t custom_qos_profile = rmw_qos_profile_default; | ||
custom_qos_profile.depth = 50; |
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.
Is this generally needed at 50? Should it be parameterized?
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.
50 was the depth in the message filter code in the original, but it could also be a parameter per source I suppose.
98136ca
to
ddfb26e
Compare
node_->set_parameter_if_not_set("inflation_radius", 0.55); | ||
node_->set_parameter_if_not_set("cost_scaling_factor", 10.0); | ||
node_->set_parameter_if_not_set("inflate_unknown",false); | ||
node_->set_parameter_if_not_set(name_ + "." + "enabled",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.
Why not merge the dots into the next strings? Makes it a bit easier to read (fewer elements to concatenate).
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 actually found it more convenient to copy and paste the concatenation than to manually insert the dot into every parameter (goal being to leave parameter name string untouched). I'd prefer to merge the first two strings, if anything.
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 could've done what @mjeronimo suggested by using search and replace in your editor
eg.
search for set_parameter_if_not_set("
and replace with set_parameter_if_not_set(name_ + ".
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.
Good point. Still, I made a comment in the voxel layer PR that I'm not a fan of altering the base parameter name for clarity as well as the cases where it is a variable.
//std::vector<std::shared_ptr<message_filters::SubscriberBase> > observation_subscribers_; ///< @brief Used for the observation message filters | ||
//std::vector<std::shared_ptr<tf2_ros::MessageFilterBase> > observation_notifiers_; ///< @brief Used to make sure that transforms are available for each sensor | ||
|
||
std::vector<rclcpp::Subscription<sensor_msgs::msg::LaserScan>::ConstSharedPtr> observation_laser_subscribers_; |
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 comment or two about the usage of these members.
ddfb26e
to
3164bba
Compare
base include in CMakaeLists and first stab port of obstacle layer continued porting obstacle layer changes resolving everything for next person except stringstream + message filters issues add back current amcl changes add back current dockerfile changes
renable dwbplugin tests
adding comment
node_->set_parameter_if_not_set("inflation_radius", 0.55); | ||
node_->set_parameter_if_not_set("cost_scaling_factor", 10.0); | ||
node_->set_parameter_if_not_set("inflate_unknown",false); | ||
node_->set_parameter_if_not_set(name_ + "." + "enabled",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.
You could've done what @mjeronimo suggested by using search and replace in your editor
eg.
search for set_parameter_if_not_set("
and replace with set_parameter_if_not_set(name_ + ".
|
||
node_->get_parameter_or<std::string>(source + "." + "topic", topic, source); | ||
node_->get_parameter_or<std::string>(source + "." + "sensor_frame", sensor_frame, std::string("")); | ||
node_->get_parameter_or<double>(source + "." + "observation_persistence", observation_keep_time, 0.0); |
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.
Do you really need the type specifiers here (<double>
)? I thought that it was automatically deduced from the variable's type.
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 can probably remove the specifier
// TODO(bpwilcox): replace with message filters above when enabled | ||
// create a callback for the topic | ||
auto buffer = observation_buffers_.back(); | ||
if (data_type == "LaserScan") { |
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.
There's a lot of redundancy in this code block. I realize it is temporary code and should go away when message filters is enabled, but who knows how long temporary is. I'll leave it up to you whether you want to fix it or leave it alone such that your name comes up when somebody runs git blame
;-)
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.
The message filters code is equally redundant, my format is pretty much the same. I'm ok leaving as is for now.
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.
Ok. For future reference, I think what I'd have done here is just define a macro at the start of the function and then used that to simplify the subscription creation code.
#define CREATE_SUBSCRIBER(message_type, callback) \
node_->create_subscription<message_type>(topic, [&, buffer] (message_type::ConstSharedPtr message) \
{ callback(message, buffer); }, custom_qos_profile);
...
if (data_type == "LaserScan") {
if (inf_is_valid) {
sub = CREATE_SUBSCRIBER(sensor_msgs::msg::LaserScan, laserScanValidInfCallback);
} else {
sub = CREATE_SUBSCRIBER(sensor_msgs::msg::LaserScan, laserScanValidCallback);
}
} else {
if (inf_is_valid) {
RCLCPP_WARN ...
} else {
sub = CREATE_SUBSCRIBER(sensor_msgs::msg::PointCloud2, pointCloud2Callback);
}
}
Basic Info
Description of contribution in a few bullet points
Future work that may be required in bullet points