## simOMPL.createStateSpace()

Typically: "How do I... ", "How can I... " questions
Jas
Posts: 6
Joined: 11 Sep 2018, 08:20

### simOMPL.createStateSpace()

dear all
Sorry for this question but I could not find the meaning of
local j3_space=simOMPL.createStateSpace('j3_space',simOMPL.StateSpaceType.joint_position,jh[3],{-170*math.pi/180},{170*math.pi/180},3)
particularly the the last index 3. In OMPL plugin the function simOMPL.createStateSpace(), it states that 3 stands foruse ForProjection (int): if true, this object position or joint value will be used for computing a default projection.

,

fferri
Posts: 628
Joined: 09 Sep 2013, 19:28

### Re: simOMPL.createStateSpace()

The synopsis for the simOMPL.createStateSpace function is:

Code: Select all

int stateSpaceHandle=simOMPL.createStateSpace(
string name,
int type,
int objectHandle,
table boundsLow,
table boundsHigh,
int useForProjection,
float weight=1.0,
int refObjectHandle=-1
)
Where parameters mean:
name (string): a name for this state space
type (int): type of this state space component (see simOMPL.StateSpaceType)
objectHandle (int): the object handle (a joint object if type is simOMPL.StateSpaceType.joint_position, otherwise a shape)
boundsLow (table of float): lower bounds (if type is pose, specify only the 3 position components)
boundsHigh (table of float): upper bounds (if type is pose, specify only the 3 position components)
useForProjection (int): if true, this object position or joint value will be used for computing a default projection
weight (float, default: 1.0): (optional) the weight of this state space component, used for computing distance between states. Default value is 1.0
refObjectHandle (int, default: -1): (optional) an object handle relative to which reference frame position/orientations will be evaluated. Default value is -1, for the absolute reference frame
The parameter you are referring to (useForProjection) is a boolean.

I don't know where you find this usage where a value of 3 is passed to it, but it doesn't make sense.

Jas
Posts: 6
Joined: 11 Sep 2018, 08:20

### Re: simOMPL.createStateSpace()

Hi fferi
Thanks a lot for your reply. I have taken it from demo on motionPlanninDemo1.ttt

findPath=function(startConfig,goalConfigs,cnt)
-- Here we do path planning between the specified start and goal configurations. We run the search cnt times,
-- and return the shortest path, and its length
local j1_space=simOMPL.createStateSpace('j1_space',simOMPL.StateSpaceType.joint_position,jh[1],{-170*math.pi/180},{170*math.pi/180},1)
local j2_space=simOMPL.createStateSpace('j2_space',simOMPL.StateSpaceType.joint_position,jh[2],{-120*math.pi/180},{120*math.pi/180},2)
local j3_space=simOMPL.createStateSpace('j3_space',simOMPL.StateSpaceType.joint_position,jh[3],{-170*math.pi/180},{170*math.pi/180},3)
local j4_space=simOMPL.createStateSpace('j4_space',simOMPL.StateSpaceType.joint_position,jh[4],{-120*math.pi/180},{120*math.pi/180},0)
local j5_space=simOMPL.createStateSpace('j5_space',simOMPL.StateSpaceType.joint_position,jh[5],{-170*math.pi/180},{170*math.pi/180},0)
local j6_space=simOMPL.createStateSpace('j6_space',simOMPL.StateSpaceType.joint_position,jh[6],{-120*math.pi/180},{120*math.pi/180},0)
local j7_space=simOMPL.createStateSpace('j7_space',simOMPL.StateSpaceType.joint_position,jh[7],{-170*math.pi/180},{170*math.pi/180},0)

Sep
Posts: 3
Joined: 11 May 2020, 20:51

### Re: simOMPL.createStateSpace()

Hi, was wondering if you could find an answer for your question? I have the same question. Thanks

Sep
Posts: 3
Joined: 11 May 2020, 20:51

### Re: simOMPL.createStateSpace()

btw, when I looked at the source code, it seems that if the variable is greater than zero, it is considered True! so in this case, j1, j2 and j3 are considered for projection. However, my second question is about the projection it self! How does it work and what does it mean?

fferri
Posts: 628
Joined: 09 Sep 2013, 19:28

### Re: simOMPL.createStateSpace()

Sep
Posts: 3
Joined: 11 May 2020, 20:51

### Re: simOMPL.createStateSpace()

fferri wrote:
12 May 2020, 13:25