Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added accuracy test for moveit/gazebo motion
added accuracy test for moveit/gazebo motion removed goal duration check from MoveIt
- Loading branch information
Showing
6 changed files
with
1,148 additions
and
9 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
137 changes: 137 additions & 0 deletions
137
kinova_moveit/kinova_arm_moveit_demo/include/test_accuracy.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,137 @@ | ||
#ifndef TEST_ACCURACY_H | ||
#define TEST_ACCURACY_H | ||
|
||
#include <ros/ros.h> | ||
#include <kinova_driver/kinova_ros_types.h> | ||
|
||
#include <actionlib/client/simple_action_client.h> | ||
#include <kinova_msgs/SetFingersPositionAction.h> | ||
|
||
// MoveIt! | ||
#include <moveit/robot_model_loader/robot_model_loader.h> | ||
#include <moveit/robot_state/robot_state.h> | ||
#include <moveit/robot_state/conversions.h> | ||
|
||
#include <moveit/move_group_interface/move_group.h> | ||
#include <moveit/planning_interface/planning_interface.h> | ||
#include <moveit/planning_scene/planning_scene.h> | ||
#include <moveit/planning_scene_monitor/planning_scene_monitor.h> | ||
#include <moveit/planning_pipeline/planning_pipeline.h> | ||
|
||
#include <moveit/kinematic_constraints/utils.h> | ||
#include <geometric_shapes/solid_primitive_dims.h> | ||
|
||
#include <moveit_msgs/PlanningScene.h> | ||
#include <moveit_msgs/AttachedCollisionObject.h> | ||
#include <moveit_msgs/GetStateValidity.h> | ||
#include <moveit_msgs/DisplayRobotState.h> | ||
#include <moveit_msgs/ApplyPlanningScene.h> | ||
#include <moveit_msgs/DisplayTrajectory.h> | ||
#include <fstream> | ||
#include <pwd.h> | ||
#include <eigen_conversions/eigen_msg.h> | ||
|
||
namespace kinova | ||
{ | ||
|
||
|
||
class PickPlace | ||
{ | ||
public: | ||
PickPlace(ros::NodeHandle &nh); | ||
~PickPlace(); | ||
|
||
|
||
|
||
private: | ||
ros::NodeHandle nh_; | ||
|
||
// open&close fingers: gripper_group_.plan not alway have a solution | ||
actionlib::SimpleActionClient<kinova_msgs::SetFingersPositionAction>* finger_client_; | ||
|
||
moveit::planning_interface::MoveGroup* group_; | ||
moveit::planning_interface::MoveGroup* gripper_group_; | ||
robot_model::RobotModelPtr robot_model_; | ||
// robot_state::RobotStatePtr robot_state_; | ||
|
||
planning_scene::PlanningScenePtr planning_scene_; | ||
planning_scene_monitor::PlanningSceneMonitorPtr planning_scene_monitor_; | ||
|
||
// work scene | ||
moveit_msgs::CollisionObject co_; | ||
moveit_msgs::AttachedCollisionObject aco_; | ||
moveit_msgs::PlanningScene planning_scene_msg_; | ||
|
||
|
||
ros::Publisher pub_co_; | ||
ros::Publisher pub_aco_; | ||
ros::Publisher pub_planning_scene_diff_; | ||
ros::Subscriber sub_pose_; | ||
ros::Subscriber sub_joint_; | ||
|
||
// | ||
std::vector<std::string> joint_names_; | ||
std::vector<double> joint_values_; | ||
|
||
// use Kinova Inverse Kinematic model to generate joint value, then setJointTarget(). | ||
bool use_KinovaInK_; | ||
|
||
// check some process if success. | ||
bool result_; | ||
// wait for user input to continue: cin >> pause_; | ||
std::string pause_; | ||
std::string robot_type_; | ||
bool robot_connected_; | ||
|
||
// update current state and pose | ||
boost::mutex mutex_state_; | ||
boost::mutex mutex_pose_; | ||
sensor_msgs::JointState current_state_; | ||
geometry_msgs::PoseStamped current_pose_; | ||
|
||
|
||
// define pick_place joint value and pose | ||
std::vector<double> start_joint_; | ||
std::vector<double> grasp_joint_; | ||
std::vector<double> pregrasp_joint_; | ||
std::vector<double> postgrasp_joint_; | ||
|
||
geometry_msgs::PoseStamped start_pose_; | ||
geometry_msgs::PoseStamped grasp_pose_; | ||
geometry_msgs::PoseStamped can_pose_; | ||
geometry_msgs::PoseStamped pregrasp_pose_; | ||
geometry_msgs::PoseStamped postgrasp_pose_; | ||
|
||
bool cartesian_move_; | ||
std::ofstream o_file_; | ||
|
||
void build_workscene(); | ||
void add_obstacle(); | ||
void add_complex_obstacle(); | ||
void clear_obstacle(); | ||
void clear_workscene(); | ||
void add_attached_obstacle(); | ||
void add_target(); | ||
|
||
void define_joint_values(); | ||
void define_cartesian_pose(); | ||
geometry_msgs::PoseStamped generate_gripper_align_pose(geometry_msgs::PoseStamped targetpose_msg, double dist, double azimuth, double polar, double rot_gripper_z); | ||
void setup_constrain(geometry_msgs::Pose target_pose, bool orientation, bool position); | ||
void check_constrain(); | ||
|
||
bool my_pick(); | ||
bool my_place(); | ||
|
||
void get_current_state(const sensor_msgs::JointStateConstPtr &msg); | ||
void get_current_pose(const geometry_msgs::PoseStampedConstPtr &msg); | ||
// TODO: use Kinova inverse kinematic solution instead of from ROS. | ||
void getInvK(geometry_msgs::Pose &eef_pose, std::vector<double> &joint_value); | ||
void check_collision(); | ||
void evaluate_plan(moveit::planning_interface::MoveGroup &group); | ||
bool gripper_action(double gripper_rad); | ||
void evaluate_move_accuracy(); | ||
}; | ||
} | ||
|
||
|
||
#endif // TEST_ACCURACY |
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
Oops, something went wrong.