simOMPL.createStateSpace()

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

simOMPL.createStateSpace()

Post by Jas » 14 Sep 2018, 15:20

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: 219
Joined: 09 Sep 2013, 19:28

Re: simOMPL.createStateSpace()

Post by fferri » 21 Sep 2018, 11:01

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: 5
Joined: 11 Sep 2018, 08:20

Re: simOMPL.createStateSpace()

Post by Jas » 24 Sep 2018, 05:14

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])

Post Reply