From: Jiri Vlasak Date: Fri, 26 Jul 2019 14:13:41 +0000 (+0200) Subject: Add method for setting sampling info X-Git-Tag: v0.1.0~3^2~6 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hubacji1/rrts.git/commitdiff_plain/ccb9e73cd9bed82838fcf2e398fb0de54d1cae76 Add method for setting sampling info --- diff --git a/api/rrts.h b/api/rrts.h index b188586..2e7f53d 100644 --- a/api/rrts.h +++ b/api/rrts.h @@ -64,6 +64,23 @@ class RRTS { /*! \brief Run next RRT* iteration. */ bool next(); + /*! \brief Set sampling info. + + There is normal distribution sampling for `x`, `y`, and + `h` parameters of RRT node. + + \param mx Mean x value. + \param dx Standard deviation of x. + \param my Mean y value. + \param dy Standard deviation of y. + \param mh Mean h value. + \param dh Standard deviation of h. + */ + void set_sample( + double mx, double dx, + double my, double dy, + double mh, double dh + ); // getters, setters std::vector &goals() { return this->goals_; } diff --git a/src/rrts.cc b/src/rrts.cc index d5faf1f..3968da4 100644 --- a/src/rrts.cc +++ b/src/rrts.cc @@ -135,6 +135,17 @@ bool RRTS::next() return next; } +void RRTS::set_sample( + double mx, double dx, + double my, double dy, + double mh, double dh +) +{ + this->ndx_ = std::normal_distribution(mx, dx); + this->ndy_ = std::normal_distribution(my, dy); + this->ndh_ = std::normal_distribution(mh, dh); +} + RRTS::RRTS() : gen_(std::random_device{}()) {