how can I control a two arms' robot separately with the urdf

6 visualizzazioni (ultimi 30 giorni)
I am going to analyse the workspace of two arms' robot.When importing the urdf, the 12 joints are all connected,how to separate them into two 6 joints , cause the jacob is necessary for me, or are there someother methods to abtain the workspace range.

Risposta accettata

akshatsood
akshatsood il 18 Set 2024
Modificato: akshatsood il 18 Set 2024
Hi @h,
As I can understand, you want to analyse worksp[ace of two arm's robot. The robot initially appears as a single entity with 12 joints, but for analysis, it is necessary to separate it into two distinct arms, each with 6 joints. This separation is crucial for calculating the Jacobian matrix for each arm. Please find the steps outlined below for achieving the same
  • Import the Robot Model - I have used "kukaIiwa14" robot model for my use case.
  • Identification and Seperation of Arms - determining which joints and bodies belong to each arm requires an understanding of the robot's structure and how the bodies are linked.
  • Create seperate models for each arm - leveraging the "rigidBodyTree" method to create sperate models for each arm identified in the previous step ensuring each arm's model includes the correct bodies and joints.
  • Visualize Each Arm - visualize the two arms to confirm the intended seperation.
  • Compute Jacobian - calculate the Jacobian Matrix for each arm using the "geometricJacobian" function for analyzing the kinematic properties of each arm,
  • Workspace Analysis - computing the forward kinematics for each arm to determine the end effector's pose.
Please refer to the code below in junction with the approach discussed above
robot = loadrobot('kukaIiwa14', 'DataFormat', 'column');
figure;
show(robot);
title('Complete Robot Visualization');
% For demonstration purposes, consider the first 4 bodies as "arm1" and the last 3 as "arm2".
arm1Bodies = robot.BodyNames(2:5);
arm2Bodies = robot.BodyNames(5:end);
% Create a new rigidBodyTree for arm 1
arm1 = rigidBodyTree;
for i = 1:length(arm1Bodies)
body = getBody(robot, arm1Bodies{i});
if i == 1
addBody(arm1, body, 'base'); % Add the first body to the base
else
addBody(arm1, body, body.Parent.Name); % Add subsequent bodies to their parent
end
end
% Create a new rigidBodyTree for arm 2
arm2 = rigidBodyTree;
for i = 1:length(arm2Bodies)
body = getBody(robot, arm2Bodies{i});
if i == 1
addBody(arm2, body, 'base'); % Add the first body to the base
else
addBody(arm2, body, body.Parent.Name); % Add subsequent bodies to their parent
end
end
figure;
show(arm1);
title('Visualization of Arm 1');
figure;
show(arm2);
title('Visualization of Arm 2');
% Compute the Jacobian for each arm
configArm1 = homeConfiguration(arm1);
configArm2 = homeConfiguration(arm2);
jacobianArm1 = geometricJacobian(arm1, configArm1, arm1.BodyNames{end});
jacobianArm2 = geometricJacobian(arm2, configArm2, arm2.BodyNames{end});
disp('Jacobian for Arm 1:');
disp(jacobianArm1);
disp('Jacobian for Arm 2:');
disp(jacobianArm2);
% Analyze the workspace by computing forward kinematics
endEffectorPoseArm1 = getTransform(arm1, configArm1, arm1.BodyNames{end});
endEffectorPoseArm2 = getTransform(arm2, configArm2, arm2.BodyNames{end});
disp('End-Effector Pose for Arm 1:');
disp(endEffectorPoseArm1);
disp('End-Effector Pose for Arm 2:');
disp(endEffectorPoseArm2);
Please note that this is an initial attempt to address your question. To apply it to your specific use case, please review the approach and make any necessary modifications according to your robot model.
I hope this helps.
  1 Commento
h
h il 18 Set 2024
Thanks! ! But there still are some problems I cant settle,hope you can help me .The urdf is kinda like the picture below ,two arms are seperate,but when import urdf, them become a 12 joints,no more 6 joints,,and I need the base there,based on the base's rotation and position to solve the jacobian and get the flexible workspaces show in point cloud map.
When showing them in two figures, the base coordinate is no more on the base but the robot's base,which is against to what I wanna get.Hope you can give some suggestions to me.Thanks a lot!!

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by