Program Listing for File CRejectionSamplingRangeOnlyLocalization.h

↰ Return to documentation for file (include/mrpt/slam/CRejectionSamplingRangeOnlyLocalization.h)

/*                    _
                     | |    Mobile Robot Programming Toolkit (MRPT)
 _ __ ___  _ __ _ __ | |_
| '_ ` _ \| '__| '_ \| __|          https://www.mrpt.org/
| | | | | | |  | |_) | |_
|_| |_| |_|_|  | .__/ \__|     https://github.com/MRPT/mrpt/
               | |
               |_|

 Copyright (c) 2005-2026, Individual contributors, see AUTHORS file
 See: https://www.mrpt.org/Authors - All rights reserved.
 SPDX-License-Identifier: BSD-3-Clause
*/
#pragma once

#include <mrpt/bayes/CRejectionSamplingCapable.h>
#include <mrpt/obs/obs_frwds.h>
#include <mrpt/poses/CPoint2D.h>
#include <mrpt/poses/CPoint3D.h>
#include <mrpt/poses/CPose2D.h>

namespace mrpt
{
namespace maps
{
class CLandmarksMap;
}

namespace slam
{
class CRejectionSamplingRangeOnlyLocalization :
    public bayes::CRejectionSamplingCapable<mrpt::poses::CPose2D>
{
 public:
  CRejectionSamplingRangeOnlyLocalization();

  ~CRejectionSamplingRangeOnlyLocalization() override = default;
  bool setParams(
      const mrpt::maps::CLandmarksMap& beaconsMap,
      const mrpt::obs::CObservationBeaconRanges& observation,
      float sigmaRanges,
      const mrpt::poses::CPose2D& oldPose,
      float robot_z = 0,
      bool autoCheckAngleRanges = true);

 protected:
  void RS_drawFromProposal(mrpt::poses::CPose2D& outSample) override;

  double RS_observationLikelihood(const mrpt::poses::CPose2D& x) override;

  float m_z_robot{0};

  float m_sigmaRanges{0.10f};
  mrpt::poses::CPose2D m_oldPose;

  size_t m_drawIndex{0};

  struct TDataPerBeacon
  {
    TDataPerBeacon() = default;

    mrpt::math::TPoint3D sensorOnRobot;
    mrpt::math::TPoint2D beaconPosition;
    float radiusAtRobotPlane{0};
    float minAngle{0}, maxAngle{0};
  };

  std::deque<TDataPerBeacon> m_dataPerBeacon;
};

}  // namespace slam
}  // namespace mrpt