Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron committed Dec 13, 2019
1 parent 39aa80b commit 7b7dd63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 26 deletions.
18 changes: 5 additions & 13 deletions stereo_image_proc/src/stereo_image_proc/disparity_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ class DisparityNode : public rclcpp::Node
// contains scratch buffers for block matching
stereo_image_proc::StereoProcessor block_matcher_;

virtual void onInit();

void connectCb();

void imageCb(
Expand All @@ -100,20 +98,14 @@ class DisparityNode : public rclcpp::Node

DisparityNode::DisparityNode(const rclcpp::NodeOptions & options)
: rclcpp::Node("disparity_node", options)
{
onInit();
}

void DisparityNode::onInit()
{
using namespace std::placeholders;

// Synchronize inputs. Topic subscriptions happen on demand in the connection
// callback. Optionally do approximate synchronization.
int queue_size;
queue_size = this->declare_parameter("queue_size", 5);
bool approx;
approx = this->declare_parameter("approximate_sync", false);
// Declare/read parameters
int queue_size = this->declare_parameter("queue_size", 5);
bool approx = this->declare_parameter("approximate_sync", false);

// Synchronize callbacks
if (approx) {
approximate_sync_.reset(new ApproximateSync(
ApproximatePolicy(queue_size),
Expand Down
19 changes: 6 additions & 13 deletions stereo_image_proc/src/stereo_image_proc/point_cloud_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ class PointCloudNode : public rclcpp::Node
image_geometry::StereoCameraModel model_;
cv::Mat_<cv::Vec3f> points_mat_; // scratch buffer

virtual void onInit();

void connectCb();

void imageCb(
Expand All @@ -98,19 +96,14 @@ class PointCloudNode : public rclcpp::Node

PointCloudNode::PointCloudNode(const rclcpp::NodeOptions & options)
: rclcpp::Node("point_cloud_node", options)
{
onInit();
}

void PointCloudNode::onInit()
{
using namespace std::placeholders;
// Synchronize inputs. Topic subscriptions happen on demand in the connection
// callback. Optionally do approximate synchronization.
int queue_size;
queue_size = this->declare_parameter("queue_size", 5);
bool approx;
approx = this->declare_parameter("approximate_sync", false);

// Declare/read parameters
int queue_size = this->declare_parameter("queue_size", 5);
bool approx = this->declare_parameter("approximate_sync", false);

// Synchronize callbacks
if (approx) {
approximate_sync_.reset(new ApproximateSync(
ApproximatePolicy(queue_size),
Expand Down

0 comments on commit 7b7dd63

Please sign in to comment.