Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/RMonica/Hybrid_HMD_Tracking_RS
09 October 2024, 07:19:50 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • 0abb08a
  • /
  • src
  • /
  • particle_filter.h
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:a4f717086cacbbe5d049e963f6b515db761e427c
origin badgedirectory badge
swh:1:dir:64641fa369e2f30e00c95980e9e55de9c491536e
origin badgerevision badge
swh:1:rev:0a8db14161db9bc4e579790279580a9bb68755bc
origin badgesnapshot badge
swh:1:snp:0203d2f7ea07552ec1a63af56f020f4b91fd3b0a

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 0a8db14161db9bc4e579790279580a9bb68755bc authored by RMonica on 08 October 2024, 13:23:12 UTC
Minor changes in scripts for compatibility.
Tip revision: 0a8db14
particle_filter.h
/*
 * Copyright 2022-2024 Riccardo Monica
 * 
 * This software is distributed under the 3-clause BSD license.
 * You should have received a copy of the 3-clause BSD license
 * along with this software. If not, see
 * <https://opensource.org/license/bsd-3-clause>
 */

#ifndef PARTICLE_FILTER_H
#define PARTICLE_FILTER_H

#include "tracking_library.h"
#include "tracking_commons.h"
#include "tracking_interface.h"

#include <stdint.h>
#include <cmath>
#include <iostream>
#include <memory>
#include <random>

#include <Eigen/Dense>
#include <Eigen/StdVector>

namespace Tracking
{

class ParticleFilter : public ITracking
{
  public:

  struct Particle
  {
    Eigen::Vector3f    position;
    Eigen::Quaternionf orientation;

    Particle(const Eigen::Vector3f & p, const Eigen::Quaternionf & o): position(p), orientation(o) {}
    Particle() {position = Eigen::Vector3f::Zero(); orientation = Eigen::Quaternionf::Identity(); }

    Eigen::Affine3f ToAffine3f() const;
    static Particle FromAffine3f(const Eigen::Affine3f & a);

    EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
  };
  typedef std::vector<Particle, Eigen::aligned_allocator<Particle> > ParticleVector;
  typedef std::vector<float> FloatVector;

  bool SetParameter(const int parameter_id, const float value) override
  {
    switch (parameter_id)
    {
      case PARAM_NUM_PARTICLES:
      case PARAM_SIGMA_ROT:
      case PARAM_SIGMA_TRANSL:
      case PARAM_PSIGMA_TRANSL:
      case PARAM_PSIGMA_ROT:
        return ITracking::SetParameter(parameter_id, value);
      default:
        return false;
    }
  }

  ParticleFilter();

  void Update(const Eigen::Affine3f & m_world_to_motive_mat,
              const Eigen::Affine3f & m_oculus_origin_to_oculus) override;

  void Reset() override;

  void Reset(const Eigen::Affine3f & initial_world_to_oculus,
             const Eigen::Affine3f & initial_oculus_origin_to_oculus) override;

  bool IsMotiveLost() const override
  {
    return is_motive_lost;
  }

  Eigen::Affine3f GetEstimatedOculus() const override
  {
    return oculus_mat;
  }

  int GetPositionStatus() const override
  {
    return position_state;
  }

  int GetRotationStatus() const override
  {
    return rotation_state;
  }

  EIGEN_MAKE_ALIGNED_OPERATOR_NEW;

  private:

  Eigen::Affine3f GetNoise(const float sigma_transl, const float sigma_rot);

  static Particle AverageParticles(const ParticleVector & particles, const FloatVector & weights = FloatVector());

  ParticleVector m_particles;

  Eigen::Affine3f oculus_mat = Eigen::Affine3f::Identity();

  Eigen::Affine3f prev_world_to_motive = Eigen::Affine3f::Identity();

  Eigen::Affine3f prev_oculus_origin_to_oculus = Eigen::Affine3f::Identity();

  bool is_motive_lost = false;

  int position_state = STATE_INIT;
  int rotation_state = STATE_INIT;

  std::minstd_rand m_random_generator;
};

}

#endif // PARTICLE_FILTER_H

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API