ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccGBLSensor.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include <pybind11/native_enum.h>
9 #include <pybind11/pybind11.h>
10 
11 #include <ecvGBLSensor.h>
12 
13 #include "../casters.h"
14 
15 namespace py = pybind11;
16 using namespace pybind11::literals;
17 
18 void define_ccGBLSensor(py::module &m)
19 {
20  py::class_<ccGBLSensor, ccSensor> pyccGBLSensor(m, "ccGBLSensor");
21 
22  py::native_enum<ccGBLSensor::ROTATION_ORDER>(
23  pyccGBLSensor, "ROTATION_ORDER", "enum.Enum", "ccGBLSensor ROTATION_ORDER.")
24  .value("YAW_THEN_PITCH", ccGBLSensor::ROTATION_ORDER::YAW_THEN_PITCH)
25  .value("PITCH_THEN_YAW", ccGBLSensor::ROTATION_ORDER::PITCH_THEN_YAW)
26  .export_values()
27  .finalize();
28 
29  pyccGBLSensor
30  .def(py::init<ccGBLSensor::ROTATION_ORDER>(),
31  "rotOrder"_a = ccGBLSensor::ROTATION_ORDER::YAW_THEN_PITCH)
32  .def("computeAutoParameters", &ccGBLSensor::computeAutoParameters, "theCloud"_a)
33  .def_static("GetErrorString", &ccGBLSensor::GetErrorString, "errorCode"_a)
34  // setters and getters
35  .def("setPitchRange", &ccGBLSensor::setPitchRange, "minPhi"_a, "maxPhi"_a)
36  .def("getMinPitch", &ccGBLSensor::getMinPitch)
37  .def("getMaxPitch", &ccGBLSensor::getMaxPitch)
38  .def("setPitchStep", &ccGBLSensor::setPitchStep, "dPhi"_a)
39  .def("getPitchStep", &ccGBLSensor::getPitchStep)
40  .def("pitchIsShifted", &ccGBLSensor::pitchIsShifted)
41  .def("setYawRange", &ccGBLSensor::setYawRange, "minTheta"_a, "maxTheta"_a)
42  .def("getMinYaw", &ccGBLSensor::getMinYaw)
43  .def("getMaxYaw", &ccGBLSensor::getMaxYaw)
44  .def("setYawStep", &ccGBLSensor::setYawStep, "dTheta"_a)
45  .def("getYawStep", &ccGBLSensor::getYawStep)
46  .def("yawIsShifted", &ccGBLSensor::yawIsShifted)
47  .def("getSensorRange", &ccGBLSensor::getSensorRange)
48  .def("setSensorRange", &ccGBLSensor::setSensorRange, "range"_a)
49  .def("getUncertainty", &ccGBLSensor::getUncertainty)
50  .def("setUncertainty", &ccGBLSensor::setUncertainty, "u"_a)
51  .def("getRotationOrder", &ccGBLSensor::getRotationOrder)
52  .def("setRotationOrder", &ccGBLSensor::setRotationOrder, "rotOrder"_a)
53  // projection tools
54  .def(
55  "projectPoint",
56  [](const ccGBLSensor &self,
57  const CCVector3 &sourcePoint,
58  double posIndex = 0) -> py::tuple
59  {
60  CCVector2 destPoint;
61  PointCoordinateType depth;
62  self.projectPoint(sourcePoint, destPoint, depth, posIndex);
63  return py::make_tuple(destPoint, depth);
64  },
65  "sourcePoint"_a,
66  "posIndex"_a = 0);
67  // TODO projectNormals
68  // TODO projectColors
69 }
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
void define_ccGBLSensor(py::module &m)
Definition: ccGBLSensor.cpp:18
Ground-based Laser sensor.
Definition: ecvGBLSensor.h:26
void setRotationOrder(ROTATION_ORDER rotOrder)
Sets the sensor internal rotations order.
Definition: ecvGBLSensor.h:161
PointCoordinateType getMinPitch() const
Returns the minimal pitch limit (in radians)
Definition: ecvGBLSensor.h:94
PointCoordinateType getSensorRange() const
Returns the sensor max. range.
Definition: ecvGBLSensor.h:137
PointCoordinateType getMinYaw() const
Returns the minimal yaw limit (in radians)
Definition: ecvGBLSensor.h:119
void setYawRange(PointCoordinateType minTheta, PointCoordinateType maxTheta)
Sets the yaw scanning limits.
void setUncertainty(PointCoordinateType u)
Sets the Z-buffer uncertainty on depth values.
Definition: ecvGBLSensor.h:153
PointCoordinateType getUncertainty() const
Returns the Z-buffer uncertainty on depth values.
Definition: ecvGBLSensor.h:147
void setPitchRange(PointCoordinateType minPhi, PointCoordinateType maxPhi)
Sets the pitch scanning limits.
bool computeAutoParameters(cloudViewer::GenericCloud *theCloud)
Computes angular parameters automatically (all but the angular steps!)
static QString GetErrorString(int errorCode)
Returns the error string corresponding to an error code.
bool yawIsShifted() const
Definition: ecvGBLSensor.h:134
void setSensorRange(PointCoordinateType range)
Sets the sensor max. range.
Definition: ecvGBLSensor.h:142
PointCoordinateType getPitchStep() const
Returns the lateral pitch step (in radians)
Definition: ecvGBLSensor.h:105
PointCoordinateType getMaxYaw() const
Returns the maximal yaw limit (in radians)
Definition: ecvGBLSensor.h:122
void setYawStep(PointCoordinateType dTheta)
Sets the yaw step.
bool pitchIsShifted() const
Definition: ecvGBLSensor.h:109
ROTATION_ORDER getRotationOrder() const
Returns the sensor internal rotations order.
Definition: ecvGBLSensor.h:156
PointCoordinateType getMaxPitch() const
Returns the maximal pitch limit (in radians)
Definition: ecvGBLSensor.h:97
PointCoordinateType getYawStep() const
Returns the yaw step (in radians)
Definition: ecvGBLSensor.h:130
void setPitchStep(PointCoordinateType dPhi)
Sets the pitch step.