00001 /* 00002 * Copyright (C) 2011 The Board of Trustees of The Leland Stanford Junior University. All rights reserved. 00003 * 00004 * Author: Roland Philippsen 00005 * http://cs.stanford.edu/group/manips/ 00006 * 00007 * This program is free software: you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License 00009 * as published by the Free Software Foundation, either version 3 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this program. If not, see 00019 * <http://www.gnu.org/licenses/> 00020 */ 00021 00022 #ifndef OPSPACE_TYPE_I_OTG_CURSOR_HPP 00023 #define OPSPACE_TYPE_I_OTG_CURSOR_HPP 00024 00025 #include <jspace/wrap_eigen.hpp> 00026 #include <reflexxes_otg/TypeIOTG.h> 00027 00028 namespace opspace { 00029 00030 using jspace::Vector; 00031 00032 char const * otg_errstr(int otg_error_code); 00033 00034 00045 class TypeIOTGCursor 00046 { 00047 public: 00048 size_t const ndof_; 00049 double const dt_seconds_; 00050 00051 TypeIOTGCursor(size_t ndof, 00052 double dt_seconds); 00053 00068 int next(Vector const & maxvel, 00069 Vector const & maxacc, 00070 Vector const & goal); 00071 00076 int next(double maxvel, 00077 double maxacc, 00078 double goal); 00079 00080 inline Vector & position() { return pos_clean_; } 00081 inline Vector const & position() const { return pos_clean_; } 00082 inline Vector & velocity() { return vel_clean_; } 00083 inline Vector const & velocity() const { return vel_clean_; } 00084 00085 protected: 00086 typedef Eigen::Matrix<bool, Eigen::Dynamic, 1> boolvec_t; 00087 00088 TypeIOTG otg_; 00089 boolvec_t selection_; 00090 Vector pos_clean_; 00091 Vector vel_clean_; 00092 Vector pos_dirty_; 00093 Vector vel_dirty_; 00094 }; 00095 00096 } 00097 00098 #endif // OPSPACE_TYPE_I_OTG_CURSOR_HPP