Problem with set the orientation and postion using MATLAB API
Posted: 30 Jan 2019, 19:47
%Set initial orientation and position
for idx1=1:num_kilobots
if idx1 == 1
vrep.simxSetObjectPosition(clientID,kilohandles(num_kilobots),-1,[-0.5,0.17,0],vrep.simx_opmode_oneshot);
%vrep.simxSetObjectOrientation(clientID,kilohandles(num_kilobots),-1, [0 0 90],vrep.simx_opmode_oneshot);
pause(5)
[returnCode,position1] = vrep.simxGetObjectPosition(clientID,kilohandles(num_kilobots),-1,vrep.simx_opmode_buffer);
[returnCode,orientation1] = vrep.simxGetObjectOrientation(clientID,kilohandles(num_kilobots),-1,vrep.simx_opmode_buffer);
disp(position1)
disp(orientation1)
end
end
START = 1;
while (START == 1)
%Turn on the joints
vrep.simxSetJointTargetVelocity(clientID,left_Motor,2,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity(clientID,right_Motor,2,vrep.simx_opmode_blocking);
START=0;
end
I would like to know to make the program run perfectly because when I set the position and orientation to the robot and after it tries to move, but it's not possible, actually, it moves, but not the correct way.
for idx1=1:num_kilobots
if idx1 == 1
vrep.simxSetObjectPosition(clientID,kilohandles(num_kilobots),-1,[-0.5,0.17,0],vrep.simx_opmode_oneshot);
%vrep.simxSetObjectOrientation(clientID,kilohandles(num_kilobots),-1, [0 0 90],vrep.simx_opmode_oneshot);
pause(5)
[returnCode,position1] = vrep.simxGetObjectPosition(clientID,kilohandles(num_kilobots),-1,vrep.simx_opmode_buffer);
[returnCode,orientation1] = vrep.simxGetObjectOrientation(clientID,kilohandles(num_kilobots),-1,vrep.simx_opmode_buffer);
disp(position1)
disp(orientation1)
end
end
START = 1;
while (START == 1)
%Turn on the joints
vrep.simxSetJointTargetVelocity(clientID,left_Motor,2,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity(clientID,right_Motor,2,vrep.simx_opmode_blocking);
START=0;
end
I would like to know to make the program run perfectly because when I set the position and orientation to the robot and after it tries to move, but it's not possible, actually, it moves, but not the correct way.