jog_arm_server.h
Go to the documentation of this file.
00001 
00002 //      Title     : jog_arm_server.h
00003 //      Project   : jog_arm
00004 //      Created   : 3/9/2017
00005 //      Author    : Brian O'Neil, Blake Anderson, Andy Zelenak
00006 //      Platforms : Ubuntu 64-bit
00007 //      Copyright : Copyright© The University of Texas at Austin, 2014-2017. All rights reserved.
00008 //                 
00009 //          All files within this directory are subject to the following, unless an alternative
00010 //          license is explicitly included within the text of each file.
00011 //
00012 //          This software and documentation constitute an unpublished work
00013 //          and contain valuable trade secrets and proprietary information
00014 //          belonging to the University. None of the foregoing material may be
00015 //          copied or duplicated or disclosed without the express, written
00016 //          permission of the University. THE UNIVERSITY EXPRESSLY DISCLAIMS ANY
00017 //          AND ALL WARRANTIES CONCERNING THIS SOFTWARE AND DOCUMENTATION,
00018 //          INCLUDING ANY WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
00019 //          PARTICULAR PURPOSE, AND WARRANTIES OF PERFORMANCE, AND ANY WARRANTY
00020 //          THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF TRADE.
00021 //          NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF
00022 //          THE SOFTWARE OR DOCUMENTATION. Under no circumstances shall the
00023 //          University be liable for incidental, special, indirect, direct or
00024 //          consequential damages or loss of profits, interruption of business,
00025 //          or related expenses which may arise from use of software or documentation,
00026 //          including but not limited to those resulting from defects in software
00027 //          and/or documentation, or loss or inaccuracy of data of any kind.
00028 //
00030 
00031 /*
00032 Server node for the arm jogging with MoveIt.
00033 */
00034 
00035 #ifndef JOG_ARM_SERVER_H
00036 #define JOG_ARM_SERVER_H
00037 
00038 #include <Eigen/Eigenvalues>
00039 #include <geometry_msgs/Twist.h>
00040 #include <math.h>
00041 #include <moveit/move_group_interface/move_group.h>
00042 #include <moveit/robot_model_loader/robot_model_loader.h>
00043 #include <moveit/robot_state/robot_state.h>
00044 #include <ros/ros.h>
00045 #include <sensor_msgs/JointState.h>
00046 #include <string>
00047 #include <tf/transform_listener.h>
00048 
00049 namespace jog_arm {
00050  
00054 class JogArmServer
00055 {
00056 public:
00060   JogArmServer(std::string move_group_name, std::string cmd_topic_name);
00061   
00062 protected:
00063   
00064   typedef Eigen::Matrix<double, 6, 1> Vector6d;
00065   
00066   void commandCB(geometry_msgs::TwistStampedConstPtr msg);
00067 
00068   void jointStateCB(sensor_msgs::JointStateConstPtr msg);
00069 
00070   Vector6d scaleCommand(const geometry_msgs::TwistStamped& command, const Vector6d& scalar) const;
00071   
00072   Eigen::MatrixXd pseudoInverse(const Eigen::MatrixXd &J) const;
00073   
00074   bool addJointIncrements(sensor_msgs::JointState &output, const Eigen::VectorXd &increments) const;
00075   
00076   bool checkConditionNumber(const Eigen::MatrixXd &matrix, double threshold) const;
00077 
00078   ros::NodeHandle nh_;
00079   
00080   ros::Subscriber joint_sub_, cmd_sub_;
00081   
00082   moveit::planning_interface::MoveGroup arm_;
00083   const robot_state::JointModelGroup* joint_model_group_;
00084   robot_state::RobotStatePtr kinematic_state_;
00085   
00086   sensor_msgs::JointState current_joints_;
00087   
00088   std::vector<std::string> joint_names_;
00089   
00090   ros::AsyncSpinner spinner_; // Motion planner requires an asynchronous spinner
00091   
00092   tf::TransformListener listener_;
00093 };
00094 
00095 } // namespace jog_arm
00096 
00097 #endif // JOG_ARM_SERVER_H


jog_arm
Author(s): Brian O'Neil, Blake Anderson , Andy Zelenak
autogenerated on Mon Apr 3 2017 04:04:12