-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linear departure tool path modifier (#202)
* Created linear departure tool path modifier * Added widget for linear departure modifier widget --------- Co-authored-by: David Spielman <davidroyspielman@gmail.com>
- Loading branch information
1 parent
db25b08
commit 3eff1fd
Showing
9 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...er_gui/include/noether_gui/widgets/tool_path_modifiers/linear_departure_modifier_widget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include <noether_gui/widgets/tool_path_modifiers/linear_approach_modifier_widget.h> | ||
|
||
namespace noether | ||
{ | ||
class LinearDepartureToolPathModifierWidget : public LinearApproachToolPathModifierWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
using LinearApproachToolPathModifierWidget::LinearApproachToolPathModifierWidget; | ||
|
||
ToolPathModifier::ConstPtr create() const override; | ||
}; | ||
|
||
} // namespace noether |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
noether_gui/src/widgets/tool_path_modifiers/linear_departure_modifier_widget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <noether_gui/widgets/tool_path_modifiers/linear_departure_modifier_widget.h> | ||
#include <noether_gui/utils.h> | ||
|
||
#include <noether_tpp/tool_path_modifiers/linear_departure_modifier.h> | ||
#include "ui_vector3d_editor_widget.h" | ||
#include "ui_linear_approach_modifier_widget.h" | ||
|
||
namespace noether | ||
{ | ||
ToolPathModifier::ConstPtr LinearDepartureToolPathModifierWidget::create() const | ||
{ | ||
if (ui_->combo_box_menu->currentIndex() == 0) | ||
{ | ||
auto axis = static_cast<LinearDepartureModifier::Axis>(ui_->combo_box_axis->currentIndex()); | ||
return std::make_unique<LinearDepartureModifier>( | ||
ui_->double_spin_box_offset->value(), axis, ui_->spin_box_points->value()); | ||
} | ||
else | ||
{ | ||
Eigen::Vector3d dir(vector_editor_ui_->double_spin_box_x->value(), | ||
vector_editor_ui_->double_spin_box_y->value(), | ||
vector_editor_ui_->double_spin_box_z->value()); | ||
return std::make_unique<LinearDepartureModifier>(dir, ui_->spin_box_points->value()); | ||
} | ||
} | ||
|
||
} // namespace noether |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
noether_tpp/include/noether_tpp/tool_path_modifiers/linear_departure_modifier.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include <noether_tpp/tool_path_modifiers/linear_approach_modifier.h> | ||
|
||
namespace noether | ||
{ | ||
/** | ||
* @brief Adds a series of waypoints in a linear pattern off the last waypoint in a tool path | ||
*/ | ||
class LinearDepartureModifier : public LinearApproachModifier | ||
{ | ||
public: | ||
using LinearApproachModifier::LinearApproachModifier; | ||
|
||
ToolPaths modify(ToolPaths tool_paths) const override final; | ||
}; | ||
|
||
} // namespace noether |
29 changes: 29 additions & 0 deletions
29
noether_tpp/src/tool_path_modifiers/linear_departure_modifier.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <noether_tpp/tool_path_modifiers/linear_departure_modifier.h> | ||
|
||
namespace noether | ||
{ | ||
ToolPaths LinearDepartureModifier::modify(ToolPaths tool_paths) const | ||
{ | ||
for (ToolPath& tool_path : tool_paths) | ||
{ | ||
for (ToolPathSegment& segment : tool_path) | ||
{ | ||
Eigen::Isometry3d offset_point = segment.back() * Eigen::Translation3d(offset_); | ||
ToolPathSegment new_segment; | ||
|
||
for (int i = 0; i <= n_points_; i++) | ||
{ | ||
Eigen::Isometry3d pt; | ||
pt = offset_point * Eigen::Translation3d(-offset_ + (offset_ / (n_points_)) * i); | ||
pt.linear() = segment.back().linear(); | ||
new_segment.push_back(pt); | ||
} | ||
|
||
segment.insert(segment.end(), new_segment.rbegin(), new_segment.rend()); | ||
} | ||
} | ||
|
||
return tool_paths; | ||
} | ||
|
||
} // namespace noether |