-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start migrating to common package - first example worked, second not yet
- Loading branch information
1 parent
daa7fcd
commit 5c9b14c
Showing
10 changed files
with
277 additions
and
128 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
94 changes: 94 additions & 0 deletions
94
examples/moveit_examples/include/moveit_examples/moveit_basic_planners_example.hpp
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,94 @@ | ||
// Copyright 2024 Gergely Kovács | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef MOVEIT_EXAMPLES__MOVEIT_BASIC_PLANNERS_EXAMPLE_HPP_ | ||
#define MOVEIT_EXAMPLES__MOVEIT_BASIC_PLANNERS_EXAMPLE_HPP_ | ||
|
||
#include <math.h> | ||
|
||
#include <memory> | ||
|
||
#include "moveit_examples/moveit_example.hpp" | ||
|
||
void moveItBasicPlannersExample(std::shared_ptr<MoveitExample> example_node, | ||
const geometry_msgs::msg::Vector3 & standing_pose_coords, | ||
const geometry_msgs::msg::Vector3 & lin_goal_coords, | ||
const geometry_msgs::msg::Vector3 & collision_box_pos, | ||
const geometry_msgs::msg::Vector3 & collision_box_size) | ||
{ | ||
example_node->initialize(); | ||
example_node->addBreakPoint(); | ||
|
||
// Add robot platform | ||
example_node->addRobotPlatform(); | ||
|
||
// Pilz PTP planner | ||
auto standing_pose = | ||
Eigen::Isometry3d(Eigen::Translation3d(standing_pose_coords.x, standing_pose_coords.y, standing_pose_coords.z) * Eigen::Quaterniond::Identity()); | ||
|
||
auto planned_trajectory = | ||
example_node->planToPoint(standing_pose, "pilz_industrial_motion_planner", "PTP"); | ||
if (planned_trajectory != nullptr) | ||
{ | ||
example_node->drawTrajectory(*planned_trajectory); | ||
example_node->addBreakPoint(); | ||
example_node->moveGroupInterface()->execute(*planned_trajectory); | ||
} | ||
example_node->addBreakPoint(); | ||
|
||
// Pilz LIN planner | ||
auto cart_goal = | ||
Eigen::Isometry3d(Eigen::Translation3d(lin_goal_coords.x, lin_goal_coords.y, lin_goal_coords.z) * Eigen::Quaterniond::Identity()); | ||
planned_trajectory = | ||
example_node->planToPoint(cart_goal, "pilz_industrial_motion_planner", "LIN"); | ||
if (planned_trajectory != nullptr) | ||
{ | ||
example_node->drawTrajectory(*planned_trajectory); | ||
example_node->addBreakPoint(); | ||
example_node->moveGroupInterface()->execute(*planned_trajectory); | ||
} | ||
example_node->addBreakPoint(); | ||
|
||
// Add collision object | ||
example_node->addCollisionBox(collision_box_pos, collision_box_size); | ||
example_node->addBreakPoint(); | ||
|
||
// Try moving back with Pilz LIN | ||
planned_trajectory = | ||
example_node->planToPoint(standing_pose, "pilz_industrial_motion_planner", "LIN"); | ||
if (planned_trajectory != nullptr) | ||
{ | ||
example_node->drawTrajectory(*planned_trajectory); | ||
} | ||
else | ||
{ | ||
example_node->drawTitle("Failed planning with Pilz LIN"); | ||
} | ||
example_node->addBreakPoint(); | ||
|
||
// Try moving back with Pilz PTP | ||
planned_trajectory = | ||
example_node->planToPoint(standing_pose, "pilz_industrial_motion_planner", "PTP"); | ||
if (planned_trajectory != nullptr) | ||
{ | ||
example_node->drawTrajectory(*planned_trajectory); | ||
} | ||
else | ||
{ | ||
example_node->drawTitle("Failed planning with Pilz PTP"); | ||
} | ||
example_node->addBreakPoint(); | ||
} | ||
|
||
#endif // MOVEIT_EXAMPLES__MOVEIT_BASIC_PLANNERS_EXAMPLE_HPP_ |
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
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
36 changes: 36 additions & 0 deletions
36
examples/moveit_examples/src/iiqka/moveit_basic_planners_example.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,36 @@ | ||
// Copyright 2024 Gergely Kovács | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "moveit_examples/moveit_basic_planners_example.hpp" | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
// Setup | ||
// Initialize ROS and create the Node | ||
rclcpp::init(argc, argv); | ||
auto const example_node = std::make_shared<MoveitExample>(); | ||
rclcpp::executors::SingleThreadedExecutor executor; | ||
executor.add_node(example_node); | ||
std::thread([&executor]() { executor.spin(); }).detach(); | ||
|
||
moveItBasicPlannersExample(example_node, | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(0).z(0.8), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.4).y(-0.15).z(0.55), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.25).y(-0.075).z(0.675), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(0.4).z(0.1)); | ||
|
||
// Shutdown ROS | ||
rclcpp::shutdown(); | ||
return 0; | ||
} |
36 changes: 36 additions & 0 deletions
36
examples/moveit_examples/src/iiqka/moveit_collision_avoidance_example.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,36 @@ | ||
// Copyright 2022 Áron Svastits | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "moveit_examples/moveit_collision_avoidance_example.hpp" | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
// Setup | ||
// Initialize ROS and create the Node | ||
rclcpp::init(argc, argv); | ||
auto const example_node = std::make_shared<MoveitExample>(); | ||
rclcpp::executors::SingleThreadedExecutor executor; | ||
executor.add_node(example_node); | ||
std::thread([&executor]() { executor.spin(); }).detach(); | ||
|
||
moveItCollisionAvoidanceExample(example_node, | ||
std::vector<double>{0.3587, 0.3055, -1.3867, 0.0, -0.4896, -0.3587}, | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(0).z(0.8), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.125).y(0.15).z(0.5), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(1.0).z(0.1)); | ||
|
||
// Shutdown ROS | ||
rclcpp::shutdown(); | ||
return 0; | ||
} |
36 changes: 36 additions & 0 deletions
36
examples/moveit_examples/src/kss/moveit_basic_planners_example.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,36 @@ | ||
// Copyright 2024 Gergely Kovács | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "moveit_examples/moveit_basic_planners_example.hpp" | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
// Setup | ||
// Initialize ROS and create the Node | ||
rclcpp::init(argc, argv); | ||
auto const example_node = std::make_shared<MoveitExample>(); | ||
rclcpp::executors::SingleThreadedExecutor executor; | ||
executor.add_node(example_node); | ||
std::thread([&executor]() { executor.spin(); }).detach(); | ||
|
||
moveItBasicPlannersExample(example_node, | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(0).z(1.2), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.7).y(-0.15).z(0.75), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.3).y(-0.075).z(1), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(0.4).z(0.1)); | ||
|
||
// Shutdown ROS | ||
rclcpp::shutdown(); | ||
return 0; | ||
} |
36 changes: 36 additions & 0 deletions
36
examples/moveit_examples/src/kss/moveit_collision_avoidance_example.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,36 @@ | ||
// Copyright 2022 Áron Svastits | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "moveit_examples/moveit_collision_avoidance_example.hpp" | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
// Setup | ||
// Initialize ROS and create the Node | ||
rclcpp::init(argc, argv); | ||
auto const example_node = std::make_shared<MoveitExample>(); | ||
rclcpp::executors::SingleThreadedExecutor executor; | ||
executor.add_node(example_node); | ||
std::thread([&executor]() { executor.spin(); }).detach(); | ||
|
||
moveItCollisionAvoidanceExample(example_node, | ||
std::vector<double>{0.2111, -0.9106, 0.0, -1.8677, 1.2075, -0.2111}, | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(0).z(1.2), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.3).y(-0.075).z(1), | ||
geometry_msgs::build<geometry_msgs::msg::Vector3>().x(0.1).y(1.0).z(0.1)); | ||
|
||
// Shutdown ROS | ||
rclcpp::shutdown(); | ||
return 0; | ||
} |
Oops, something went wrong.