Manta object changes position, wheels don't (remote api Matlab)

Typically: "How do I... ", "How can I... " questions
Posts: 6
Joined: 08 Jul 2017, 16:22

Manta object changes position, wheels don't (remote api Matlab)

Postby R2D2 » 14 Jul 2017, 19:34

Hello! I try to carry out a simulation with 3 Manta vehicles with data from Matlab. Specifically, for each time instant I specify the position of the vehicles with the command vrep.simxSetObjectPosition, and run the simulation for one time step. Then I pause the simulation and do the same. As it seems the vehicles' bodies do change position as requested, but their wheels don't! They stick to their initial position! Note that when I get the object handle, I do get the whole object ('Manta', 'Manta#0', 'Manta#1'). The script is given below. I need some help, please! Cheers!

Code: Select all

    disp('Program started');
    close all
    clear all
    vrep=remApi('remoteApi'); % using the prototype file (remoteApiProto.m)
    vrep.simxFinish(-1); % just in case, close all opened connections
    vrep.simxPauseSimulation(clientID, vrep.simx_opmode_oneshot);
    if (clientID>-1)   
        disp('Connected to remote API server');
        [returnCode,agent(1)]=vrep.simxGetObjectHandle(clientID,'Manta', vrep.simx_opmode_oneshot_wait);
        [returnCode,agent(2)]=vrep.simxGetObjectHandle(clientID,'Manta#0', vrep.simx_opmode_blocking);
        [returnCode,agent(3)]=vrep.simxGetObjectHandle(clientID,'Manta#1', vrep.simx_opmode_blocking);
        for i=1:tspan(1,2)/0.05
            vrep.simxPauseSimulation(clientID, vrep.simx_opmode_oneshot);
            [minimum, j]= min(abs(t-instant));
            vrep.simxSetObjectPosition(clientID, agent(1), -1, [q(j, 1), q(j, 2), 0.1922]', vrep.simx_opmode_oneshot);
            vrep.simxSetObjectPosition(clientID, agent(2), -1, [q(j, 8), q(j, 9), 0.1922]', vrep.simx_opmode_oneshot);
            vrep.simxSetObjectPosition(clientID, agent(3), -1, [q(j, 15), q(j, 16), 0.1922]', vrep.simx_opmode_oneshot);

    disp('Program Ended');

Site Admin
Posts: 6058
Joined: 14 Dec 2012, 00:25

Re: Manta object changes position, wheels don't (remote api Matlab)

Postby coppelia » 16 Jul 2017, 20:16


those vehicle models are dynamically enabled. In that case, you should not try to artificially move the vehicle, but rather modify the torque/speed in the wheel joints in order to have the vehicle move. Make sure to read this topic too.


Return to “General questions”

Who is online

Users browsing this forum: Google [Bot] and 12 guests