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 <controller_manager/controller_manager.h>
00046 #include <boost/scoped_ptr.hpp>
00047 #include <ros/ros.h>
00048 #include <math.h>
00049 #include "do_output.h"
00050 #include "aubo_new_driver.h"
00051 
00052 namespace ros_control_aubo {
00053 
00054 // For simulation only - determines how fast a trajectory is followed
00055 static const double POSITION_STEP_FACTOR = 1;
00056 static const double VELOCITY_STEP_FACTOR = 1;
00057 
00059 class AuboHardwareInterface: public hardware_interface::RobotHW {
00060 public:
00061 
00066         AuboHardwareInterface(ros::NodeHandle& nh, AuboNewDriver* robot);
00067 
00069         virtual void init();
00070 
00072         virtual void read();
00073 
00075         virtual void write();
00076 
00077         void setMaxVelChange(double inp);
00078 
00079         bool canSwitch(
00080                         const std::list<hardware_interface::ControllerInfo> &start_list,
00081                         const std::list<hardware_interface::ControllerInfo> &stop_list) const;
00082         void doSwitch(const std::list<hardware_interface::ControllerInfo>&start_list,
00083                         const std::list<hardware_interface::ControllerInfo>&stop_list);
00084 
00085 protected:
00086 
00087         // Startup and shutdown of the internal node inside a roscpp program
00088         ros::NodeHandle nh_;
00089 
00090         // Interfaces
00091         hardware_interface::JointStateInterface joint_state_interface_;
00092         hardware_interface::ForceTorqueSensorInterface force_torque_interface_;
00093         hardware_interface::PositionJointInterface position_joint_interface_;
00094         hardware_interface::VelocityJointInterface velocity_joint_interface_;
00095         bool velocity_interface_running_;
00096         bool position_interface_running_;
00097         // Shared memory
00098         std::vector<std::string> joint_names_;
00099         std::vector<double> joint_position_;
00100         std::vector<double> joint_velocity_;
00101         std::vector<double> joint_effort_;
00102         std::vector<double> joint_position_command_;
00103         std::vector<double> joint_velocity_command_;
00104         std::vector<double> prev_joint_velocity_command_;
00105         std::size_t num_joints_;
00106         double robot_force_[3] = { 0., 0., 0. };
00107         double robot_torque_[3] = { 0., 0., 0. };
00108 
00109         double max_vel_change_;
00110 
00111         // Robot API
00112         AuboNewDriver* robot_;
00113 
00114 };
00115 // class
00116 
00117 }// namespace
00118 
00119 #endif


aubo_new_driver
Author(s): liuxin
autogenerated on Sat Jun 8 2019 19:06:02