2 #include <trajectory_msgs/JointTrajectory.h> 3 #include <std_srvs/Trigger.h> 4 #include <sensor_msgs/JointState.h> 5 #include <control_msgs/GripperCommandActionGoal.h> 7 #define ROTATION1_JOINT_INDX 6 8 #define ROTATION2_JOINT_INDX 7 9 #define SHOULDER1_JOINT_INDX 8 10 #define SHOULDER2_JOINT_INDX 9 11 #define SHOULDER3_JOINT_INDX 10 12 #define WRIST_JOINT_INDX 12 15 #define VALID_START_RAD_GOAL_TOLERANCE 0.174533 //10 deg 17 #define ROTATION1_VALID_START_RAD_LEFT_POS 1.567 18 #define ROTATION2_VALID_START_RAD_LEFT_POS 0.0 19 #define SHOULDER1_VALID_START_RAD_LEFT_POS -1.883 20 #define SHOULDER2_VALID_START_RAD_LEFT_POS 2.366 21 #define SHOULDER3_VALID_START_RAD_LEFT_POS 0.413287 22 #define WRIST_VALID_START_RAD_LEFT_POS 0.0 24 #define ROTATION1_VALID_START_RAD_RIGHT_POS -1.567 25 #define ROTATION2_VALID_START_RAD_RIGHT_POS 0.0 26 #define SHOULDER1_VALID_START_RAD_RIGHT_POS -1.883 27 #define SHOULDER2_VALID_START_RAD_RIGHT_POS 2.366 28 #define SHOULDER3_VALID_START_RAD_RIGHT_POS 0.413287 29 #define WRIST_VALID_START_RAD_RIGHT_POS 0.0 33 #define ROTATION1_RAD_GOAL_LEFT_POS 1.567 34 #define ROTATION2_RAD_GOAL_LEFT_POS 0.0 35 #define SHOULDER1_RAD_GOAL_LEFT_POS -1.5264 36 #define SHOULDER2_RAD_GOAL_LEFT_POS 2.1339 37 #define SHOULDER3_RAD_GOAL_LEFT_POS 0.0257 38 #define WRIST_RAD_GOAL_LEFT_POS 0.0 42 #define ROTATION1_RAD_GOAL_RIGHT_POS -1.567 43 #define ROTATION2_RAD_GOAL_RIGHT_POS 0.0 44 #define SHOULDER1_RAD_GOAL_RIGHT_POS -1.5264 45 #define SHOULDER2_RAD_GOAL_RIGHT_POS 2.1339 46 #define SHOULDER3_RAD_GOAL_RIGHT_POS 0.0257 47 #define WRIST_RAD_GOAL_RIGHT_POS 0.0 49 #define ROTATION1_RAD_GOAL_VEL 0.1 50 #define ROTATION2_RAD_GOAL_VEL 0.1 51 #define SHOULDER1_RAD_GOAL_VEL 0.1 52 #define SHOULDER2_RAD_GOAL_VEL 0.1 53 #define SHOULDER3_RAD_GOAL_VEL 0.1 54 #define WRIST_RAD_GOAL_VEL 0.1 56 #define ROTATION1_JOINT_NAME "rotation1_joint" 57 #define ROTATION2_JOINT_NAME "rotation2_joint" 58 #define SHOULDER1_JOINT_NAME "shoulder1_joint" 59 #define SHOULDER2_JOINT_NAME "shoulder2_joint" 60 #define SHOULDER3_JOINT_NAME "shoulder3_joint" 61 #define WRIST_JOINT_NAME "wrist_joint" 142 std_srvs::Trigger::Response &res)
146 trajectory_msgs::JointTrajectory traj_msg;
155 trajectory_msgs::JointTrajectoryPoint point;
162 res.message =
"arm is in invalid start position. move arm to valid start position, and try again";
173 res.message =
"gripper to the left";
184 res.message =
"gripper to the right";
197 traj_msg.points.push_back(point);
218 std_srvs::Trigger::Response &res)
220 control_msgs::GripperCommandActionGoal gripper_msg;
222 gripper_msg.goal.command.position = 0.5;
223 gripper_msg.goal.command.max_effort = 0;
224 gripper_pub.
publish(gripper_msg);
225 res.message =
"gripper open request was sent";
232 int main(
int argc,
char** argv) {
237 arm_pub = nh.
advertise<trajectory_msgs::JointTrajectory>(
"arm_trajectory_controller/command", 5);
238 gripper_pub = nh.
advertise<control_msgs::GripperCommandActionGoal>(
"gripper_controller/gripper_cmd/goal", 5);
246 gripper_pub.getNumSubscribers() <= 0 ||
247 joints_state_sub.getNumPublishers() <= 0)
254 std_srvs::Trigger::Request req;
255 std_srvs::Trigger::Response res;
#define ROTATION2_JOINT_INDX
bool openGripperCB(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
#define ROTATION1_RAD_GOAL_RIGHT_POS
#define WRIST_RAD_GOAL_LEFT_POS
ros::ServiceServer lift_arm_srv
#define ROTATION1_RAD_GOAL_LEFT_POS
void publish(const boost::shared_ptr< M > &message) const
#define ROTATION1_VALID_START_RAD_RIGHT_POS
ros::Subscriber joints_state_sub
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
#define SHOULDER3_RAD_GOAL_LEFT_POS
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
#define SHOULDER1_RAD_GOAL_RIGHT_POS
#define ROTATION1_RAD_GOAL_VEL
#define ROTATION1_JOINT_NAME
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
#define SHOULDER3_RAD_GOAL_RIGHT_POS
#define SHOULDER1_JOINT_NAME
#define ROTATION2_JOINT_NAME
#define SHOULDER2_RAD_GOAL_VEL
#define SHOULDER3_JOINT_NAME
#define ROTATION2_RAD_GOAL_LEFT_POS
#define SHOULDER1_RAD_GOAL_VEL
#define SHOULDER1_RAD_GOAL_LEFT_POS
#define ROTATION1_JOINT_INDX
ros::Publisher gripper_pub
#define WRIST_RAD_GOAL_RIGHT_POS
#define SHOULDER2_JOINT_NAME
#define SHOULDER2_RAD_GOAL_RIGHT_POS
#define SHOULDER3_RAD_GOAL_VEL
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROTATION2_RAD_GOAL_VEL
int main(int argc, char **argv)
#define SHOULDER1_JOINT_INDX
ros::ServiceServer open_gripper_srv
#define SHOULDER2_RAD_GOAL_LEFT_POS
#define SHOULDER3_JOINT_INDX
uint32_t getNumSubscribers() const
bool liftArmCB(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
#define VALID_START_RAD_GOAL_TOLERANCE
#define ROTATION2_RAD_GOAL_RIGHT_POS
void jointsUpdateCB(const sensor_msgs::JointState::ConstPtr &msg)
ROSCPP_DECL void spinOnce()
#define ROTATION1_VALID_START_RAD_LEFT_POS
#define SHOULDER2_JOINT_INDX
#define WRIST_RAD_GOAL_VEL