How can I change the view to be in front or left or up, in the following mathematica…
- User
How can I change the view to be in front or left or up, in the following mathematica code: ShowRobot[jointValues_List,linkColors_List:Automatic]:=Module[{jointVarSubstitutions,A0iallNum,oiRF0Num,RobotPlot,axesColors,axesLabels,length,frameAxes,NumberOfLinks},(Create substitutions for the joint variables) jointVarSubstitutions={q1->jointValues[[1]],q2->jointValues[[2]],q3->jointValues[[3]],q4->jointValues[[4]],q5->jointValues[[5]],q6->jointValues[[6]]}; (Substitute parameters and joint values) A0iallNum=A0iall/. params/. jointVarSubstitutions; oiRF0Num=oiRF0/. params/. jointVarSubstitutions; (Determine number of links) NumberOfLinks=Length[oiRF0Num]-1; (Set default link colors if none provided) If[linkColors===Automatic,linkColors=Table[ColorData["Rainbow"][i/(NumberOfLinks-1)],{i,0,NumberOfLinks-1}];]; (Generate the robot plot with colored cylinders) RobotPlot=Graphics3D[Table[{linkColors[[i]],Cylinder[{oiRF0Num[[i]],oiRF0Num[[i+1]]},0.015] (Adjust radius)},{i,1,NumberOfLinks}],Axes->True,BoxRatios->Automatic,PlotRange->All]; (Define colors and labels for axes) axesColors={Red,Green,Blue}; axesLabels={"X","Y","Z"}; (*Length of the coordinate axes arrows) length=0.35; (Generate the coordinate frames for each joint) frameAxes=Table[Module[{origin=oiRF0Num[[i]],R0i=A0iallNum[[i]][[1;;3,1;;3]],(Rotation matrix) arrows},arrows=Table[{axesColors[[j]],Arrow[{origin,origin+length R0i[[All,j]]}],Text[Style[axesLabels[[j]]<>ToString[i-1],FontSize->12,Bold],origin+length R0i[[All,j]]+0.05]},{j,1,3}]; Graphics3D[arrows]],{i,1,Length[oiRF0Num]}]; (Display the robot plot with all joint frames) Show[{RobotPlot,frameAxes},PlotRange->Full]] (PlotRange->{{-2,+2},{-2,+2},{0,+2.5}})
- Assistant