OMPL官方教程学习Using existing samplers and creating new ones

Available State Samplers

  1. 有两种不同类型的采样器:
    1. StateSampler (不考虑状态的有效性?不管障碍物都进行采样?)
    2. ValidStateSampler (考虑状态的有效性,考虑非障碍物区域么?)
    3. 两种采样器都具有三种采样方式:均匀、在一个状态周围进行采样(?)、高斯分布。
    4. ValidStateSampler 使用StateSampler 作为底层实现
    5. ValidStateSampler 使用StateSampler 的方法进行采样,直到碰见无效点或者迭代结束
    6. 采样有效性的衡量是通过SpaceInformation::isValid方法定义的

There are two different kinds of samplers that sound similar, but have different roles: state space samplers (ompl::base::StateSampler) and valid state samplers (ompl::base::ValidStateSampler). For each type of state space there needs to exist a corresponding derived ompl::base::StateSampler class that allows one to generate uniform samples from that state space, generate states near another state from that state space and generate states using a Gaussian distribution. The valid state samplers use the state space samplers as a low level primitive. Typically, they generate a number of state samples using the appropriate state space sampler until a valid state is found or a maximum number of iterations is exceeded. The validity of a state is determined through the ompl::base::SpaceInformation::isValid method.

已经定义好的几个ValidStateSampler

  1. ompl::base::UniformValidStateSampler : 均匀采样吧

  2. ompl::base::ObstacleBasedValidStateSampler:有点类似二分法

    This sampler tries to first find one invalid sample and one valid sample. Next, it interpolates states incrementally from the valid to the invalid state. It returns the last state that is valid before reaching an invalid state. The idea is that samples near obstacles improve the chance of finding samples in narrow passages. Finding such samples is often the crucial problem in solving motion planning queries.

  3. ompl::base::GaussianValidStateSampler: 先按均匀分布生成一个点,然后以这个点为中心进行一次高斯采样,如果第一个点有效而第二个点无效则,第一个点是采样点。否则重新采样

  4. ompl::base::MaximizeClearanceValidStateSampler :以Clearance最大进行采样?

    This sampler behaves a lot like ompl::base::UniformValidStateSampler but once it finds a valid state, it attempts to find additional valid states with higher clearance. The reported sample is the one with highest clearance.

1. Using an Existing Sampler

  1. 需要我们自己定义一个ValidStateSamplerAllocator 实现相同的功能
  2. 实现的功能:输入SpaceInformation 输出 ValidStateSamplerPtr

We cannot set the type of sampler directly in the SimpleSetup or SpaceInformation classes, because each thread needs it own copy of a sampler. Instead, we need to define a ompl::base::ValidStateSamplerAllocator, a function that, given a pointer to an ompl::base::SpaceInformation, returns ompl::base::ValidStateSamplerPtr. This function can also configure the valid state sampler according to the specific space information before returning it.

官方给的代码示例从中可以看出:

  1. 我们需要定义一个函数,其输入是SpaceInformation 输出是 ValidStateSamplerPtr
  2. 函数叫什么名字无关紧要。
  3. ValidStateSamplerPtr 是所有基于Valid采样的父类,而使用过程多是用ValidStateSamplerPtr 这样更加统一(跟之前的状态空间类似)
namespace ob 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值