00001 /* 00002 * Copyright (c) 2011, A.M.Howard, S.Williams 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * * Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * * Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in the 00011 * documentation and/or other materials provided with the distribution. 00012 * * Neither the name of the <organization> nor the 00013 * names of its contributors may be used to endorse or promote products 00014 * derived from this software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00017 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY 00020 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00023 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 /* 00028 * dummy_actuator.h 00029 * 00030 * Created on: Nov 27, 2011 00031 * Author: Stephen Williams 00032 */ 00033 00034 #ifndef DUMMY_ACTUATOR_H_ 00035 #define DUMMY_ACTUATOR_H_ 00036 00037 #include <ros/ros.h> 00038 00039 namespace actuator_array_example 00040 { 00041 00042 // This class simulates a simple RC-type servo motor 00043 class DummyActuator 00044 { 00045 private: 00046 00047 // Minimum allowed position 00048 double min_position_; 00049 00050 // Maximum allowed position 00051 double max_position_; 00052 00053 // Maximum allowed velocity 00054 double max_velocity_; 00055 00056 // Home position 00057 double home_; 00058 00059 // Default velocity 00060 double default_velocity_; 00061 00062 // Current Position 00063 double position_; 00064 00065 // Current Velocity 00066 double velocity_; 00067 00068 // Commanded Position 00069 double cmd_position_; 00070 00071 // Commanded Velocity 00072 double cmd_velocity_; 00073 00074 // Setup the properties and default values for this actuator 00075 void configure(double min_position, double max_position, double max_velocity, double home); 00076 00077 public: 00078 DummyActuator(); 00079 DummyActuator(double min_position, double max_position, double max_velocity, double home); 00080 virtual ~DummyActuator(); 00081 00082 void update(double dt); 00083 void setPosition(double position); 00084 void setVelocity(double velocity); 00085 00086 double getPosition(); 00087 double getVelocity(); 00088 double getMaxTorque(); 00089 00090 void home(); 00091 void stop(); 00092 }; 00093 00094 } 00095 00096 #endif // DUMMY_ACTUATOR_H_