Page 1 of 1

creating robot via script: respondable mask and motor params

Posted: 13 Oct 2015, 13:54
by fferri
I want to create my mobile robot (an articulated tracked robot) via script.
The motivation behind this is to avoid repeated operations, for example if I want to change the number of rollers, or change a property common to all rollers, and stuff like this.

I managed to create a kinematic chain of objects and joints, with a script like this:

Code: Select all

if (sim_call_type==sim_childscriptcall_initialization) then

	this=simGetObjectAssociatedWithScript(sim_handle_self)
	visible_edges=2
	respondable=8
	static=16
	box=simCreatePureShape(0,visible_edges+respondable,{1.2,0.4,0.4},0.6)
	simSetObjectName(box,'object1')

	hybrid=1
	joint=simCreateJoint(sim_joint_revolute_subtype,sim_jointmode_force,0,{0.2,0.45})
	simSetObjectName(joint,'joint1')

	cylinder=simCreatePureShape(2,visible_edges+respondable,{0.6,0.6,0.4},0.6)
	simSetObjectName(cylinder,'object2')

	simSetObjectParent(box,this,false)
	simSetObjectParent(joint,box,false)
	simSetObjectParent(cylinder,joint,false)

	simSetObjectPosition(cylinder,joint,{0,0,0.41})
end
However I''ve been unable to find some essential functions:

1) how to programmatically change the respondable mask?

2) how to programmatically enable the motor on the joint?

Re: creating robot via script: respondable mask and motor pa

Posted: 13 Oct 2015, 14:06
by mgianni
A description of how to change properties of an object can be found here

http://www.coppeliarobotics.com/helpFil ... terIDs.htm

In particular,

enabling the motor:

Code: Select all

simSetObjectIntParameter(joint,2000,1)
changing the respondable mask:

Code: Select all

simSetObjectIntParameter(object,3019,mask)

Re: creating robot via script: respondable mask and motor params

Posted: 14 Apr 2017, 12:31
by ssj
hey i am new to vrep, dont know much. i am trying for a tracked vehicle robot but dont know to create a chainfor the whhels of my tracked vehicle robot. please help.

Thanks

Re: creating robot via script: respondable mask and motor params

Posted: 14 Apr 2017, 12:37
by ssj
detailed description is that i have made a robot base with four wheels and attached a laser scanner on its base. i want to control it with ROS for obstacle avoidance using scanner data. chain or track on wheels is left, with the above post i got an idea to use pure shape object and revolute joint for chain but still confused to create it. please help.

Thanks

Re: creating robot via script: respondable mask and motor params

Posted: 18 Apr 2017, 08:16
by coppelia
Hello,

for the tracked wheels (you mean caterpillars?), you should fake them, since this would otherwise take too much calculation time and also not be as realistic as you can hope for. Have a look at a real tracked vehicle: Models/vehicles/tracked vehicle.ttm. You will notice that it is slow, difficult to control, and its behaviour is not perfect.

On the other hand, you can visually fake a tracked vehicle. Take the example of the demo model Models/components/locomotion and propulsion/caterpillar.ttm. In that case, the underlying simulation model is simply a succession of cylinders to approximate the caterpillar.

Have also a look at this tutorial.

Cheers

Re: creating robot via script: respondable mask and motor params

Posted: 27 Apr 2017, 08:24
by ssj
Thanks! It was really helpful.