remotely move wheels K3

Typically: "How do I... ", "How can I... " questions
Post Reply
gabriel
Posts: 6
Joined: 27 Feb 2013, 15:08

remotely move wheels K3

Post by gabriel » 24 Mar 2013, 15:34

Hey,

I want to move the (left and right) wheels of the khepera III robot by using a python script.

Code: Select all

maxVel=math.pi * 2
leftWheel=vrep.simxGetObjectHandle("K3_leftWheelMotor", vrep.simx_opmode_oneshot_wait)
print leftWheel;
errorCode=vrep.simxSetJointTargetVelocity(leftWheel[1],maxVel,vrep.simx_opmode_oneshot_wait);
print errorCode; 
this prints out:
(0, 32)
0 (= no error)

There is no visible robot movement
The joints are in torque/force mode; motor control enabled; position control disabled

Also, unlike in the bubblerob tutorial, i cannot simply set the target velocity of the joints to 50 inside vrep to make the robot move.

(I test using a new scene with a fresh K3-robot, and delete the code in its script in the while-loop)

Thanks

coppelia
Site Admin
Posts: 7120
Joined: 14 Dec 2012, 00:25

Re: remotely move wheels K3

Post by coppelia » 25 Mar 2013, 10:08

Hello Gabriel,

Very probably your K3_leftWheelMotor is being driven by 2-3 controllers: your python script, and the Khepera's child script (attached to object K3_robot). The child scipt is actually communicating with a plugin (v_repExtK3.dll for instance), and the plugin is doing the actuation.

Try renaming the KheperaIII plugin to av_repExtK3 and restart V-REP (V-REP will load all plugins that start with v_repExt at start-up.)

Another option would be to make the KheperaIII robot invisible for the plugin. For that, remove all custom data that might be attached to any of the KheperaIII objects. Refer to this section (View / edit custom data). Refer also to the model Models/Other/custom data viewer.

The plugin reads the custom data of objects to identify the KheperaIII model (the identification doesn't happen via its name, since you can modify the names and the plugin will still recognize the Khepera model)

Cheers

gabriel
Posts: 6
Joined: 27 Feb 2013, 15:08

Re: remotely move wheels K3

Post by gabriel » 25 Mar 2013, 13:30

Excellent!

Renaming the v-repExtK3.dll plugin worked. The robot is now actuated by the remote python script.

Thanks.

bnewman
Posts: 7
Joined: 05 Jul 2013, 19:51

Re: remotely move wheels K3

Post by bnewman » 06 Jul 2013, 17:04

What is the equivalent file on OSX?

coppelia
Site Admin
Posts: 7120
Joined: 14 Dec 2012, 00:25

Re: remotely move wheels K3

Post by coppelia » 08 Jul 2013, 13:28

Hello,

the K3 plugin on OSX is located inside the vrep.app bundle: vrep.app/Contents/MacOS/libv_repExtK3.dylib

Cheers

bnewman
Posts: 7
Joined: 05 Jul 2013, 19:51

Re: remotely move wheels K3

Post by bnewman » 08 Jul 2013, 19:13

It worked, thank you.

Post Reply