Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Draw a set of 3D links (as generated by threeD_robot_arm_links) into an axis (as generated by 'create_axes'). Note that this function does not need directly
Draw a set of 3D links (as generated by threeD_robot_arm_links") into an axis (as generated by 'create_axes'). Note that this function does not need directly to call any of your previously-written functions. Function e Reset H MATLAB Documentation 1 function 1 = threeD_draw_links(link_set, link_colors, ax) 2 % Draw a set of lines for a link structure into a specified axis 3 % 4 Inputs: 5 % link_set: A 1xn cell array, each entry of which is a matrix whose 7 columns are the endpoints of the lines describing one link of the 8 % system (as constructed by build_links with threeD input) link_colors: 1xn cell array. Each entry can be either a standard matlab 10 % color string le.g., 'k' or 'T') or a 1x3 vector of the RGB values a for the color (range from 8 to 1) 12 % ax: The handle to an axis in which to plot the links 13 S 14 Output: 15 Ss 16 % 1: A cell array of the same size as link_set, in which each entry is a 17 % handle to a line structure for that link 11 SS 18 19 20 21 Start by creating an empty cell array of the same size as link_set, S named 'l' 22 23 24 25 26 Draw a line for each link, with circles at the endpoints, and save the handle for this line in the corresponding element of 'l' * Start by creating an empty cell array of the same size as link_set, named 'l' 20 21 22 23 24 25 26 27 Draw a line for each link, with circles at the endpoints, and save the handle for this line in the corresponding element of 'l' 1 = cell(sizelink_set)); 29 S Draw a surface for each link, and save the handle for this line in 30 & the corresponding element of 'l'. Note that you want the 'surface 31 % command and not 'surf', because the 'surf' command resets the plot. 32 $ The color of the surface can be set using the 'FaceColor' attribute; 33 % be sure to set the 'Parent' of the surface as 'ax' 34 link set B5 for idx = 1: numel(link_set) 36 X = link_set{idx); 37 l{idx} = surface(X{1}, X{2}, X{3), 'Parent', ax, 'FaceColor', link_colors{idx)); 38 end 39 40 41 end Code to call your function e Reset 1 link_vectors = {(1;0;0), 10;1;0), (1; 0;1] }; 2 joint_angles = [pi/4; -pi/2;1); 3 joint_axes = {'x';'y';'z'}; 4 link_set = threel_robot_arm_links( link_vectors, joint_angles, joint_axes); 5 ax = create_axes (317); 7 link_colors = {'r, 10.5 0.5 0.5), 'k'}; 8 91 = threeD_draw_links{link_set, link_colors, ax)
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