INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

response.h

00001 /*************************************************************************
00002         
00003         date            : August 2008
00004         copyright       : (C) 2005 J.D. Yamokoski
00005         email   : yamokosk+gnu at gmail dot com
00006 
00007  This library is free software; you can redistribute it and/or
00008  modify it under the terms of the GNU Lesser General Public License as
00009  published by the Free Software Foundation; either version 2.1 of the License,
00010  or (at your option) any later version. The text of the GNU Lesser General
00011  Public License is included with this library in the file LICENSE.TXT.
00012  
00013  This library is distributed in the hope that it will be useful, but WITHOUT
00014  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015  or FITNESS FOR A PARTICULAR PURPOSE. See the file LICENSE.TXT for
00016  more details.
00017  
00018  *************************************************************************/
00019 
00020 #ifndef MHI_PA10_COMMAND_RESPONSE_H
00021 #define MHI_PA10_COMMAND_RESPONSE_H
00022 
00023 #include "mhidefs.h"
00024 #include "unitconverter.h"
00025 #include "message.h"
00026 #include "model.h"
00027 
00028 #include <vector>
00029 #include <stdint.h>
00030 #include <hydrointerfaces/mhipa10.h>
00031 
00032 namespace mhipa10arc 
00033 {
00034 
00035 
00036 class MotionCommandResponse
00037 {
00038         // Servo received data format
00039         struct ServoDataMsg
00040         {
00041                 uint16_t        status;         // Status
00042                 int32_t ang;                    // Joint angle
00043                 int16_t spd;                    // Joint velocity
00044                 int16_t trq;                    // Joint torque
00045         } __attribute__((__packed__));
00046 
00047         struct ArmDataMsg
00048         {
00049                 ServoDataMsg    servoData[7];
00050                 uint16_t                status;
00051         } __attribute__((__packed__));
00052 
00053 
00054         // Entire packet - message plus header
00055         struct MessageFormat
00056         {
00057                 Message::Header hdr;
00058                 ArmDataMsg data;
00059         } __attribute__((__packed__));
00060 
00061 public:
00062         MotionCommandResponse( MessagePtr& msg );
00063         virtual ~MotionCommandResponse() {}
00064 
00065         // Is there a warning or error condition from the communication CPU
00066         bool isCommWarn() const;
00067         bool isCommFault() const;
00068         
00069         // Is there a warning or error condition from one of the servo CPUs
00070         bool isServoWarn( unsigned int servoNo ) const;
00071         bool isServoFault( unsigned int servoNo ) const;
00072         
00073         // Gets all current arm status messages as a string.
00074         std::string getStatusAsString() const;
00075 
00076         // Prints out in human-readable form
00077         std::string toString() const;
00078 
00079         // Allow direct access to the raw data
00080         const MessagePtr& rawMessage() const { return msg_; }
00081         
00082         // Return the data
00083         const hydrointerfaces::MitsubishiPA10::ManipulatorData& data() const {return armdata_;}
00084 
00085 private:
00086         // Convert to a more friendly format
00087         void convertMessageToData();
00088         
00089         hydrointerfaces::MitsubishiPA10::ManipulatorData armdata_;
00090         MessagePtr msg_;
00091 };
00092 
00093 typedef std::auto_ptr<MotionCommandResponse> MotionCommandResponsePtr;
00094 
00095 }
00096 
00097 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5