In Gazebo environment, how to pick an item added by spawnModel() function

1 view (last 30 days)
1) Start a ROS-based simulator for a KINOVA Gen3 robot and configure the MATLAB connection with the robot simulator.
2) I add an objective (coke can) by using the spawnModel() function and setting its location (pose) itemLocationXYZ as:
can = GazeboModel('coke_can','gazeboDB');
itemLocationXYZ = [0.32 -0.3028 0.5];
spawnModel(gazebo, can, [itemLocationXY(1) itemLocationXY(2) itemLocationXY(3)]);
3) I input the item location itemLocationXYZ into the the coordinator, and execute the robot to grabe the can according to the feeded information (itemLocationXYZ). However, it seems like the inputed location (itemLocationXYZ) does not fit the coordinate system in the robot.
coordinator.Parts = {};
part.centerPoint = [itemLocationXYZ(1), itemLocationXYZ(2), itemLocationXYZ(3)];
coordinator.Parts{i} = part;
This can be shown as:
Seems I need a transformation between the input position and the end-effector:
% Specify the can's initial (current) pose and the desired final pose.
TCanInitial = trvec2tform([0.7, 0.0, 0.55]);
TCanFinal = trvec2tform([0.6, -0.5, 0.55]);
% Define the desired relative transform between the end-effector and the can when grasping.
TGraspToCan = trvec2tform([0,0,0.08])*eul2tform([pi/8,0,-pi]);
TGrasp = TCanInitial*TGraspToCan; % The desired end-effector pose when grasping the can
Whether this solve the problem? And, how can I know this information TGraspToCan?

Answers (0)

Community Treasure Hunt

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

Start Hunting!