TKTrajectory.cpp
Go to the documentation of this file.
00001 /*
00002  * TKTrajectory.cpp
00003  *
00004  *  Created on: Nov 8, 2011
00005  *      Author: mriedel
00006  */
00007 
00008 #include <telekyb_base/Messages/TKTrajectory.hpp>
00009 
00010 namespace TELEKYB_NAMESPACE {
00011 
00012 TKTrajectory::TKTrajectory()
00013         : position(0.0,0.0,0.0),
00014           velocity(0.0,0.0,0.0),
00015           acceleration(0.0,0.0,0.0),
00016           jerk(0.0,0.0,0.0),
00017           snap(0.0,0.0,0.0),
00018           yawAngle(0.0),
00019           yawRate(0.0),
00020           yawAcceleration(0.0)
00021 {
00022         // Default ControlTypes.
00023         xAxisCtrl = PosControlType::Position;
00024         yAxisCtrl = PosControlType::Position;
00025         zAxisCtrl = PosControlType::Position;
00026 
00027         yawCtrl = YawControlType::AngleOnBoard;
00028 }
00029 
00030 TKTrajectory::TKTrajectory(const telekyb_msgs::TKTrajectory& tkTrajMsg)
00031 {
00032         fromTKTrajMsg(tkTrajMsg);
00033 }
00034 
00035 TKTrajectory::~TKTrajectory()
00036 {
00037 
00038 }
00039 
00040 void TKTrajectory::toTKTrajMsg(telekyb_msgs::TKTrajectory& tkTrajMsg) const
00041 {
00042         tkTrajMsg.position.x = position(0);
00043         tkTrajMsg.position.y = position(1);
00044         tkTrajMsg.position.z = position(2);
00045 
00046         tkTrajMsg.velocity.x = velocity(0);
00047         tkTrajMsg.velocity.y = velocity(1);
00048         tkTrajMsg.velocity.z = velocity(2);
00049 
00050         tkTrajMsg.acceleration.x = acceleration(0);
00051         tkTrajMsg.acceleration.y = acceleration(1);
00052         tkTrajMsg.acceleration.z = acceleration(2);
00053 
00054         tkTrajMsg.jerk.x = jerk(0);
00055         tkTrajMsg.jerk.y = jerk(1);
00056         tkTrajMsg.jerk.z = jerk(2);
00057 
00058         tkTrajMsg.snap.x = snap(0);
00059         tkTrajMsg.snap.y = snap(1);
00060         tkTrajMsg.snap.z = snap(2);
00061 
00062         tkTrajMsg.xAxisCtrlType = xAxisCtrl.index();
00063         tkTrajMsg.yAxisCtrlType = yAxisCtrl.index();
00064         tkTrajMsg.zAxisCtrlType = zAxisCtrl.index();
00065 
00066         tkTrajMsg.yawAngle = yawAngle;
00067         tkTrajMsg.yawRate = yawRate;
00068         tkTrajMsg.yawAcceleration = yawAcceleration;
00069 
00070         tkTrajMsg.yawCtrlType = yawCtrl.index();
00071 }
00072 
00076 void TKTrajectory::fromTKTrajMsg(const telekyb_msgs::TKTrajectory& tkTrajMsg)
00077 {
00078         position(0) = tkTrajMsg.position.x;
00079         position(1) = tkTrajMsg.position.y;
00080         position(2) = tkTrajMsg.position.z;
00081 
00082         velocity(0) = tkTrajMsg.velocity.x;
00083         velocity(1) = tkTrajMsg.velocity.y;
00084         velocity(2) = tkTrajMsg.velocity.z;
00085 
00086         acceleration(0) = tkTrajMsg.acceleration.x;
00087         acceleration(1) = tkTrajMsg.acceleration.y;
00088         acceleration(2) = tkTrajMsg.acceleration.z;
00089 
00090         jerk(0) = tkTrajMsg.jerk.x;
00091         jerk(1) = tkTrajMsg.jerk.y;
00092         jerk(2) = tkTrajMsg.jerk.z;
00093 
00094         snap(0) = tkTrajMsg.snap.x;
00095         snap(1) = tkTrajMsg.snap.y;
00096         snap(2) = tkTrajMsg.snap.z;
00097 
00098         xAxisCtrl = *PosControlType::get_by_index(tkTrajMsg.xAxisCtrlType % PosControlType::size);
00099         yAxisCtrl = *PosControlType::get_by_index(tkTrajMsg.yAxisCtrlType % PosControlType::size);
00100         zAxisCtrl = *PosControlType::get_by_index(tkTrajMsg.zAxisCtrlType % PosControlType::size);
00101 
00102         yawAngle = tkTrajMsg.yawAngle;
00103         yawRate = tkTrajMsg.yawRate;
00104         yawAcceleration = tkTrajMsg.yawAcceleration;
00105 
00106         yawCtrl = *YawControlType::get_by_index(tkTrajMsg.yawCtrlType % YawControlType::size);
00107 }
00108 
00109 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


telekyb_base
Author(s): Dr. Antonio Franchi and Martin Riedel
autogenerated on Mon Nov 11 2013 11:12:34