diff --git a/doc/tutorial/detection_dnn/tutorial-detection-tensorrt.dox b/doc/tutorial/detection_dnn/tutorial-detection-tensorrt.dox index aff7c62955..2660c603e7 100644 --- a/doc/tutorial/detection_dnn/tutorial-detection-tensorrt.dox +++ b/doc/tutorial/detection_dnn/tutorial-detection-tensorrt.dox @@ -201,7 +201,7 @@ Include TensorRT header files. \subsection preprocessing Pre-processing Prepare input image for inference with OpenCV. First, upload image to GPU, resize it to match model's input dimensions, normalize with `meanR` `meanG` `meanB` being -the values used for mean substraction. +the values used for mean subtraction. Transform data to tensor (copy data to channel by channel to `gpu_input`). In the case of `ssd_mobilenet.onnx`, the input dimension is 1x3x300x300. \snippet tutorial-dnn-tensorrt-live.cpp Preprocess image diff --git a/doc/tutorial/imgproc/tutorial-imgproc-count-coins.dox b/doc/tutorial/imgproc/tutorial-imgproc-count-coins.dox index 123dd01bdb..cc8431e3a6 100644 --- a/doc/tutorial/imgproc/tutorial-imgproc-count-coins.dox +++ b/doc/tutorial/imgproc/tutorial-imgproc-count-coins.dox @@ -71,7 +71,7 @@ The fill holes algorithm is basic: \image html img-tutorial-count-coins-mask.png "Left: binary image, right: result of the flood fill operation" -- substract the flood fill image from a white image to get only the holes +- subtract the flood fill image from a white image to get only the holes \image html img-tutorial-count-coins-white-holes.png "Top left: white image, bottom left: flood fill image, right: I_holes = I_white - I_flood_fill" diff --git a/doc/tutorial/misc/tutorial-ukf.dox b/doc/tutorial/misc/tutorial-ukf.dox index f8e0bb1b8e..9725d28c1c 100644 --- a/doc/tutorial/misc/tutorial-ukf.dox +++ b/doc/tutorial/misc/tutorial-ukf.dox @@ -357,17 +357,17 @@ Finally, we create the UKF and initialize its state: \snippet tutorial-ukf.cpp Init_UKF -If the internal state cannot use the standard addition and substraction, it would be necessary to write other methods: +If the internal state cannot use the standard addition and subtraction, it would be necessary to write other methods: - a method permitting to add two state vectors (see vpUnscentedKalman::setStateAddFunction), -- a method permitting to substract two state vectors (see vpUnscentedKalman::setStateResidualFunction), +- a method permitting to subtract two state vectors (see vpUnscentedKalman::setStateResidualFunction), - and a method permitting to compute the mean of several state vectors (see vpUnscentedKalman::setStateMeanFunction). If some commands are known to have an effect on the internal state, it would be necessary to write other methods: - a method for the effects of the commands on the state, without knowing the state (see vpUnscentedKalman::setCommandOnlyFunction), - and/or a method for the effects of the commands on the state, knowing the state (see vpUnscentedKalman::setCommandStateFunction). -If the measurement space cannot use the standard addition and substraction, it would be necessary to write other methods: -- a method permitting to substract two measurement vectors (see vpUnscentedKalman::setMeasurementResidualFunction), +If the measurement space cannot use the standard addition and subtraction, it would be necessary to write other methods: +- a method permitting to subtract two measurement vectors (see vpUnscentedKalman::setMeasurementResidualFunction), - and a method permitting to compute the mean of several measurement vectors (see vpUnscentedKalman::setMeasurementMeanFunction). \subsubsection tuto-ukf-tutorial-explained-initgui Details on the initialization of the Graphical User Interface diff --git a/example/kalman/ukf-nonlinear-complex-example.cpp b/example/kalman/ukf-nonlinear-complex-example.cpp index adbdb4ef2a..4b5d06ee92 100644 --- a/example/kalman/ukf-nonlinear-complex-example.cpp +++ b/example/kalman/ukf-nonlinear-complex-example.cpp @@ -28,7 +28,8 @@ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -/** \example ukf-nonlinear-complex-example.cpp +/** + * \example ukf-nonlinear-complex-example.cpp * Example of a complex non-linear use-case of the Unscented Kalman Filter (UKF). * The system we are interested in is a 4-wheel robot, moving at a low velocity. * As such, it can be modeled using a bicycle model. @@ -118,7 +119,7 @@ double normalizeAngle(const double &angle) */ vpColVector measurementMean(const std::vector &measurements, const std::vector &wm) { - const unsigned int nbPoints = measurements.size(); + const unsigned int nbPoints = static_cast(measurements.size()); const unsigned int sizeMeasurement = measurements[0].size(); const unsigned int nbLandmarks = sizeMeasurement / 2; vpColVector mean(sizeMeasurement, 0.); @@ -138,16 +139,16 @@ vpColVector measurementMean(const std::vector &measurements, const } /** - * \brief Compute the substraction between two vectors expressed in the measurement space, + * \brief Compute the subtraction between two vectors expressed in the measurement space, * such as v[0] = dist_0 ; v[1] = bearing_0; v[2] = dist_1 ; v[3] = bearing_1 ... * - * \param[in] meas Measurement to which we must substract something. - * \param[in] toSubstract The something we must substract. - * \return vpColVector \b meas - \b toSubstract . + * \param[in] meas Measurement to which we must subtract something. + * \param[in] toSubtract The something we must subtract. + * \return vpColVector \b meas - \b toSubtract . */ -vpColVector measurementResidual(const vpColVector &meas, const vpColVector &toSubstract) +vpColVector measurementResidual(const vpColVector &meas, const vpColVector &toSubtract) { - vpColVector res = meas - toSubstract; + vpColVector res = meas - toSubtract; unsigned int nbMeasures = res.size(); for (unsigned int i = 1; i < nbMeasures; i += 2) { res[i] = normalizeAngle(res[i]); @@ -180,7 +181,7 @@ vpColVector stateAdd(const vpColVector &state, const vpColVector &toAdd) vpColVector stateMean(const std::vector &states, const std::vector &wm) { vpColVector mean(3, 0.); - unsigned int nbPoints = states.size(); + unsigned int nbPoints = static_cast(states.size()); double sumCos = 0.; double sumSin = 0.; for (unsigned int i = 0; i < nbPoints; ++i) { @@ -194,16 +195,16 @@ vpColVector stateMean(const std::vector &states, const std::vector< } /** - * \brief Compute the substraction between two vectors expressed in the state space, + * \brief Compute the subtraction between two vectors expressed in the state space, * such as v[0] = x ; v[1] = y; v[2] = heading . * - * \param[in] state State to which we must substract something. - * \param[in] toSubstract The something we must substract. - * \return vpColVector \b state - \b toSubstract . + * \param[in] state State to which we must subtract something. + * \param[in] toSubtract The something we must subtract. + * \return vpColVector \b state - \b toSubtract . */ -vpColVector stateResidual(const vpColVector &state, const vpColVector &toSubstract) +vpColVector stateResidual(const vpColVector &state, const vpColVector &toSubtract) { - vpColVector res = state - toSubstract; + vpColVector res = state - toSubtract; res[2] = normalizeAngle(res[2]); return res; } @@ -474,7 +475,7 @@ class vpLandmarksGrid */ vpColVector state_to_measurement(const vpColVector &chi) { - unsigned int nbLandmarks = m_landmarks.size(); + unsigned int nbLandmarks = static_cast(m_landmarks.size()); vpColVector measurements(2*nbLandmarks); for (unsigned int i = 0; i < nbLandmarks; ++i) { vpColVector landmarkMeas = m_landmarks[i].state_to_measurement(chi); @@ -494,7 +495,7 @@ class vpLandmarksGrid */ vpColVector measureGT(const vpColVector &pos) { - unsigned int nbLandmarks = m_landmarks.size(); + unsigned int nbLandmarks = static_cast(m_landmarks.size()); vpColVector measurements(2*nbLandmarks); for (unsigned int i = 0; i < nbLandmarks; ++i) { vpColVector landmarkMeas = m_landmarks[i].measureGT(pos); @@ -514,7 +515,7 @@ class vpLandmarksGrid */ vpColVector measureWithNoise(const vpColVector &pos) { - unsigned int nbLandmarks = m_landmarks.size(); + unsigned int nbLandmarks = static_cast(m_landmarks.size()); vpColVector measurements(2*nbLandmarks); for (unsigned int i = 0; i < nbLandmarks; ++i) { vpColVector landmarkMeas = m_landmarks[i].measureWithNoise(pos); @@ -560,10 +561,10 @@ int main(const int argc, const char *argv[]) , vpLandmarkMeasurements(20, 5, sigmaRange, sigmaBearing) , vpLandmarkMeasurements(0, 30, sigmaRange, sigmaBearing) , vpLandmarkMeasurements(50, 30, sigmaRange, sigmaBearing) - , vpLandmarkMeasurements(40, 10, sigmaRange, sigmaBearing) }; // Vector of landmarks constituing the grid - const unsigned int nbLandmarks = landmarks.size(); // Number of landmarks constituing the grid + , vpLandmarkMeasurements(40, 10, sigmaRange, sigmaBearing) }; // Vector of landmarks constituting the grid + const unsigned int nbLandmarks = static_cast(landmarks.size()); // Number of landmarks constituting the grid std::vector cmds = generateCommands(); - const unsigned int nbCmds = cmds.size(); + const unsigned int nbCmds = static_cast(cmds.size()); // Initialize the attributes of the UKF std::shared_ptr drawer = std::make_shared(3, 0.1, 2., 0, stateResidual, stateAdd); diff --git a/example/kalman/ukf-nonlinear-example.cpp b/example/kalman/ukf-nonlinear-example.cpp index 067ad1b6ad..e6dce7377f 100644 --- a/example/kalman/ukf-nonlinear-example.cpp +++ b/example/kalman/ukf-nonlinear-example.cpp @@ -75,7 +75,7 @@ where \f$ w_m^i \f$ is the weight associated to the \f$ i^{th} \f$ measurements for the weighted mean. - Additionnally, the addition and substraction of angles must be carefully done, as the result + Additionnally, the addition and subtraction of angles must be carefully done, as the result must stay in the interval \f$[- \pi ; \pi ]\f$ or \f$[0 ; 2 \pi ]\f$ . We decided to use the interval \f$[- \pi ; \pi ]\f$ . */ @@ -143,7 +143,7 @@ double normalizeAngle(const double &angle) */ vpColVector measurementMean(const std::vector &measurements, const std::vector &wm) { - const unsigned int nbPoints = measurements.size(); + const unsigned int nbPoints = static_cast(measurements.size()); const unsigned int sizeMeasurement = measurements[0].size(); vpColVector mean(sizeMeasurement, 0.); double sumCos(0.); @@ -160,16 +160,16 @@ vpColVector measurementMean(const std::vector &measurements, const } /** - * \brief Compute the substraction between two vectors expressed in the measurement space, + * \brief Compute the subtraction between two vectors expressed in the measurement space, * such as v[0] = range ; v[1] = elevation_angle * - * \param[in] meas Measurement to which we must substract something. - * \param[in] toSubstract The something we must substract. - * \return vpColVector \b meas - \b toSubstract . + * \param[in] meas Measurement to which we must subtract something. + * \param[in] toSubtract The something we must subtract. + * \return vpColVector \b meas - \b toSubtract . */ -vpColVector measurementResidual(const vpColVector &meas, const vpColVector &toSubstract) +vpColVector measurementResidual(const vpColVector &meas, const vpColVector &toSubtract) { - vpColVector res = meas - toSubstract; + vpColVector res = meas - toSubtract; res[1] = normalizeAngle(res[1]); return res; } diff --git a/modules/core/include/visp3/core/vpUnscentedKalman.h b/modules/core/include/visp3/core/vpUnscentedKalman.h index 3003d1b9ec..bbdc7412e0 100644 --- a/modules/core/include/visp3/core/vpUnscentedKalman.h +++ b/modules/core/include/visp3/core/vpUnscentedKalman.h @@ -175,19 +175,19 @@ class VISP_EXPORT vpUnscentedKalman /** * \brief Function that computes either the equivalent of an addition or the equivalent - * of a substraction in the state space or in the measurement space. - * The first argument is the vector to which we must add/substract something - * and the second argument is the thing to be added/substracted. The return is the + * of a subtraction in the state space or in the measurement space. + * The first argument is the vector to which we must add/subtract something + * and the second argument is the thing to be added/subtracted. The return is the * result of this operation. */ typedef std::function vpAddSubFunction; /** - * \brief Residual function, which computes either the equivalent of the substraction in the - * state space or the equivalent of the substraction in the measurement space. - * The first argument is the vector to which we must substract something - * and the second argument is the thing to be substracted. The return is the - * result of this "substraction". + * \brief Residual function, which computes either the equivalent of the subtraction in the + * state space or the equivalent of the subtraction in the measurement space. + * The first argument is the vector to which we must subtract something + * and the second argument is the thing to be subtracted. The return is the + * result of this "subtraction". */ typedef std::function vpAddFunction; @@ -246,7 +246,7 @@ class VISP_EXPORT vpUnscentedKalman } /** - * \brief Set the measurement residual function to use when computing a substraction + * \brief Set the measurement residual function to use when computing a subtraction * in the measurement space. * * \param measResFunc The residual function to use. @@ -279,7 +279,7 @@ class VISP_EXPORT vpUnscentedKalman } /** - * \brief Set the state residual function to use when computing a substraction + * \brief Set the state residual function to use when computing a subtraction * in the state space. * * \param stateResFunc The residual function to use. @@ -393,15 +393,15 @@ class VISP_EXPORT vpUnscentedKalman } /** - * \brief Simple function to compute a residual, which just does \f$ \textbf{res} = \textbf{a} - \textbf{toSubstract} \f$ + * \brief Simple function to compute a residual, which just does \f$ \textbf{res} = \textbf{a} - \textbf{toSubtract} \f$ * - * \param[in] a Vector to which we must substract something. - * \param[in] toSubstract The something we must substract to \b a . - * \return vpColVector \f$ \textbf{res} = \textbf{a} - \textbf{toSubstract} \f$ + * \param[in] a Vector to which we must subtract something. + * \param[in] toSubtract The something we must subtract to \b a . + * \return vpColVector \f$ \textbf{res} = \textbf{a} - \textbf{toSubtract} \f$ */ - inline static vpColVector simpleResidual(const vpColVector &a, const vpColVector &toSubstract) + inline static vpColVector simpleResidual(const vpColVector &a, const vpColVector &toSubtract) { - vpColVector res = a - toSubstract; + vpColVector res = a - toSubtract; return res; } @@ -448,10 +448,10 @@ class VISP_EXPORT vpUnscentedKalman vpCommandOnlyFunction m_b; /*!< Function that permits to compute the effect of the commands on the prior, without knowledge of the state.*/ vpCommandStateFunction m_bx; /*!< Function that permits to compute the effect of the commands on the prior, with knowledge of the state.*/ vpMeanFunction m_measMeanFunc; /*!< Function to compute a weighted mean in the measurement space.*/ - vpAddSubFunction m_measResFunc; /*!< Function to compute a substraction in the measurement space.*/ + vpAddSubFunction m_measResFunc; /*!< Function to compute a subtraction in the measurement space.*/ vpAddSubFunction m_stateAddFunction; /*!< Function to compute an addition in the state space.*/ vpMeanFunction m_stateMeanFunc; /*!< Function to compute a weighted mean in the state space.*/ - vpAddSubFunction m_stateResFunc; /*!< Function to compute a substraction in the state space.*/ + vpAddSubFunction m_stateResFunc; /*!< Function to compute a subtraction in the state space.*/ /** * \brief Structure that stores the results of the unscented transform. diff --git a/modules/core/src/math/matrix/vpColVector.cpp b/modules/core/src/math/matrix/vpColVector.cpp index cd5e66195b..6c9fc1738e 100644 --- a/modules/core/src/math/matrix/vpColVector.cpp +++ b/modules/core/src/math/matrix/vpColVector.cpp @@ -244,16 +244,16 @@ vpColVector::vpColVector(const vpMatrix &M) : vpArray2D(M.getRows(), 1) vpColVector::vpColVector(const std::vector &v) : vpArray2D(static_cast(v.size()), 1) { - size_t v_size = v.size(); - for (size_t i = 0; i < v_size; ++i) { + unsigned int v_size = static_cast(v.size()); + for (unsigned int i = 0; i < v_size; ++i) { (*this)[i] = v[i]; } } vpColVector::vpColVector(const std::vector &v) : vpArray2D(static_cast(v.size()), 1) { - size_t v_size = v.size(); - for (size_t i = 0; i < v_size; ++i) { + unsigned int v_size = static_cast(v.size()); + for (unsigned int i = 0; i < v_size; ++i) { (*this)[i] = static_cast(v[i]); } } @@ -350,9 +350,9 @@ vpColVector &vpColVector::operator=(const vpMatrix &M) vpColVector &vpColVector::operator=(const std::vector &v) { - size_t v_size = v.size(); + unsigned int v_size = static_cast(v.size()); resize(v_size, false); - for (size_t i = 0; i < v_size; ++i) { + for (unsigned int i = 0; i < v_size; ++i) { (*this)[i] = v[i]; } return *this; @@ -360,9 +360,9 @@ vpColVector &vpColVector::operator=(const std::vector &v) vpColVector &vpColVector::operator=(const std::vector &v) { - size_t v_size = v.size(); + unsigned int v_size = static_cast(v.size()); resize(v_size, false); - for (size_t i = 0; i < v_size; ++i) { + for (unsigned int i = 0; i < v_size; ++i) { (*this)[i] = static_cast(v[i]); } return *this; diff --git a/modules/core/src/math/matrix/vpRowVector.cpp b/modules/core/src/math/matrix/vpRowVector.cpp index 6b3d9bd6ab..ef1d0bcb67 100644 --- a/modules/core/src/math/matrix/vpRowVector.cpp +++ b/modules/core/src/math/matrix/vpRowVector.cpp @@ -98,9 +98,9 @@ vpRowVector &vpRowVector::operator=(const vpMatrix &M) */ vpRowVector &vpRowVector::operator=(const std::vector &v) { - size_t v_size = v.size(); + unsigned int v_size = static_cast(v.size()); resize(v_size); - for (size_t i = 0; i < v_size; ++i) { + for (unsigned int i = 0; i < v_size; ++i) { (*this)[i] = v[i]; } return *this; @@ -110,9 +110,9 @@ vpRowVector &vpRowVector::operator=(const std::vector &v) */ vpRowVector &vpRowVector::operator=(const std::vector &v) { - size_t v_size = v.size(); + unsigned int v_size = static_cast(v.size()); resize(v_size); - for (size_t i = 0; i < v_size; ++i) { + for (unsigned int i = 0; i < v_size; ++i) { (*this)[i] = static_cast(v[i]); } return *this; @@ -579,18 +579,19 @@ vpRowVector::vpRowVector(const vpMatrix &M) : vpArray2D(1, M.getCols()) */ vpRowVector::vpRowVector(const std::vector &v) : vpArray2D(1, static_cast(v.size())) { - size_t v_size = v.size(); - for (size_t j = 0; j < v_size; ++j) { + unsigned int v_size = static_cast(v.size()); + for (unsigned int j = 0; j < v_size; ++j) { (*this)[j] = v[j]; } } + /*! Constructor that creates a row vector from a std vector of float. */ vpRowVector::vpRowVector(const std::vector &v) : vpArray2D(1, static_cast(v.size())) { - size_t v_size = v.size(); - for (size_t j = 0; j < v_size; ++j) { + unsigned int v_size = static_cast(v.size()); + for (unsigned int j = 0; j < v_size; ++j) { (*this)[j] = static_cast(v[j]); } } diff --git a/modules/core/src/tools/geometry/vpPolygon.cpp b/modules/core/src/tools/geometry/vpPolygon.cpp index 2283401203..876a1d2a88 100644 --- a/modules/core/src/tools/geometry/vpPolygon.cpp +++ b/modules/core/src/tools/geometry/vpPolygon.cpp @@ -629,7 +629,7 @@ void vpPolygon::updateBoundingBox() std::set setI; std::set setJ; - unsigned int v_corners_size = _corners.size(); + unsigned int v_corners_size = static_cast(_corners.size()); for (unsigned int i = 0; i < v_corners_size; ++i) { setI.insert(_corners[i].get_i()); setJ.insert(_corners[i].get_j()); diff --git a/modules/core/test/tools/io/testNPZ.cpp b/modules/core/test/tools/io/testNPZ.cpp index f8cde42b80..90d9da4ef3 100644 --- a/modules/core/test/tools/io/testNPZ.cpp +++ b/modules/core/test/tools/io/testNPZ.cpp @@ -104,7 +104,7 @@ TEST_CASE("Test visp::cnpy::npy_load/npz_save", "[visp::cnpy I/O]") { std::vector save_vec; save_vec.reserve(height*width*channels); - for (size_t i = 0; i < height*width*channels; i++) { + for (int i = 0; i < static_cast(height*width*channels); ++i) { save_vec.push_back(i); } @@ -120,7 +120,7 @@ TEST_CASE("Test visp::cnpy::npy_load/npz_save", "[visp::cnpy I/O]") std::vector read_vec = arr_vec_data.as_vec(); REQUIRE(save_vec_copy.size() == read_vec.size()); - for (size_t i = 0; i < read_vec.size(); i++) { + for (size_t i = 0; i < read_vec.size(); ++i) { CHECK(save_vec_copy[i] == read_vec[i]); } } @@ -256,7 +256,7 @@ TEST_CASE("Test visp::cnpy::npy_load/npz_save", "[visp::cnpy I/O]") { std::vector vec_cMo_save; for (size_t i = 0; i < 5; i++) { - vpHomogeneousMatrix cMo_save(vpTranslationVector(1+10*i, 2+20*i, 3+30*i), vpThetaUVector(0.1+i, 0.2+i, 0.3+i)); + vpHomogeneousMatrix cMo_save(vpTranslationVector(1. +10.*i, 2. +20.*i, 3. +30.*i), vpThetaUVector(0.1+i, 0.2+i, 0.3+i)); vec_cMo_save_copy.push_back(cMo_save); vec_cMo_save.insert(vec_cMo_save.end(), cMo_save.data, cMo_save.data+cMo_save.size()); // std::cout << "cMo_save:\n" << cMo_save << std::endl; diff --git a/modules/python/examples/ukf-linear-example.py b/modules/python/examples/ukf-linear-example.py index b27b7dd7ef..8f105ccec7 100644 --- a/modules/python/examples/ukf-linear-example.py +++ b/modules/python/examples/ukf-linear-example.py @@ -115,12 +115,12 @@ def add_state_vectors(a, b) -> ColVector: def residual_state_vectors(a, b) -> ColVector: """ - Method that permits to substract a state vector to another. + Method that permits to subtract a state vector to another. - :param a: The first state vector to which another state vector must be substracted. - :param b: The other state vector that must be substracted to a. + :param a: The first state vector to which another state vector must be subtracted. + :param b: The other state vector that must be subtracted to a. - :return ColVector: The substraction a - b. + :return ColVector: The subtraction a - b. """ return a - b diff --git a/modules/python/examples/ukf-nonlinear-complex-example.py b/modules/python/examples/ukf-nonlinear-complex-example.py index 29403ef912..b204a014b3 100644 --- a/modules/python/examples/ukf-nonlinear-complex-example.py +++ b/modules/python/examples/ukf-nonlinear-complex-example.py @@ -73,7 +73,7 @@ where \f$ w_m^i \f$ is the weight associated to the \f$ i^{th} \f$ measurements for the weighted mean. - Additionnally, the addition and substraction of angles must be carefully done, as the result + Additionnally, the addition and subtraction of angles must be carefully done, as the result must stay in the interval \f$[- \pi ; \pi ]\f$ or \f$[0 ; 2 \pi ]\f$ . We decided to use the interval \f$[- \pi ; \pi ]\f$ . """ @@ -126,17 +126,17 @@ def measurement_mean(measurements: List[ColVector], wm: List[float]) -> ColVecto mean[1::2] = orientations return ColVector(mean) -def measurement_residual(meas: ColVector, to_substract: ColVector) -> ColVector: +def measurement_residual(meas: ColVector, to_subtract: ColVector) -> ColVector: """ - Compute the substraction between two vectors expressed in the measurement space, + Compute the subtraction between two vectors expressed in the measurement space, such as v[0] = dist_0 ; v[1] = bearing_0; v[2] = dist_1 ; v[3] = bearing_1 ... - :param meas: Measurement to which we must substract something. - :param toSubstract: The something we must substract. + :param meas: Measurement to which we must subtract something. + :param toSubtract: The something we must subtract. - :return ColVector: \b meas - \b toSubstract . + :return ColVector: \b meas - \b toSubtract . """ - res = meas.numpy() - to_substract.numpy() + res = meas.numpy() - to_subtract.numpy() res[1::2] = [normalize_angle(angle) for angle in res[1::2]] return ColVector(res) @@ -175,13 +175,13 @@ def state_mean_vectors(states: List[ColVector], wm: List[float]) -> ColVector: def state_residual_vectors(a, b) -> ColVector: """ - Compute the substraction between two vectors expressed in the state space, + Compute the subtraction between two vectors expressed in the state space, such as v[0] = x ; v[1] = y; v[2] = heading . - :param a: The first state vector to which another state vector must be substracted. - :param b: The other state vector that must be substracted to a. + :param a: The first state vector to which another state vector must be subtracted. + :param b: The other state vector that must be subtracted to a. - :return ColVector: The substraction a - b. + :return ColVector: The subtraction a - b. """ res = a - b return ColVector([res[0], res[1], normalize_angle(res[2])]) @@ -453,9 +453,9 @@ def measure_with_noise(self, pos: ColVector) -> ColVector: sigma_bearing = Math.rad(0.5) # Standard deviation of the bearing angle: 0.5deg wheelbase = 0.5 # Wheelbase of 0.5m process_variance = 0.0001 - positions = [ (5, 10) , (10, 5), (15, 15), (20, 5), (0, 30), (50, 30), (40, 10)] # Positions of the landmarks constituing the grid - landmarks = [LandmarkMeasurements(x, y, sigma_range, sigma_bearing) for x,y in positions] # Vector of landmarks constituing the grid - nbLandmarks = len(landmarks) # Number of landmarks constituing the grid + positions = [ (5, 10) , (10, 5), (15, 15), (20, 5), (0, 30), (50, 30), (40, 10)] # Positions of the landmarks constituting the grid + landmarks = [LandmarkMeasurements(x, y, sigma_range, sigma_bearing) for x,y in positions] # Vector of landmarks constituting the grid + nbLandmarks = len(landmarks) # Number of landmarks constituting the grid cmds = generate_commands() nb_cmds = len(cmds) diff --git a/modules/python/examples/ukf-nonlinear-example.py b/modules/python/examples/ukf-nonlinear-example.py index bd7062f3a8..d795827069 100644 --- a/modules/python/examples/ukf-nonlinear-example.py +++ b/modules/python/examples/ukf-nonlinear-example.py @@ -107,17 +107,17 @@ def measurement_mean(measurements: List[ColVector], wm: List[float]) -> ColVecto return ColVector([meanRange, mean_angle]) -def measurementResidual(meas: ColVector, to_substract: ColVector) -> ColVector: +def measurementResidual(meas: ColVector, to_subtract: ColVector) -> ColVector: """ - Compute the substraction between two vectors expressed in the measurement space, + Compute the subtraction between two vectors expressed in the measurement space, such as v[0] = range ; v[1] = elevation_angle - :param meas: Measurement to which we must substract something. - :param toSubstract: The something we must substract. + :param meas: Measurement to which we must subtract something. + :param toSubtract: The something we must subtract. - :return vpColVector: \b meas - \b toSubstract . + :return vpColVector: \b meas - \b toSubtract . """ - res_temp = meas - to_substract + res_temp = meas - to_subtract return ColVector([res_temp[0], normalize_angle(res_temp[1])]) def state_add_vectors(a, b) -> ColVector: @@ -133,12 +133,12 @@ def state_add_vectors(a, b) -> ColVector: def state_residual_vectors(a, b) -> ColVector: """ - Method that permits to substract a state vector to another. + Method that permits to subtract a state vector to another. - :param a: The first state vector to which another state vector must be substracted. - :param b: The other state vector that must be substracted to a. + :param a: The first state vector to which another state vector must be subtracted. + :param b: The other state vector that must be subtracted to a. - :return ColVector: The substraction a - b. + :return ColVector: The subtraction a - b. """ return a - b diff --git a/modules/python/examples/yolo-centering-task-afma6.py b/modules/python/examples/yolo-centering-task-afma6.py index 8221727309..4844b185c2 100644 --- a/modules/python/examples/yolo-centering-task-afma6.py +++ b/modules/python/examples/yolo-centering-task-afma6.py @@ -74,12 +74,12 @@ def add_state_vectors(a, b) -> ColVector: def residual_state_vectors(a, b) -> ColVector: """ - @brief Method that permits to substract a state vector to another. + @brief Method that permits to subtract a state vector to another. - @param a The first state vector to which another state vector must be substracted. - @param b The other state vector that must be substracted to a. + @param a The first state vector to which another state vector must be subtracted. + @param b The other state vector that must be subtracted to a. - @return ColVector The substraction a - b. + @return ColVector The subtraction a - b. """ return a - b