Page 1 of 1

simOMPL.createStateSpace()

Posted: 14 Sep 2018, 15:20
by Jas
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.

,

Re: simOMPL.createStateSpace()

Posted: 21 Sep 2018, 11:01
by fferri
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.

Re: simOMPL.createStateSpace()

Posted: 24 Sep 2018, 05:14
by Jas
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 task=simOMPL.createTask('task')
simOMPL.setAlgorithm(task,simOMPL.Algorithm.RRTConnect)
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)
simOMPL.setStateSpace(task,{j1_space,j2_space,j3_space,j4_space,j5_space,j6_space,j7_space})
simOMPL.setCollisionPairs(task,collisionPairs)
simOMPL.setStartState(task,startConfig)
simOMPL.setGoalState(task,goalConfigs[1])

Re: simOMPL.createStateSpace()

Posted: 12 May 2020, 12:52
by Sep
Hi, was wondering if you could find an answer for your question? I have the same question. Thanks

Re: simOMPL.createStateSpace()

Posted: 12 May 2020, 13:08
by Sep
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?

Re: simOMPL.createStateSpace()

Posted: 12 May 2020, 13:25
by fferri
You can read more about state space projections here.

Re: simOMPL.createStateSpace()

Posted: 14 May 2020, 17:43
by Sep
fferri wrote: 12 May 2020, 13:25 You can read more about state space projections here.
Thanks for your message, I have read that url from OMPL along with many others but what they have provided is simply a 2D projection. In my case, I am using OMPL for my 6dof serial robot (kind of similar to Vrep example) but even in Vrep, the projection is not clear so I am not sure how they are using the projection function to generate the path using SBL. As I understood in Vrep, they are only using j1,j2 and j3 for the projection and not the wrist of the robot.

Re: simOMPL.createStateSpace()

Posted: 14 May 2020, 23:02
by fferri
That is exactly the point: the projection is a lower dimensional space (usually 2d or 3d) because higher dimensions would be unfeasible.

How the projection is used it depends on the planning algorithm. It may be used to estimate coverage and/or to guide exploration of state space, or something else.

With the OMPL plugin you can currently indicate wether a state space component takes place in computing the euclidean projection or not. You have to chose which state space components fit best for your problem.