how to plot two robots together

32 次查看(过去 30 天)
israel freitas
israel freitas 2021-8-19
回答: Simar 2024-5-15
I have mdl_puma 560 as a robotic arm, and mdl_p8 as a base,in Matlab, I'm not able to plot both in a single graph. and if you could help me, how do I use the reference of the base world to put on the arm, so wherever the base goes, understand that the arm is going together? I've already read peter corke's book, and I haven't been able to get to that if you can help, i'm immensely grateful

回答(1 个)

Simar
Simar 2024-5-15
此 个回答 已被 Aneimo 标记
Hi Israel,
I understand that you want to integrate Puma 560 robotic arm model with base (mdl_p8) in MATLAB, using Robotics Toolbox and facing difficulty with plotting them together.Here is a streamlined approach to achieve this integration and plot both models in a single graph, ensuring the robotic arm moves with the base.
1.Initialize Both Models:
Ensure to have initialized both the Puma 560 robotic arm and the base models in MATLAB. This typically involves running the model scripts provided by the Robotics Toolbox:
% Initialize Puma 560 model
mdl_puma560
% Initialize mobile base model (assuming mdl_p8 is the script for your base)
mdl_p8
2. Define the Transformation:
Make the arm follow the base, by defining a transformation that represents arm's position and orientation relative to the base. This transformation is a homogeneous transformation matrix that defines how to translate and rotate the arm's base frame to align it with the base's coordinate frame. If base model does not provide a specific function or method to retrieve its current pose (position and orientation) in the world frame, manually keep track of this information based on how you move or control the base within simulation.
3.Apply the Transformation
Whenever updating position of base, apply transformation to the arm's base frame to ensure the arm moves with the base. This involves multiplying the arm's base frame by the transformation matrix that represents the base's pose. In MATLAB, assuming you have a transformation matrix T_base representing the base's pose, update the arm's pose relative to the base as mentioned below:
% Example transformation matrix for the base
T_base = transl(1, 2, 0) * trotz(pi/4); % Just an example, replace with actual base pose
% Update the Puma 560 base transform (assuming p560 is your Puma 560 robot object)
p560.base = T_base;
4. Plotting Together
To plot both the base and the arm in single graph, ensure to plot base first and then the arm. Use hold on command in MATLAB to keep base plot and overlay the arm plot on top of it.
% Plot the base (this will depend on how mdl_p8 can be visualized, assuming it is a plot function)
plot_base(); % This is a placeholder; replace with actual function to plot your base
hold on; % Keep the base plot
% Now plot the Puma 560 arm with its updated base transformation
p560.plot(q); % Replace 'q' with the desired joint configuration of the Puma 560
hold off; % Release the plot
5. Updating the Pose
When moving the base, update T_base accordingly to reflect the new pose, and then update the arm's base frame (p560.base) before re-plotting. This ensures that the arm's position and orientation are always correctly referenced to the base's world frame.
This approach requires understanding of homogeneous transformation matrices and how they are used to represent spatial relationships in robotics.
Please refer to the following documentation links-
Hope it helps!
Best Regards,
Simar

类别

Help CenterFile Exchange 中查找有关 Robotics 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by