-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from ipa-fxm/test_of_feature
[WIP] Finalizing/Testing of TwistController features
- Loading branch information
Showing
120 changed files
with
8,838 additions
and
5,383 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
16 changes: 16 additions & 0 deletions
16
cob_cartesian_controller/action/CartesianController.action
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 @@ | ||
# goal definition | ||
uint8 LIN=1 | ||
uint8 CIRC=2 | ||
uint8 move_type | ||
|
||
cob_cartesian_controller/MoveLin move_lin | ||
cob_cartesian_controller/MoveCirc move_circ | ||
|
||
--- | ||
# result definition | ||
bool success | ||
string message | ||
--- | ||
# Define a feedback message | ||
uint8 state | ||
string message |
23 changes: 23 additions & 0 deletions
23
cob_cartesian_controller/config/example_cartesian_controller.yaml
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,23 @@ | ||
## joint_names | ||
joint_names: [arm_1_joint, arm_2_joint, arm_3_joint, arm_4_joint, arm_5_joint, arm_6_joint, arm_7_joint] | ||
|
||
## Cartesian controller parameters | ||
chain_base_link: arm_podest_link | ||
chain_tip_link: arm_7_link | ||
root_frame: world | ||
|
||
# twist controller parameters | ||
twist_controller: | ||
hardware_interface_type: 2 #Velocity 0, Position 1, JointStates 2 | ||
|
||
# frame_tracker + interactive_marker | ||
frame_tracker: | ||
tracking_frame: arm_7_target | ||
movable_trans: true | ||
movable_rot: true | ||
pid_trans_x: {p: 4.0, i: 0.0, d: 0.0, i_clamp: 0.0} | ||
pid_trans_y: {p: 4.0, i: 0.0, d: 0.0, i_clamp: 0.0} | ||
pid_trans_z: {p: 4.0, i: 0.0, d: 0.0, i_clamp: 0.0} | ||
pid_rot_x: {p: 4.0, i: 0.0, d: 0.0, i_clamp: 0.0} | ||
pid_rot_y: {p: 4.0, i: 0.0, d: 0.0, i_clamp: 0.0} | ||
pid_rot_z: {p: 4.0, i: 0.0, d: 0.0, i_clamp: 0.0} |
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
|
||
/*! | ||
***************************************************************** | ||
* \file | ||
* | ||
* \note | ||
* Copyright (c) 2014 \n | ||
* Copyright (c) 2015 \n | ||
* Fraunhofer Institute for Manufacturing Engineering | ||
* and Automation (IPA) \n\n | ||
* | ||
|
@@ -18,86 +17,85 @@ | |
* ROS package name: cob_cartesian_controller | ||
* | ||
* \author | ||
* Author: Christoph Mark, email: [email protected] | ||
* Author: Christoph Mark, email: [email protected] / [email protected] | ||
* | ||
* \date Date of creation: August, 2014 | ||
* \date Date of creation: July, 2015 | ||
* | ||
* \brief | ||
* ... | ||
* | ||
****************************************************************/ | ||
|
||
#ifndef CARTESIAN_CONTROLLER_H | ||
#define CARTESIAN_CONTROLLER_H | ||
|
||
#include <ros/ros.h> | ||
#include <vector> | ||
#include <tinyxml.h> | ||
#include <string.h> | ||
#include <boost/shared_ptr.hpp> | ||
|
||
#include <ros/ros.h> | ||
#include <std_msgs/Float64.h> | ||
#include <geometry_msgs/Pose.h> | ||
#include <visualization_msgs/Marker.h> | ||
#include <tf/transform_broadcaster.h> | ||
#include <tf/transform_listener.h> | ||
#include <tf/transform_broadcaster.h> | ||
#include <tf/transform_datatypes.h> | ||
|
||
#include <actionlib/server/simple_action_server.h> | ||
#include <cob_cartesian_controller/CartesianControllerAction.h> | ||
|
||
#include <cob_cartesian_controller/trajectory_interpolator/trajectory_interpolator.h> | ||
#include <cob_cartesian_controller/cartesian_controller_data_types.h> | ||
#include <cob_cartesian_controller/cartesian_controller_utils.h> | ||
|
||
typedef actionlib::SimpleActionServer<cob_cartesian_controller::CartesianControllerAction> SAS_CartesianControllerAction_t; | ||
|
||
#define DEFAULT_CARTESIAN_TARGET "cartesian_target" | ||
|
||
class CartesianController | ||
{ | ||
public: | ||
bool initialize(); | ||
void load(); | ||
|
||
// Main functions | ||
void pose_path_broadcaster(std::vector <geometry_msgs::Pose> *poseVector); | ||
void linear_interpolation(std::vector <geometry_msgs::Pose> *poseVector,geometry_msgs::Pose, geometry_msgs::Pose,double,double,std::string,bool); | ||
void circular_interpolation(std::vector<geometry_msgs::Pose> *poseVector,double,double,double,double,double,double,double,double,double,double,double,std::string); | ||
void move_ptp(geometry_msgs::Pose targetPose, double epsilon); | ||
void hold_position(geometry_msgs::Pose); | ||
|
||
// Helper function | ||
bool epsilon_area(double,double,double,double,double,double,double); | ||
geometry_msgs::Pose getEndeffectorPose(); | ||
void showMarker(tf::StampedTransform,int,double,double,double,std::string); | ||
void showDot(double,double,double,int,double,double,double,std::string); | ||
void showLevel(tf::Transform,int,double,double,double,std::string); | ||
void timerCallback(const ros::TimerEvent&); | ||
void calculateProfile(std::vector<double>*,double,double,double,std::string); | ||
void calculateProfileForAngularMovements(std::vector<double> *pathMatrix,double,double,double,double,double,double,double,double,double,std::string,bool); | ||
void generatePath(std::vector<double>*,double,double,double,double,int,std::string); | ||
void generatePathWithTe(std::vector<double> *pathArray,double T_IPO, double te, double AcclMax,double Se_max, int steps_max,double start_angle,std::string profile); | ||
void start_tracking(); | ||
void stop_tracking(); | ||
void PoseToRPY(geometry_msgs::Pose pose,double &roll, double &pitch, double &yaw); | ||
bool initialize(); | ||
|
||
// Main functions | ||
bool posePathBroadcaster(const geometry_msgs::PoseArray& cartesian_path); | ||
bool movePTP(const geometry_msgs::Pose& target_pose, double epsilon); | ||
|
||
// Helper function | ||
bool startTracking(); | ||
bool stopTracking(); | ||
|
||
/// Action interface | ||
void goalCallback(); | ||
void preemptCallback(); | ||
void actionSuccess(const bool success, const std::string& message); | ||
void actionPreempt(const bool success, const std::string& message); | ||
void actionAbort(const bool success, const std::string& message); | ||
|
||
cob_cartesian_controller::CartesianActionStruct acceptGoal(boost::shared_ptr<const cob_cartesian_controller::CartesianControllerGoal> goal); | ||
cob_cartesian_controller::MoveLinStruct convertMoveLin(const cob_cartesian_controller::MoveLin& move_lin_msg); | ||
cob_cartesian_controller::MoveCircStruct convertMoveCirc(const cob_cartesian_controller::MoveCirc& move_circ_msg); | ||
|
||
private: | ||
ros::NodeHandle nh_; | ||
|
||
// Publisher | ||
ros::Publisher vis_pub_; | ||
ros::Publisher path_pub_; | ||
ros::Publisher speed_pub_; | ||
ros::Publisher accl_pub_; | ||
ros::Publisher jerk_pub_; | ||
ros::ServiceClient startTracking_; | ||
ros::ServiceClient stopTracking_; | ||
|
||
//TF Broadcaster-Var | ||
tf::TransformBroadcaster br_; | ||
tf::Transform transform_; | ||
tf::Quaternion q_; | ||
tf::TransformListener listener_; | ||
tf::StampedTransform currentEndeffectorStampedTransform_; | ||
|
||
// Var for PTP Movement and hold Position | ||
bool reached_pos_,hold_; | ||
|
||
// yaml params | ||
double update_rate_; | ||
std::string stringPath_, fileName_; | ||
std::string referenceFrame_,targetFrame_; | ||
std::string chain_tip_link_; | ||
const char* charPath_; | ||
|
||
int marker1_; | ||
ros::NodeHandle nh_; | ||
tf::TransformListener tf_listener_; | ||
tf::TransformBroadcaster tf_broadcaster_; | ||
|
||
ros::ServiceClient start_tracking_; | ||
ros::ServiceClient stop_tracking_; | ||
bool tracking_; | ||
|
||
double update_rate_; | ||
std::string root_frame_, chain_tip_link_, target_frame_; | ||
|
||
// HelperVars for movePTP | ||
bool reached_pos_; | ||
|
||
/// Action interface | ||
std::string action_name_; | ||
boost::shared_ptr<SAS_CartesianControllerAction_t> as_; | ||
cob_cartesian_controller::CartesianControllerFeedback action_feedback_; | ||
cob_cartesian_controller::CartesianControllerResult action_result_; | ||
|
||
CartesianControllerUtils utils_; | ||
boost::shared_ptr< TrajectoryInterpolator > trajectory_interpolator_; | ||
}; | ||
|
||
#endif |
72 changes: 72 additions & 0 deletions
72
cob_cartesian_controller/include/cob_cartesian_controller/cartesian_controller_data_types.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,72 @@ | ||
/*! | ||
***************************************************************** | ||
* \file | ||
* | ||
* \note | ||
* Copyright (c) 2015 \n | ||
* Fraunhofer Institute for Manufacturing Engineering | ||
* and Automation (IPA) \n\n | ||
* | ||
***************************************************************** | ||
* | ||
* \note | ||
* Project name: care-o-bot | ||
* \note | ||
* ROS stack name: cob_control | ||
* \note | ||
* ROS package name: cob_cartesian_controller | ||
* | ||
* \author | ||
* Author: Christoph Mark, email: [email protected] / [email protected] | ||
* | ||
* \date Date of creation: July, 2015 | ||
* | ||
* \brief | ||
* ... | ||
* | ||
****************************************************************/ | ||
|
||
#ifndef COB_CARTESIAN_CONTROLLER_DATA_STRUCTURES_H_ | ||
#define COB_CARTESIAN_CONTROLLER_DATA_STRUCTURES_H_ | ||
|
||
#include <std_msgs/Float64.h> | ||
#include <geometry_msgs/Pose.h> | ||
#include <exception> | ||
|
||
namespace cob_cartesian_controller | ||
{ | ||
struct ProfileStruct | ||
{ | ||
unsigned int profile_type; | ||
double vel, accl; | ||
}; | ||
|
||
struct MoveLinStruct | ||
{ | ||
geometry_msgs::Pose start, end; | ||
bool rotate_only; | ||
|
||
ProfileStruct profile; | ||
}; | ||
|
||
struct MoveCircStruct | ||
{ | ||
geometry_msgs::Pose pose_center; | ||
double start_angle, end_angle; | ||
double radius; | ||
bool rotate_only; | ||
|
||
ProfileStruct profile; | ||
}; | ||
|
||
struct CartesianActionStruct | ||
{ | ||
unsigned int move_type; | ||
MoveLinStruct move_lin; | ||
MoveCircStruct move_circ; | ||
}; | ||
|
||
}//namespace | ||
|
||
|
||
#endif /* COB_CARTESIAN_CONTROLLER_DATA_STRUCTURES_H_ */ |
Oops, something went wrong.