robotc 编程挑战 (5)

  • 任务简介
  • 程序

任务简介

本文为 virtual world challenge pack 中的基本运动(BASIC MOVEMENT)
中的 “cargo_transport_challenge”, 要求从指定区域出发,
将抓取的物体运送指定终点 (图 1 中远方的黑线) 之后, 如图 1 所示.


图 1
图 1 gcargo_transport_challeng 界面图

此挑战使用的 robot 为 “Clawbot IQ”, 基本配置如图 2 所示.


图 2

图 2 robot 基本配置

程序

#pragma config(StandardModel, "Clawbot IQ")
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//task main()
{float dist = 85;float d = 6.4;float circle = PI * d;float rotation_count = (dist + circle / 4) / circle;// gripsetMotorTarget(clawMotor, 3, 100);waitUntilMotorStop(clawMotor);// arm upsetMotorTarget(armMotor, 300, 100);waitUntilMotorStop(armMotor);// goforward(rotation_count);// ungripsetMotorTarget(clawMotor, -3, -100);waitUntilMotorStop(clawMotor);// arm upsetMotorTarget(armMotor, 300, 100);waitUntilMotorStop(armMotor);// backbackward(rotation_count);
}

运行结果如图 3 所示.


图 3
图 3 运行结果


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部