00001 /* 00002 走行制御パラメータ更新 00003 Satofumi KAMIMURA 00004 $Id$ 00005 */ 00006 00007 #include "runCtrl.h" 00008 00009 00010 void RunCtrl::setStraightRefVel(int mm_sec) { 00011 state_stack.front().params.straight_ref_vel = mm_sec; 00012 if (sendStraightRefVel(mm_sec) < 0) { 00013 throw RunCtrl_Exception("Transmit fail: in sendStraightRefVel()"); 00014 } 00015 } 00016 00017 00018 void RunCtrl::setStraightRefAcc(int mm_acc) { 00019 state_stack.front().params.straight_ref_acc = mm_acc; 00020 if (sendStraightRefAcc(mm_acc) < 0) { 00021 throw RunCtrl_Exception("Transmit fail: in sendStraightRefAcc()"); 00022 } 00023 } 00024 00025 00026 void RunCtrl::setRotateRefVel(const VXV::Direction& rotate_vel) { 00027 state_stack.front().params.rotate_ref_vel = to_div16(rotate_vel); 00028 if (sendRotateRefVel(to_div16(rotate_vel)) < 0) { 00029 throw RunCtrl_Exception("Transmit fail: in sendRotateRefVel()"); 00030 } 00031 } 00032 00033 00034 void RunCtrl::setRotateRefAcc(const VXV::Direction& rotate_acc) { 00035 state_stack.front().params.rotate_ref_acc = to_div16(rotate_acc); 00036 if (sendRotateRefAcc(to_div16(rotate_acc)) < 0) { 00037 throw RunCtrl_Exception("Transmit fail: in sendRotateRefAcc()"); 00038 } 00039 } 00040 00041 00042 void RunCtrl::setCurveRadius(int mm) { 00043 state_stack.front().params.follow_r = mm; 00044 if (sendCurveRadius(mm) < 0) { 00045 throw RunCtrl_Exception("Transmit fail: in sendCurveRadius()"); 00046 } 00047 } 00048 00049 00050 int RunCtrl::getStraightVel(void) { 00051 int straight_vel = 0; 00052 if (recvStraightVel(&straight_vel) < 0) { 00053 throw RunCtrl_Exception("Transmit fail: in recvStraightVel()"); 00054 } 00055 return straight_vel; 00056 } 00057 00058 00059 VXV::Direction RunCtrl::getRotateVel(void) { 00060 int rotate_vel = 0; 00061 if (recvRotateVel(&rotate_vel) < 0) { 00062 throw RunCtrl_Exception("getRotateVel()"); 00063 } 00064 return VXV::Direction::rad(2.0 * M_PI * rotate_vel / 0x10000); 00065 } 00066 00067 00068 int RunCtrl::getCurveRadius(void) { 00069 return state_stack.front().params.follow_r; 00070 } 00071