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-
- Robotics Toolbox- https://www.mathworks.com/help/robotics/index.html?searchHighlight=robotics%20toolbox&s_tid=srchtitle_support_results_1_robotics%2520toolbox
- Hold on- https://www.mathworks.com/help/matlab/ref/hold.html?searchHighlight=hold%20on&s_tid=srchtitle_support_results_1_hold%20on#d126e714852
Hope it helps!
Best Regards,
Simar