11 std::vector<Eigen::Vector3d>
discretizePositions(
const Eigen::Vector3d& start,
const Eigen::Vector3d& stop,
const double ds)
13 auto dist = (stop - start).norm();
15 size_t n_intermediate_points = 0;
18 n_intermediate_points =
static_cast<size_t>(std::lround(dist / ds));
21 const auto total_points = 2 + n_intermediate_points;
23 std::vector<Eigen::Vector3d> result;
24 result.reserve(total_points);
26 for (std::size_t i = 0; i < total_points; ++i)
28 const double r = i /
static_cast<double>(total_points - 1);
29 Eigen::Vector3d point = start + (stop - start) * r;
30 result.push_back(point);
35 Eigen::Affine3d
makePose(
const Eigen::Vector3d& position,
const Eigen::Matrix3d& orientation,
36 const double z_axis_angle)
38 Eigen::Affine3d m = Eigen::Affine3d::Identity();
39 m.matrix().block<3,3>(0,0) = orientation;
40 m.matrix().col(3).head<3>() = position;
42 Eigen::AngleAxisd z_rot (z_axis_angle, Eigen::Vector3d::UnitZ());
47 Eigen::Affine3d
makePose(
const Eigen::Vector3d& position,
const Eigen::Matrix3d& orientation)
49 Eigen::Affine3d m = Eigen::Affine3d::Identity();
50 m.matrix().block<3,3>(0,0) = orientation;
51 m.matrix().col(3).head<3>() = position;
58 std::random_device rd;
59 std::mt19937 gen(rd());
63 std::uniform_int_distribution<int> int_distr(lower, upper);
64 return int_distr(gen);
74 std::random_device rd;
75 std::mt19937 gen(rd());
79 std::uniform_real_distribution<double> double_distr(lower, upper);
80 return double_distr(gen);
98 Eigen::Matrix3d orientation_sample = cap_rung.
orientations_[0][o_sample];
105 assert(cap_rung.
path_pts_[0].size() > 0);
107 std::vector<Eigen::Affine3d> poses;
108 poses.reserve(cap_rung.
path_pts_[0].size());
109 for(
const auto& pt : cap_rung.
path_pts_[0])
111 poses.push_back(
makePose(pt, orientation_sample, x_axis_sample));
135 std::vector<std::vector<Eigen::Affine3d>> poses(cap_rung.
path_pts_.size());
138 for(
int i=0; i<cap_rung.
path_pts_.size(); i++)
146 poses[i].reserve(cap_rung.
path_pts_[0].size());
148 for(
const auto &pt : cap_rung.
path_pts_[i])
150 poses[i].push_back(
makePose(pt, orient));
std::vector< Eigen::Vector3d > discretizePositions(const Eigen::Vector3d &start, const Eigen::Vector3d &stop, const double ds)
std::vector< std::vector< Eigen::Matrix3d > > orientations_
std::vector< std::vector< Eigen::Affine3d > > generateSamplePickNPlace(const descartes_planner::CapRung &cap_rung, descartes_planner::CapVert &cap_vert)
std::vector< std::vector< Eigen::Vector3d > > path_pts_
std::vector< int > sub_segment_ids_
std::vector< Eigen::Matrix3d > orientation_
int randomSampleInt(int lower, int upper)
Eigen::Affine3d makePose(const Eigen::Vector3d &position, const Eigen::Matrix3d &orientation, const double z_axis_angle)
std::vector< Eigen::Affine3d > generateSample(const descartes_planner::CapRung &cap_rung, descartes_planner::CapVert &cap_vert)
double randomSampleDouble(double lower, double upper)