Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef ROBOTARM_H_
00008 #define ROBOTARM_H_
00009
00010 #include <boost/noncopyable.hpp>
00011
00012 #include <ros/ros.h>
00013
00014
00015 class RobotArm : private boost::noncopyable {
00016
00017 public:
00018 typedef uint_fast16_t IDType;
00019
00020
00021 RobotArm(IDType id_offset = 0)
00022 : id_offset_(id_offset),
00023 modules_count_(0)
00024 {
00025 }
00026
00027 virtual ~RobotArm() {
00028 }
00029
00030 virtual void init() = 0;
00031
00032
00033 virtual int emergencyStopJoint(IDType id) = 0;
00034 virtual void emergencyStopAll() {
00035 for (IDType id = 0; id < modules_count_; ++id)
00036 emergencyStopJoint(id);
00037 }
00038
00039 virtual int normalStopJoint(IDType id) = 0;
00040 virtual void normalStopAll() {
00041 for (IDType id = 0; id < modules_count_; ++id)
00042 normalStopJoint(id);
00043 }
00044
00045 virtual int ackJoint(IDType id) = 0;
00046 virtual void ackAll() {
00047 for (IDType id = 0; id < modules_count_; ++id)
00048 ackJoint(id);
00049 }
00050
00051 virtual int refJoint(IDType id) = 0;
00052 virtual void refAll() {
00053 for (IDType id = 0; id < modules_count_; ++id)
00054 refJoint(id);
00055 }
00056
00057
00058 virtual float getPosition(IDType id) = 0;
00059 virtual float getVelocity(IDType id) = 0;
00060 virtual float getMaxCurrent(IDType id) = 0;
00061
00062
00063 virtual int setVelocity(IDType id, float velocity) = 0;
00064 virtual int setAcceleration(IDType id, float acceleration) = 0;
00065 virtual int setCurrent(IDType id, float current) = 0;
00066
00067 virtual void setCurrentsToMax() {
00068 for (IDType id = 0; id < modules_count_; ++id)
00069 setCurrent(id, getMaxCurrent(id));
00070 }
00071
00072 virtual int movePosition(IDType id, float position) = 0;
00073 virtual int movePositionDuration(IDType id, float position, uint16_t msecs) = 0;
00074 virtual int moveVelocity(IDType id, float v) = 0;
00075
00076
00077
00078
00079 virtual void getModuleStatus(IDType module_id, uint8_t& referenced, uint8_t& moving,
00080 uint8_t& prog_mode, uint8_t& warning, uint8_t& error, uint8_t& brake,
00081 uint8_t& move_end, uint8_t& pos_reached, uint8_t& error_code, float& current) = 0;
00082
00083
00084 unsigned int getModulesCount() const {
00085 return modules_count_;
00086 }
00087
00088 protected:
00089
00090
00091 IDType id_offset_;
00092
00093 unsigned int modules_count_;
00094 };
00095
00096
00097 #endif