NIBO Library 2.11
|
00001 // 00002 // Nibo C drivers - C functions for the Nibo robot 00003 // 00004 // Copyright (C) 2007 by Nils Springob <nils@nicai-systems.de> 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00026 #ifndef NIBOCC_COPRO_HPP_ 00027 #define NIBOCC_COPRO_HPP_ 00028 #if defined(NIBOCC_USE_COPRO) || defined (DOXYGEN) 00029 00030 #include <stdint.h> 00031 #include "nibo/copro.h" 00032 00033 namespace nibocc { 00034 00038 class Copro 00039 { 00040 public: 00044 static int16_t get_speed_l() {return ::copro_speed_l;} 00045 00049 static int16_t get_speed_r() {return ::copro_speed_r;} 00050 00054 static int16_t get_ticks_l() {return ::copro_ticks_l;} 00055 00059 static int16_t get_ticks_r() {return ::copro_ticks_r;} 00060 00064 static int16_t get_current_l() {return ::copro_current_l;} 00065 00069 static int16_t get_current_r() {return ::copro_current_r;} 00070 00074 static uint8_t update() {return ::copro_update();} 00075 00079 static uint8_t stop() {return ::copro_stop();} 00080 00087 static uint8_t set_pwm(int16_t left, int16_t right) {return ::copro_setPWM(left, right);} 00088 00095 static uint8_t set_speed(int16_t left, int16_t right) {return ::copro_setSpeed(left, right);} 00096 00104 static uint8_t set_target_abs(int16_t left, int16_t right, uint16_t speed) {return ::copro_setTargetAbs(left, right, speed);} 00105 00113 static uint8_t set_target_rel(int16_t left, int16_t right, uint16_t speed) {return ::copro_setTargetRel(left, right, speed);} 00114 00122 static uint8_t set_speed_parameters(int8_t ki, int8_t kp, int8_t kd) {return ::copro_setSpeedParameters(ki, kp, kd);} 00123 00129 static uint8_t reset_odometry(int16_t left, int16_t right) {return ::copro_resetOdometry(left, right);} 00130 00131 00132 enum { 00133 PASSIVE = 0, 00134 RC5TX = 1, 00135 MEASURE = 2, 00136 }; 00140 static uint8_t get_ir_mode() {return ::copro_ir_mode;} 00141 00145 static uint8_t get_distance(uint8_t id) {return ::copro_distance[id];} 00146 00150 static uint16_t get_rc5_cmd() {return ::copro_rc5_cmd;} 00151 00155 static uint8_t ir_stop() {return ::copro_ir_stop();} 00156 00160 static uint8_t ir_start_measure() {return ::copro_ir_startMeasure();} 00161 00166 static uint8_t transmit_rc5(uint16_t rc5) {return ::copro_transmitRC5(rc5);} 00167 00168 00169 00170 }; 00171 00172 } // namespace 00173 #endif // NIBOCC_USE_COPRO 00174 #endif // NIBOCC_COPRO_HPP_