aubo_hardware_interface.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2015, University of Colorado, Boulder
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of the Univ of CO, Boulder nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *********************************************************************
00034 
00035  Author: Dave Coleman
00036  */
00037 
00038 #ifndef AUBO_HARDWARE_INTERFACE_H
00039 #define AUBO_HARDWARE_INTERFACE_H
00040 
00041 #include <hardware_interface/joint_state_interface.h>
00042 #include <hardware_interface/joint_command_interface.h>
00043 #include <hardware_interface/force_torque_sensor_interface.h>
00044 #include <hardware_interface/robot_hw.h>
00045 #include <hardware_interface/controller_info.h>
00046 #include <controller_manager/controller_manager.h>
00047 #include <boost/scoped_ptr.hpp>
00048 #include <ros/ros.h>
00049 #include <math.h>
00050 #include "do_output.h"
00051 #include "aubo_new_driver.h"
00052 
00053 namespace ros_control_aubo {
00054 
00055 // For simulation only - determines how fast a trajectory is followed
00056 static const double POSITION_STEP_FACTOR = 1;
00057 static const double VELOCITY_STEP_FACTOR = 1;
00058 
00060 class AuboHardwareInterface: public hardware_interface::RobotHW {
00061 public:
00062 
00067         AuboHardwareInterface(ros::NodeHandle& nh, AuboNewDriver* robot);
00068 
00070         virtual void init();
00071 
00073         virtual void read();
00074 
00076         virtual void write();
00077 
00078         void setMaxVelChange(double inp);
00079 
00080         bool canSwitch(
00081                         const std::list<hardware_interface::ControllerInfo> &start_list,
00082                         const std::list<hardware_interface::ControllerInfo> &stop_list) const;
00083         void doSwitch(const std::list<hardware_interface::ControllerInfo>&start_list,
00084                         const std::list<hardware_interface::ControllerInfo>&stop_list);
00085 
00086 protected:
00087 
00088         // Startup and shutdown of the internal node inside a roscpp program
00089         ros::NodeHandle nh_;
00090 
00091         // Interfaces
00092         hardware_interface::JointStateInterface joint_state_interface_;
00093         hardware_interface::ForceTorqueSensorInterface force_torque_interface_;
00094         hardware_interface::PositionJointInterface position_joint_interface_;
00095         hardware_interface::VelocityJointInterface velocity_joint_interface_;
00096         bool velocity_interface_running_;
00097         bool position_interface_running_;
00098         // Shared memory
00099         std::vector<std::string> joint_names_;
00100         std::vector<double> joint_position_;
00101         std::vector<double> joint_velocity_;
00102         std::vector<double> joint_effort_;
00103         std::vector<double> last_joint_position_command_;
00104         std::vector<double> joint_position_command_;
00105         std::vector<double> joint_velocity_command_;
00106         std::vector<double> prev_joint_velocity_command_;
00107         std::size_t num_joints_;
00108         double robot_force_[3] = { 0., 0., 0. };
00109         double robot_torque_[3] = { 0., 0., 0. };
00110 
00111         double max_vel_change_;
00112 
00113         // Robot API
00114         AuboNewDriver* robot_;
00115 
00116 };
00117 // class
00118 
00119 }// namespace
00120 
00121 #endif


aubo_new_driver
Author(s): liuxin
autogenerated on Wed Sep 6 2017 03:06:44