Questions tagged «robotc»

2
在机器人C中使用归类架构的正确方法
最近,我一直在大量阅读有关“ Subsumption Architecture”的文章,人们似乎在倡导几种不同的方式。 例如,某些人使用全局“标志”变量来控制任务。其他人使用,endTimeSlice()并允许仲裁员真正选择。我认为这是正确的。 我有一小部分的RobotC代码,我正在为跟随机器人的一行工作,但是不确定我是否做对了,因为当前track方法将始终接管find方法。正确的流程应该是:find应该使用螺旋路径来将机器人引导到生产线。找到线路后,轨道应接管。 task evade(){ if(SensorValue(forwardSonarSensor) > threshold){ //box the obstruction } } task find(){ if(SensorValue(lightSensor) > threshold){ //spiral the robot } } task track(){ if(SensorValue(lightSensor) < threshold){ //go straight }else{ //execute turns to follow the line } } task main(){ while(true){ StartTask(evade,9); StartTask(track,8); StartTask(find,7); wait1Msec(250); } } …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.