creating robot via script: respondable mask and motor params

Typically: "How do I... ", "How can I... " questions
fferri
Posts: 87
Joined: 09 Sep 2013, 19:28

creating robot via script: respondable mask and motor params

Postby fferri » 13 Oct 2015, 13:54

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?

mgianni
Posts: 2
Joined: 13 Oct 2015, 14:01

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

Postby mgianni » 13 Oct 2015, 14:06

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)

ssj
Posts: 13
Joined: 27 Feb 2017, 15:40

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

Postby ssj » 14 Apr 2017, 12:31

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

ssj
Posts: 13
Joined: 27 Feb 2017, 15:40

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

Postby ssj » 14 Apr 2017, 12:37

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

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

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

Postby coppelia » 18 Apr 2017, 08:16

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

ssj
Posts: 13
Joined: 27 Feb 2017, 15:40

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

Postby ssj » 27 Apr 2017, 08:24

Thanks! It was really helpful.


Return to “General questions”

Who is online

Users browsing this forum: No registered users and 6 guests