joint_feedback_ex.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  * Copyright (c) 2014, Fraunhofer IPA
00005  * Author: Thiago de Freitas
00006  *
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions are met:
00011  *
00012  *  * Redistributions of source code must retain the above copyright
00013  *  notice, this list of conditions and the following disclaimer.
00014  *  * Redistributions in binary form must reproduce the above copyright
00015  *  notice, this list of conditions and the following disclaimer in the
00016  *  documentation and/or other materials provided with the distribution.
00017  *  * Neither the name of the Fraunhofer IPA, nor the names
00018  *  of its 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 "AS IS"
00022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031  * POSSIBILITY OF SUCH DAMAGE.
00032  */
00033 
00034 #ifndef MOTOMAN_DRIVER_SIMPLE_MESSAGE_JOINT_FEEDBACK_EX_H
00035 #define MOTOMAN_DRIVER_SIMPLE_MESSAGE_JOINT_FEEDBACK_EX_H
00036 
00037 #ifndef FLATHEADERS
00038 #include "simple_message/joint_data.h"
00039 #include "simple_message/simple_message.h"
00040 #include "simple_message/simple_serialize.h"
00041 #include "simple_message/shared_types.h"
00042 #include "simple_message/joint_feedback.h"
00043 #include "simple_message/messages/joint_feedback_message.h"
00044 #else
00045 #include "joint_data.h"
00046 #include "simple_message.h"
00047 #include "simple_serialize.h"
00048 #include "shared_types.h"
00049 #include "joint_feedback.h"
00050 #include "messages/joint_feedback_message.h"
00051 #endif
00052 
00053 #include<vector>
00054 
00055 namespace industrial
00056 {
00057 namespace joint_feedback_ex
00058 {
00059 
00060 class JointFeedbackEx : public industrial::simple_serialize::SimpleSerialize
00061 {
00062 public:
00069   JointFeedbackEx(void);
00074   ~JointFeedbackEx(void);
00075 
00080   void init();
00081 
00086   void init(industrial::shared_types::shared_int groups_number,
00087             std::vector<industrial::joint_feedback_message::JointFeedbackMessage> joints_feedback_points);
00088 
00095   void setGroupsNumber(industrial::shared_types::shared_int groups_number)
00096   {
00097     this->groups_number_ = groups_number;
00098   }
00099 
00100   void setJointMessages(std::vector<industrial::joint_feedback_message::JointFeedbackMessage> joint_feedback_messages)
00101   {
00102     this->joint_feedback_messages_ = joint_feedback_messages;
00103   }
00104 
00105   std::vector<industrial::joint_feedback_message::JointFeedbackMessage> getJointMessages()
00106   {
00107     return joint_feedback_messages_;
00108   }
00109 
00116   industrial::shared_types::shared_int getGroupsNumber()
00117   {
00118     return this->groups_number_;
00119   }
00120 
00126   void copyFrom(JointFeedbackEx &src);
00127 
00133   bool operator==(JointFeedbackEx &rhs);
00134 
00141   // Overrides - SimpleSerialize
00142   bool load(industrial::byte_array::ByteArray *buffer);
00143   bool unload(industrial::byte_array::ByteArray *buffer);
00144   unsigned int byteLength()
00145   {
00146     return sizeof(industrial::shared_types::shared_int) + MAX_NUM_GROUPS * (2 * sizeof(industrial::shared_types::shared_int) + sizeof(industrial::shared_types::shared_real)
00147            + 3 * (this->positions_.byteLength()));
00148   }
00149 
00150 private:
00154   industrial::shared_types::shared_int groups_number_;
00155 
00156   std::vector<industrial::joint_feedback_message::JointFeedbackMessage> joint_feedback_messages_;
00157 
00158   industrial::joint_data::JointData positions_;
00159 
00160   static const industrial::shared_types::shared_int MAX_NUM_GROUPS = 4;
00161 };
00162 }  // namespace joint_feedback_ex
00163 }  // namespace industrial
00164 
00165 
00166 #endif  // MOTOMAN_DRIVER_SIMPLE_MESSAGE_JOINT_FEEDBACK_EX_H


motoman_driver
Author(s): Jeremy Zoss (Southwest Research Institute)
autogenerated on Sat Jun 8 2019 19:06:57