全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
注意事项:1 7月5日前,将作业以邮件形式提交,邮件主题为学号后四位。2 作业内容放入附件中,应包括以下内容: i. 题目译文,解题思路,主要算法,测试数据及运行结果,文件名为 *.doc ,*为学号后四位。ii. 源代码,文件名为 *.cpp ,*为学号后四位。3数据的输入输出格式可以自行决定,不必按题目的要求。A robot arm used in an automated factory consists of N connected links: link1 which is connected to link2, and linkN-1 which is connected to linkN. Each link is a straight rod of a specified length, len1, len2, , lenN. Between each pair of connected links is a servo, servo2 (between link1 and link2), , and servoN (between linkN-1 and linkN) that can be activated to adjust the angle between the connected links. Link1 is also connected by a servo, servo1, to the factory floor (at the point x=0, y=0, z=0 in a Cartesian coordinate system). At the free (unconnected) end of the last link (linkN) is a “hand” that can be used to grasp objects.In the initial setting of the robot arm, each servo is set to no rotation (0 degrees), and the links in the robot arm coincide with the z-axis. The xy plane is horizontal (the factory floor), and the entire robot arm is initially pointing up, vertically. From this initial setting, each servo can effect a rotation of up to 90 degrees in either of two directions. Servo1 moves the entire robot arm in the xz plane by rotation about the y-axis. Servo2 moves the arm (except link1) in the (perhaps rotated) yz plane by rotation about the x-axis. In a similar manner, each odd-numbered servo can rotate the remaining part of the arm in the (perhaps rotated) xz plane, and each even-numbered servo can rotate the remaining part of the arm in the (perhaps rotated) yz plane. In effect, the servos rotate the links about the y and x-axes of coordinate systems fixed to the end of each link. Counterclockwise rotations about a coordinate axis are produced with positive rotation angles, if we are looking along the positive half of the axis toward the coordinate origin. The sample data has been carefully chosen to illustrate the effects of these rotations.There are two restrictions on the final positioning of the robots arm. No part of the arm can be below the factory floor, and the links in the robots arm cannot intersect with each other (except where they are connected by the servos).You should check only the final position of the arm.Given the number of links in a robots arm, their lengths, and the proposed settings of the servos, first determine if the proposed positioning of the arm is allowable. If the arm can be positioned as proposed, then determine the coordinates of the robots hand, accurate to three fractional digits. Otherwise identify the first (smallest numbered) servo that has an inappropriate setting, and why that setting is inappropriate. Links are assumed to intersect if they come within 0.001 length units of each other.InputThe input data will contain multiple test cases. Each test case includes, in order, the number of links, N, their lengths, len1, , lenN, and the proposed angles to which the servos (starting with servo1) are to be set. The lengths and servo angles are real numbers, and the number of links is an integer. There will be no more than 10 links in any robot arm. The last test case is followed by a negative integer.OutputFor each test case, display the test case number (starting with 1). Then, if the proposed setting is allowable, display the position of the robots hand in the original (factory floor) coordinate system (with three fractional digits). Otherwise display the identity of the first servo with an inappropriate setting and why that setting is inappropriate. An output format similar to that shown below is acceptable.翻译:一种用于工厂自动化的机器人手臂由N条相连的环节组成:link1连接Link2,和link n-1连接link n.每个链接是一个指定的一个直杆长度,len1,len2,len n.每对链接之间的联系是一个伺服系统,servo2(link1和Link2之间),.,直到servo n(link n-1和link n之间),这些伺服可以被激活从而调节链接之间的角度。link1也是由伺服servo1连接到工厂地面(以x=0,y=0,z=0为原点的笛卡尔坐标系统).最后一个链路(link n)的末端(未参与连接的部分)是一个“手”,可以用来抓住物体。在机器人手臂的初始设置中,每个伺服设置为无旋转(0度),即在机器人手臂的链接与Z轴类一致。而水平XY面即为工厂地面,整个机器人手臂最初是竖起来的,垂直的.从这个初始设置起,每个伺服系统可以在两个方向中的任一个方向完成一个高达90度的旋转.servo1移动整个手臂在XZ平面绕Y轴旋转。servo2(除去link1)移动手臂在YZ平面(可能会旋转)绕X轴旋转。以类似的方式,每个奇数伺服可以在XZ平面上转动手臂的剩余部分(可能旋转),每个偶数伺服可以在YZ平面上旋转手臂的剩余部分(可能旋转)。实际上,伺服绕笛卡尔坐标系统的X轴,Y轴转动,该系统固定在每条链路的末端。如果我们沿着正轴的正半轴向着坐标原点看去,绕着某个坐标轴逆时针旋转会有一个确切的角度。样本数据被仔细选择后用于说明这些旋转的影响。机器人手臂的最终定位有两个限制。手臂不能有任何部分低于工厂的地面,并且机器人手臂中的链接不能交叉(除非他们是由伺服系统连接)。你要检查手臂的最后位置.。机器人手臂中链接的数量、长度、以及伺服系统推荐设置,首先确定所提出的手臂定位是否是的允许。如果所提议手臂可以被定位,然后确定机器人的手的坐标,精确到三个小数位数。否则显示第一个(最小编号)伺服有不合适的设置以及不当原因。如果链路误差小于0.001个长度单位,链接被假定为交叉。输入:输入数据将包含多种测试用例。每个测试案例包括:有顺序,有链接的数量N,及长度,从len1到lenn,还有已被设置的伺服的系统(以servo1开始)所提议的角度。长度和伺服角度是实数,链接的数量是一个整数。机器人手臂中不能超过10个链接。最后一个测试用例是由负整数完成。输出:对于每个测试用例,显示测试用例号(从1开始)。然后,如果允许推荐设置,就显示机器人的手在最初的的(工厂地面)坐标系统的位置(保留三位小数位数)。否则显示第一个伺服有一个不恰当的设置以及不当原因。类似于下面所示的输出格式是可以接受的: Sample InputOutput for the Sample Input2 25 15 0 90.01 1.0 45.02 1 1 0 454 1 2 3 4 90 0 0 03 1 1 1 0 90 902 1 1 45.0 454 1 1 1 2 0 90 0 908 10 1 1 1 1 1 1 2 0 0 90 0 90 0 90 0-1Case 1: robots hand is at (0.000,-15.000,25.000)Case 2: robots hand is at (0.707,0.000,0.707)Case 3: robots hand is at (0.000,-0.707,1.707)Case 4: robots hand is at (10.000,0.000,0.000)Case 5: robots hand is at (1.000,-1.000,1.000)Case 6: robots hand is at (1.207,-0.707,1.207)Case 7: servo 4 attempts to move arm below floorCase 8: servo 8 causes link collision提 示主要涉及向量的加、减运算,特别是向量的旋转,从第n个servo开始计算更简便。可以简化为只考虑正常情况下能够给出hand的最终位置即可,低于地面或相互交叉等情况可以不考虑。#include #include #define PI3.1415926/ 利用结构体定义“点”类型struct Pointdouble x,y,z;/ 定义“向量”类型, 在随后的程序中,Point和Vector实际上是同一类型/ 可以根据需要用不同的名字typedef Point Vector;/ 可以直接用加号,进行向量的加法运算Vector operator+( Vector a, Vector b)Vector c;c.x = a.x + b.x;c.y = a.y + b.y;c.z = a.z + b.z;return c;/ 可以直接用减号,进行向量的减
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 阀门销售行业常见问题及解决方案
- 2025年“羊城工匠杯”广州市班组长综合管理技能竞赛理论题库大全-下(多选题)
- 2025年护师类之外科护理主管护师模拟题库及答案下载
- 常熟税务筹划协议书
- egt高级课程协议书
- mac地址映射协议书
- 2025年广东省普通高中学业水平合格性考试英语试题(原卷版)
- 出售远期利率协议书
- 多功能收获控制系统创新创业项目商业计划书
- 墨水颜色定制服务创新创业项目商业计划书
- 2025年韶关市(中小学、幼儿园)教师招聘考试题库及答案
- 小学法制教育及安全课件下载
- 2025至2030全球及中国油气田设备和服务行业产业运行态势及投资规划深度研究报告
- 实验安全考试试题及答案
- 2025年技能等级证书护理题库及答案
- 知道网课《材料检测技术(同济大学)》课后章节测试答案
- 糕点工艺流程标准化操作指导
- 汽修行业环保培训课件
- 运动驱动学习力
- 陕西省安康市2024-2025学年高二上学期期中考试物理试卷(含解析)
- 大学生国家安全教育(复旦大学版)学习通网课章节测试答案
评论
0/150
提交评论