Skip to content

Commit

Permalink
Added frames in obstacle publisher panel
Browse files Browse the repository at this point in the history
  • Loading branch information
tysik committed Jul 25, 2017
1 parent baff3d8 commit 7c2cec9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ The input laser scans are firstly rectified to incorporate the motion of the sca

-----------------------
<p align="center">
<img src="https://user-images.githubusercontent.com/1482514/27595821-0aa3519a-5b5e-11e7-9ce0-8f48db4592e4.gif" alt="Visual example of obstacle detector output"/>
<img src="https://user-images.githubusercontent.com/1482514/27595821-0aa3519a-5b5e-11e7-9ce0-8f48db4592e4.gif" alt="Visual example of scans_merger output"/>
<br/>
Fig. 2. Visual example of scans merging with coordinates restrictions.
Fig. 2. Visual example of `scans_merger` output.
</p>

-----------------------
Expand Down Expand Up @@ -74,7 +74,7 @@ The package comes with Rviz panel for this node.
<p align="center">
<img src="https://user-images.githubusercontent.com/1482514/28522255-97e2c210-7077-11e7-8ca1-556790b043e6.png" alt="Rviz panel for the scans_merger node."/>
<br/>
Fig. 3. Rviz panel for the scans_merger node.
Fig. 3. Rviz panel for the `scans_merger` node.
</p>

-----------------------
Expand All @@ -85,9 +85,9 @@ This node converts messages of type `sensor_msgs/LaserScan` from topic `scan` or

-----------------------
<p align="center">
<img src="https://user-images.githubusercontent.com/1482514/27595822-0aa50ab2-5b5e-11e7-8061-1da4b947b617.gif" alt="Visual example of obstacle extractor output."/>
<img src="https://user-images.githubusercontent.com/1482514/27595822-0aa50ab2-5b5e-11e7-8061-1da4b947b617.gif" alt="Visual example of obstacle_extractor output."/>
<br/>
Fig. 4. Visual example of obstacle extractor output.
Fig. 4. Visual example of `obstacle_extractor` output.
</p>

-----------------------
Expand Down Expand Up @@ -119,7 +119,7 @@ The package comes with Rviz panel for this node.
<p align="center">
<img src="https://user-images.githubusercontent.com/1482514/28522256-97e4d0be-7077-11e7-81fa-c2fcaae944be.png" alt="Rviz panel for the obstacle_extractor node."/>
<br/>
Fig. 5. Rviz panel for the obstacle_extractor node.
Fig. 5. Rviz panel for the `obstacle_extractor` node.
</p>

-----------------------
Expand All @@ -130,9 +130,9 @@ This node tracks and filters the circular obstacles with the use of Kalman filte

-----------------------
<p align="center">
<img src="https://user-images.githubusercontent.com/1482514/27595819-0aa1bc86-5b5e-11e7-80ed-90c9ea53f69f.gif" alt="Visual example of obstacle tracker output."/>
<img src="https://user-images.githubusercontent.com/1482514/27595819-0aa1bc86-5b5e-11e7-80ed-90c9ea53f69f.gif" alt="Visual example of obstacle_tracker output."/>
<br/>
Fig. 6. Visual example of obstacle tracker output.
Fig. 6. Visual example of `obstacle_tracker` output.
</p>

-----------------------
Expand All @@ -156,7 +156,7 @@ The package comes with Rviz panel for this node.
<p align="center">
<img src="https://user-images.githubusercontent.com/1482514/27595823-0aa835a2-5b5e-11e7-9657-8cd129a50aa2.png" alt="Rviz panel for the obstacle_tracker node."/>
<br/>
Fig. 7. Rviz panel for the obstacle_tracker node.
Fig. 7. Rviz panel for the `obstacle_tracker` node.
</p>

-----------------------
Expand Down Expand Up @@ -185,9 +185,9 @@ The package comes with Rviz panel for this node.

-----------------------
<p align="center">
<img src="https://user-images.githubusercontent.com/1482514/27595824-0ab8778c-5b5e-11e7-93c3-65f8317151ff.png" alt="Rviz panel for the obstacle_publisher node."/>
<img src="https://user-images.githubusercontent.com/1482514/28582779-f8de6fca-7166-11e7-8a52-e147cea89f87.png" alt="Rviz panel for the obstacle_publisher node."/>
<br/>
Fig. 8. Rviz panel for the obstacle_publisher node.
Fig. 8. Rviz panel for the `obstacle_publisher` node.
</p>

-----------------------
Expand Down
2 changes: 2 additions & 0 deletions include/obstacle_detector/panels/obstacle_publisher_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ private Q_SLOTS:
QLineEdit* vx_input_;
QLineEdit* vy_input_;

QLineEdit* frame_input_;

ros::NodeHandle nh_;
ros::NodeHandle nh_local_;

Expand Down
27 changes: 21 additions & 6 deletions src/panels/obstacle_publisher_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ ObstaclePublisherPanel::ObstaclePublisherPanel(QWidget* parent) : rviz::Panel(pa
r_input_ = new QLineEdit();
vx_input_ = new QLineEdit();
vy_input_ = new QLineEdit();
frame_input_ = new QLineEdit();

obstacles_list_->setSelectionMode(QAbstractItemView::MultiSelection);
frame_input_->setAlignment(Qt::AlignRight);

QFrame* lines[4];
QFrame* lines[5];
for (auto& line : lines) {
line = new QFrame();
line->setFrameShape(QFrame::HLine);
Expand All @@ -75,6 +77,15 @@ ObstaclePublisherPanel::ObstaclePublisherPanel(QWidget* parent) : rviz::Panel(pa
QGroupBox* demos_box = new QGroupBox("Demos:");
demos_box->setLayout(demos_layout);

QHBoxLayout* target_frame_layout = new QHBoxLayout;
target_frame_layout->addItem(margin);
target_frame_layout->addWidget(new QLabel("Target frame:"));
target_frame_layout->addWidget(frame_input_, 0, Qt::AlignLeft);
target_frame_layout->addItem(margin);

QGroupBox* frames_box = new QGroupBox("Frames:");
frames_box->setLayout(target_frame_layout);

QHBoxLayout* xyr_layout = new QHBoxLayout;
xyr_layout->addItem(margin);
xyr_layout->addWidget(new QLabel("x:"));
Expand Down Expand Up @@ -116,13 +127,16 @@ ObstaclePublisherPanel::ObstaclePublisherPanel(QWidget* parent) : rviz::Panel(pa
layout->addWidget(lines[0]);
layout->addWidget(demos_box);
layout->addWidget(lines[1]);
layout->addWidget(frames_box);
layout->addWidget(lines[4]);
layout->addWidget(obst_box);
layout->setAlignment(layout, Qt::AlignCenter);
setLayout(layout);

connect(activate_checkbox_, SIGNAL(clicked()), this, SLOT(processInputs()));
connect(fusion_example_checkbox_, SIGNAL(clicked()), this, SLOT(processInputs()));
connect(fission_example_checkbox_, SIGNAL(clicked()), this, SLOT(processInputs()));
connect(frame_input_, SIGNAL(editingFinished()), this, SLOT(processInputs()));

connect(add_button_, SIGNAL(clicked()), this, SLOT(addObstacle()));
connect(remove_button_, SIGNAL(clicked()), this, SLOT(removeObstacles()));
Expand Down Expand Up @@ -209,17 +223,16 @@ void ObstaclePublisherPanel::verifyInputs() {
try { vy_ = boost::lexical_cast<double>(vy_input_->text().toStdString()); }
catch(boost::bad_lexical_cast &) { vy_ = 0.0; vy_input_->setText("0.0"); }

// p_frame_id_ =
p_frame_id_ = frame_input_->text().toStdString();
}

void ObstaclePublisherPanel::setParams() {
nh_local_.setParam("active", p_active_);
nh_local_.setParam("reset", p_reset_);

nh_local_.setParam("fusion_example", p_fusion_example_);
nh_local_.setParam("fission_example", p_fission_example_);

nh_local_.setParam("loop_rate", p_loop_rate_);

nh_local_.setParam("x_vector", p_x_vector_);
nh_local_.setParam("y_vector", p_y_vector_);
nh_local_.setParam("r_vector", p_r_vector_);
Expand All @@ -233,11 +246,10 @@ void ObstaclePublisherPanel::setParams() {
void ObstaclePublisherPanel::getParams() {
p_active_ = nh_local_.param("active", false);
p_reset_ = nh_local_.param("reset", false);

p_fusion_example_ = nh_local_.param("fusion_example", false);
p_fission_example_ = nh_local_.param("fission_example", false);

p_loop_rate_ = nh_local_.param("loop_rate", 0.0);

nh_local_.getParam("x_vector", p_x_vector_);
nh_local_.getParam("y_vector", p_y_vector_);
nh_local_.getParam("r_vector", p_r_vector_);
Expand All @@ -256,6 +268,9 @@ void ObstaclePublisherPanel::evaluateParams() {
fusion_example_checkbox_->setChecked(p_fusion_example_);
fission_example_checkbox_->setChecked(p_fission_example_);

frame_input_->setEnabled(p_active_);
frame_input_->setText(QString::fromStdString(p_frame_id_));

add_button_->setEnabled(p_active_);
remove_button_->setEnabled(p_active_);
reset_button_->setEnabled(p_active_);
Expand Down

0 comments on commit 7c2cec9

Please sign in to comment.