Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use the vector and rotation functions you created above to find the endpoints of the links in a 3D arm. In addition to standard Matlab
Use the vector and rotation functions you created above to find the endpoints of the links in a 3D arm. In addition to standard Matlab functions, your code may assume that you have access to the functions you created in previous assignments (some of these you will call directly in this assignment, some will only be called by other functions that you call). Remember that for these functions, the grading script will use the instructor's copy of the functions: vector set rotate vector set currulative sum rotation set cumulative product threeD rotation set Rz Ry Rx Function Reset BE MATLAB Documentation 1 function [link_ends,... 2 R_joints,... 3 R_links, ... 4 link_vectors_in_world,... 5 link_end_set,... 6 link_end_set_with_base) = threeD_robot_arm_endpoints(link_vectors, joint_angles, joint_axes) 7 % Take a set of link vectors and joint angles, and return a matrix whose 8 $ columns are the endpoints of all of the links (including the point that 9 $ is the first end of the first link, which should be placed at the 10 % origin). 11 12 Inputs: 13 % 14 % link_vectors: a 1xn cell array, each element of which is a 2x1 vector 15 % describing the vector from the base of the corresponding link to 16 % its end joint_angles: a nx1 vector, each element of which is the joint angle 18 9 preceeding the corresponding link 19 s joint_axes: a nxl cell array, each entry of which is 'x', 'y', or 'z', 20 s designating the axis of the corresponding joint 21 % 22 % Outputs: 17 Update the surface plots of a set of 3D links for which the original surface was drawn by threeD_draw_links', using new data from threeD_robot_arm_links'. Note that this function does not need directly to call any of your previously-written functions. Function e Reset A MATLAB Documentation 9 i function 1 = threeD_update_links[l, link_set) 2 Update the drawings of a set of surfaces for a link structure 3 4 Inputs: 5 6 % link_set: A 1xn cell array, each entry of which is a matrix whose 7 78 columns are the endpoints of the lines describing one link of the system (as constructed by planar_build_links or planar_build_links_prismatic 10 % 11 Output: 12 13 1: A cell array of the same size as link_set, in which each entry is a 14 handle to a surface structure for that link 15 16 17 18 Loop over the surfaces whose handles are in 'l', replacing their 'XData', 19 'YData', and 'ZData' with the information from 'link_set' 29 21 end 22 Code to call your function C e Reset 1 link_vectors = {(1;0;0), (1;0;0), (0; 0; 1] }; 2 joint_angles = (pi/4; -pi/2;1); 3 joint_axes = {'X', 'y','z'}; 4 link_set = threeD_robot_arm_links[link_vectors, joint_angles,joint_axes); 12 13 1: A cell array of the same size as link_set, in which each entry is a handle to a surface structure for that link Data' 15 16 17 1R 19 20 21 end 22 Loop over the surfaces whose handles are in 'l', replacing their 'YData', and 'ZData' with the information from 'link_set' Code to call your function e Reset 1 link_vectors = {(1; 0;0), (1; 0;0], [0; 0;1] }; 2 joint_angles = (pi/4; -pi/2;1); 3 joint_axes = {'X', 'y', 'z'}; 4 link_set = threeD_robot_arm_links[link_vectors, joint_angles, joint_axes); 5 ax = create_axes (317); 6 7 link_colors = {'r',[0.5 0.5 0.5], 'k'}; 8 9 1 = draw_links (link_set, link_colors, ax); 10 11 view(ax,3) 13 link_set = threeD_robot_arm_links' link_vectors, joint_angles+1, joint_axes); 21 1 = threeb_update_links[1, link_set)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started