- 17
- 0
- 约9.73千字
- 约 10页
- 2017-05-12 发布于河南
- 举报
机器人避障
源程序如下:
/*
Template to access ARIA (ActivMedia Robotics Interface for Applications)
using Microsoft Visual C++, console Projects.
*/
# include Aria.h
# include cstdlib
# include iostream
# include iomanip
# include fstream
# include ctime
# include math.h
# include cmath
using namespace std;
// the robot
ArRobot *robot;
ArSonarDevice sonar; // sonar, must be added to the robot
ArSick sick; // the laser
int step=0;
double d0,d1,d3,d2,d4,d15;
double th,r,PI=3.1415926;
double minimum=0;
//sonar sensor offset positions with respect to robot local coordinate frame
double robotSonarX[8] = {69,114,148,166,166,148,114,69};
double robotSonarY[8] = {136,119,78,27,-27,-78,-119,-136};
double robotSonarTh[8] = {90.0, 50.0, 30.0, 10.0, -10.0, -30.0, -50.0, -90.0};
double laserData[2][180];
double sonarData[5][16]; // last 5 sets of sonar readings
double posData[5]; // odometry readings
long frameCount = -1; //how many iterations of the sensor grabbing functions have been run
/*********************************************************************************
Files for logging position and sensor data
*********************************************************************************/
ofstream positionData(positionvals.txt);
ofstream sonarVals(sonarvals.txt);
ofstream globalFrame(globalFrame.txt);
/*********************************************************************************
Function Definitions
*********************************************************************************/
void grabNewPositionData(void);
void logPositionData(void);
void grabNewSonarData(void);
void logRawSonarData(void);
void MapToGlobalFrame(void);
bool flag = true;
bool weWantToTurnTheRobot = true;
bool decideWhichDirectionToTurn = true;
bool turnRobotRight = false;
bool turnRobotLeft = false;
void update(void)
{// Your Code Here
grabNewSonarData();
grabNewPositionData();
logPositionData();
logRawSonarData();
//grabNewLaserData();
MapToGlobalFrame();
int sequ
您可能关注的文档
- 客厅阳台装修要注意的三大点.doc
- 客户经理专刊第20100902期.doc
- 室内污染危害儿童呼吸道甚于PM2点5.doc
- 室内设计风格1.doc
- 家和万事兴(马来).doc
- 家和万事兴(蔡礼旭老师主讲).doc
- 家庭医生制度.doc
- 家庭基本情况.doc
- 家和万事兴书画真迹.doc
- 家庭基本情况和目标.doc
- 小区绿化施工协议书.docx
- 墙面施工协议书.docx
- 1 古诗二首(课件)--2025-2026学年统编版语文二年级下册.pptx
- (2026春新版)部编版八年级道德与法治下册《3.1《公民基本权利》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《4.3《依法履行义务》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《6.2《按劳分配为主体、多种分配方式并存》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《6.1《公有制为主体、多种所有制经济共同发展》PPT课件.pptx
- 初三教学管理交流发言稿.docx
- 小学生课外阅读总结.docx
- 餐饮门店夜经济运营的社会责任报告(夜间贡献)撰写流程试题库及答案.doc
原创力文档

文档评论(0)