User Tools

Site Tools


tutorials:virtual-laser-scanner

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:virtual-laser-scanner [2024/04/15 11:57] – created gaetantutorials:virtual-laser-scanner [2024/04/15 12:22] (current) gaetan
Line 33: Line 33:
 p.6). p.6).
  
-![fig_scanner](uploads/14d02987c1189c3a262e46d1f359bbc9/fig_scanner.png)+{{:tutorials:fig_scanner.png}}
  
 Figure 1: Directions of rays shot for the parameters $\theta_{range} = \frac{\pi}{2}, \phi_{range} = \frac{\pi}{4}, \theta_{step} = \frac{\pi}{20}, \phi_{step} = \frac{\pi}{8}$. Figure 1: Directions of rays shot for the parameters $\theta_{range} = \frac{\pi}{2}, \phi_{range} = \frac{\pi}{4}, \theta_{step} = \frac{\pi}{20}, \phi_{step} = \frac{\pi}{8}$.
  
-## Methods available+==== Methods available ====
  
-**Remark : if calling multiple scan methods (e.g. _scan__scanCylinder_+**Remark : if calling multiple scan methods (e.g. //scan////scanCylinder//
-_scanSphere_ ; see below) in a row, be sure to save the returned data+//scanSphere// ; see below) in a row, be sure to save the returned data
 after each call, as they will not be kept.** after each call, as they will not be kept.**
  
-**Notations :** _Seg(Point3d point, Vector3d vector, Double l) designates the segment which has the point _point_ at one end, the direction vector _direction_, and +**Notations :** //Seg(Point3d point, Vector3d vector, Double l)// designates the segment which has the point //point// at one end, the direction vector //direction//, and 
-of length _l_+of length //l//
-_Cir(Point3d center, Vector3d normal, Double r)designates the circle of _center_ +//Cir(Point3d center, Vector3d normal, Double r)// designates the circle of //center// 
-center, of radius _r_ and contained in a plane orthogonal to the vector _normal_.+center, of radius //r// and contained in a plane orthogonal to the vector //normal//.
  
-**setRayLength**   Sets the range of the rays. +**setRayLength** Sets the range of the rays.
-<div align="center"> +
-void setRayLength(double desiredLength) ; +
-</div> +
-&nbsp;+
  
-_desiredLenght_ must be strictly positive.+> **void setRayLength(double desiredLength) ;**
  
-**setBasis** &emsp; Sets the 3-dimensional basis to be used as reference for shooting the rays. +//desiredLenght// must be strictly positive. 
-<div align="center"> + 
-void setBasis(Vector3d x, Vector3d y, Vector3d y) ; +**setBasis** Sets the 3-dimensional basis to be used as reference for shooting the rays. 
-</div> + 
-&nbsp;+> **void setBasis(Vector3d x, Vector3d y, Vector3d y) ;**
  
 The 3 vectors must form a direct orthogonal basis. The 3 vectors must form a direct orthogonal basis.
  
-**setRange** &emsp; Sets the angular opening in _θand _φ_+**setRange** &emsp; Sets the angular opening in θ and φ. 
-<div align="center"> + 
-void setRange(double thetaRange,double phiRange) ; +**void setRange(double thetaRange,double phiRange) ;** 
-</div> +
-&nbsp;+
  
 If $thetaRange \ge 2 · \pi$ (resp. $phiRange \ge \pi$) , then $thetaRange = 2 · \pi$ (resp. $phiRange = \pi$) will be used instead. $thetaRange \le 0$ (resp. $phiRange \le 0$) If $thetaRange \ge 2 · \pi$ (resp. $phiRange \ge \pi$) , then $thetaRange = 2 · \pi$ (resp. $phiRange = \pi$) will be used instead. $thetaRange \le 0$ (resp. $phiRange \le 0$)
-sets an angular opening in _theta_ (resp. _phi_ ) of 0 (Note : _thetaRange 0_ and +sets an angular opening in //theta// (resp. //phi// ) of 0 (Note : //thetaRange 0// and 
-_phiRange 0_ corresponds at the shooting of only one ray, along the x-axis).+//phiRange 0// corresponds at the shooting of only one ray, along the x-axis). 
 + 
 +**setSteps** Sets the resolution in //theta// and //phi//. 
 + 
 +> **void setSteps(double thetaStep,double phiStep) ;**
  
-**setSteps** &emsp; Sets the resolution in _theta_ and _phi_. 
-<div align="center"> 
-void setSteps(double thetaStep,double phiStep) ; 
-</div> 
-&nbsp; 
  
-If $thetaStep \ge thetaRange$ (resp. $phiStep \ge phiRange$) , then _thetaStep = thetaRange_ (resp. _phiStep phiRange_) will be used instead. $thetaStep \le 0$ (resp. $phiRange \le 0$) sets an angular opening in theta (resp. _phi_ ) of 0.+If $thetaStep \ge thetaRange$ (resp. $phiStep \ge phiRange$) , then _thetaStep = thetaRange_ (resp. //phiStep phiRange//) will be used instead. $thetaStep \le 0$ (resp. $phiRange \le 0$) sets an angular opening in theta (resp. //phi// ) of 0.
  
 **setpDrawRay** &emsp; Set the probability of drawing one ray. **setpDrawRay** &emsp; Set the probability of drawing one ray.
-<div align="center"> 
-void setpDrawRay(double p) ; 
-</div> 
-&nbsp; 
  
-Each ray will be drawn with a probability _p_ (if $p \le 0$ no rays will be drawn, +> **void setpDrawRay(double p) ;** 
-if $p \ge 1$ all the rays will be drawn), thus $n · p$ will be drawn in average (with _n_ the total number of rays shot).+ 
 +Each ray will be drawn with a probability //p// (if $p \le 0$ no rays will be drawn, 
 +if $p \ge 1$ all the rays will be drawn), thus $n · p$ will be drawn in average (with //n// the total number of rays shot). 
 + 
 +**scan**Triggers the scanning with the specified options. 
 + 
 +> **ArrayList<Point3d> scan(Point3d center) ;**
  
-**scan** &emsp; Triggers the scanning with the specified options. 
-<div align="center"> 
-ArrayList<Point3d> scan(Point3d center) ; 
-</div> 
-&nbsp; 
  
 Rays will be shot from the point center, according to the angular parameters Rays will be shot from the point center, according to the angular parameters
 specified. Scanned points are returned in an ArrayList. specified. Scanned points are returned in an ArrayList.
  
-**writeDataToFile** &emsp; Writes the ArrayList _data_ in a file named _fileName_. The data are written according to a ”x y z” format. +**writeDataToFile** Writes the ArrayList //data// in a file named //fileName//. The data are written according to a ”x y z” format.
-<div align="center"> +
-void writeDataToFile(ArrayList<Point3d> data, String fileName) ; +
-</div> +
-&nbsp;+
  
-**scanSegment** &emsp; Moves the origin of the rays along the segment _Seg(startingPoint, direction, (nbSteps − 1) · stepLength)_. Rays are shot at each step according to the specified parameters. Scanned points are returned in an ArrayList. +**void writeDataToFile(ArrayList<Point3d> dataString fileName) ;**
-<div align="center"> +
-ArrayList<Point3d> scanSegment (Point3d startingPointVector3d +
-direction, double stepLength, int nbSteps) ; +
-</div> +
-&nbsp;+
  
-The vector _direction_ must not be null, _stepLenght_ and _nbSteps_ must be strictly positive.+ 
 +**scanSegment**  Moves the origin of the rays along the segment //Seg(startingPoint, direction, (nbSteps − 1) · stepLength)//. Rays are shot at each step according to the specified parameters. Scanned points are returned in an ArrayList. 
 + 
 +> **ArrayList<Point3d> scanSegment (Point3d startingPoint, Vector3d 
 +direction, double stepLength, int nbSteps) ;** 
 + 
 + 
 +The vector //direction// must not be null, //stepLenght// and //nbSteps// must be strictly positive.
  
 **Please note that for all the following methods, the angular pa- **Please note that for all the following methods, the angular pa-
-rameters used are those fixed by the methods _setRange_ and _setSteps_.+rameters used are those fixed by the methods //setRange// and //setSteps//.
 However, the basis defining the directions of the rays are defined However, the basis defining the directions of the rays are defined
 within the methods.** within the methods.**
  
-**scanCircle** &emsp; Moves the origin of the rays along the circle _Cir(center, normal, r)_. Rays are shot for each angular step _angleStep_ until a complete circle has+**scanCircle** Moves the origin of the rays along the circle _Cir(center, normal, r)_. Rays are shot for each angular step //angleStep// until a complete circle has
 been covered. Directions of the rays shot are defined by the local cylindrical basis $(-u, -u_{\theta}, normal)$ formed at each step, with respect to the reference basis $(zeroAngleVector, normal \land zeroAngleVector, normal)$. Scanned points are been covered. Directions of the rays shot are defined by the local cylindrical basis $(-u, -u_{\theta}, normal)$ formed at each step, with respect to the reference basis $(zeroAngleVector, normal \land zeroAngleVector, normal)$. Scanned points are
 returned in an ArrayList. returned in an ArrayList.
-<div align="center"> + 
-ArrayList<Point3d> scanCircle(Point3d center, double r, Vector3d +**ArrayList<Point3d> scanCircle(Point3d center, double r, Vector3d 
-normal,Vector3d zeroAngleVector, double angleStep) ; +normal,Vector3d zeroAngleVector, double angleStep) ;** 
-</div> +**ArrayList<Point3d> scanCircle(Point3d center, double r, Vector3d 
-<div align="center"> +normal, double angleStep) ;**
-ArrayList<Point3d> scanCircle(Point3d center, double r, Vector3d +
-normal, double angleStep) ; +
-</div> +
-&nbsp;+
  
 The vector _zeroAngleVector_ specifies the angle reference for the circle. It The vector _zeroAngleVector_ specifies the angle reference for the circle. It
 must be orthogonal to normal. If none is specified, an arbitrary vector is used. must be orthogonal to normal. If none is specified, an arbitrary vector is used.
  
-**scanCylinder** &emsp; Moves the origin of the rays on the surface of the cylinder+**scanCylinder** Moves the origin of the rays on the surface of the cylinder
 of axis the segment _Seg(startingPoint, axis, (nbSteps-1) · lengthAxisStep)_ and of axis the segment _Seg(startingPoint, axis, (nbSteps-1) · lengthAxisStep)_ and
 of radius _r_. For each step _i_ along the cylinder’s axis, the origin of the rays of radius _r_. For each step _i_ along the cylinder’s axis, the origin of the rays
Line 143: Line 128:
 the rays shot are defined by the local cylindrical basis $(-u, -u_{\theta}, axis)$ formed at the rays shot are defined by the local cylindrical basis $(-u, -u_{\theta}, axis)$ formed at
 each angular step, with respect to the reference basis $(zeroAngleVector, axis \land zeroAngleVector, axis)$. Scanned points are returned in an ArrayList. each angular step, with respect to the reference basis $(zeroAngleVector, axis \land zeroAngleVector, axis)$. Scanned points are returned in an ArrayList.
-<div align="center"> + 
-ArrayList<Point3d> scanCylinder ( Point3d startingPoint, Vector3d+> **ArrayList<Point3d> scanCylinder ( Point3d startingPoint, Vector3d
 axis, double radius, double angularStep, double lengthAxisStep, axis, double radius, double angularStep, double lengthAxisStep,
-int nbSteps) ; +int nbSteps) ;** 
-</div> +**ArrayList<Point3d> scanCylinder ( Point3d startingPoint, Vector3d axis, double radius, double angularStep, double lengthAxisStep, int nbSteps, Vector3d zeroAngleVector) ;**
-<div align="center"> +
-ArrayList<Point3d> scanCylinder ( Point3d startingPoint, Vector3d +
-axis, double radius, double angularStep, double lengthAxisStep, +
-int nbSteps, Vector3d zeroAngleVector) ; +
-</div> +
-&nbsp;+
  
-The vector _zeroAngleVector_ specifies the angle reference for each circle. It + 
-must be orthogonal to _axis_. If none is specified, an arbitrary vector is used.+The vector //zeroAngleVector// specifies the angle reference for each circle. It 
 +must be orthogonal to //axis//. If none is specified, an arbitrary vector is used.
  
 **scanSphere** &emsp; Moves the origin of the rays on a sphere of center center and **scanSphere** &emsp; Moves the origin of the rays on a sphere of center center and
-radius _r_. With respect to the spherical coordinate system based on the basis +radius r. With respect to the spherical coordinate system based on the basis 
-_(x,y,z)_, the origin of the rays moves from _φ = 0_ to _φ = πwith a step _phiStep_+(x,y,z), the origin of the rays moves from φ = to φ = π with a step //phiStep//
-and, for each angle _φ_, from _θ = 0_ to _θ = 2πwith a step _thetaStep_. Rays are +and, for each angle φ, from θ = to θ = 2π with a step //thetaStep//. Rays are 
-shot for each couple _(θ, φ)_, their directions being defined by the local spherical+shot for each couple (θ, φ), their directions being defined by the local spherical
 basis $(−u_{r}$, $−u_{\phi}$, $u_{\theta})$. Scanned points are returned in an ArrayList. basis $(−u_{r}$, $−u_{\phi}$, $u_{\theta})$. Scanned points are returned in an ArrayList.
-<div align="center"> 
-ArrayList<Point3d> scanSphere (Point3d center, double r, double 
-phiStep, double thetaStep, Vector3d x, Vector3d y, Vector3d z) ; 
-</div> 
-&nbsp; 
  
-_(x, y, z)must be a direct orthogonal basis, _r_ and _phiStep_ must be strictly +> **ArrayList<Point3d> scanSphere (Point3d center, double r, double phiStep, double thetaStep, Vector3d x, Vector3d y, Vector3d z) ;** 
-positive. If $thetaStep \le 0$, then _θ = 0_ will be used at each step (thus the origin+ 
 + 
 +//(x, y, z)// must be a direct orthogonal basis, and //phiStep// must be strictly 
 +positive. If $thetaStep \le 0$, then θ = will be used at each step (thus the origin
 of the rays describes an half circle). of the rays describes an half circle).
  
-**Noise simulation** &emsp; A set of methods enables noise simulation. The introduction of a noise factor is triggered for the parameters _θ__φand the hit distance by the following methods:  +**Noise simulation** &emsp; A set of methods enables noise simulation. The introduction of a noise factor is triggered for the parameters θ, φ and the hit distance by the following methods: 
-<div align="center"> +
-void setThetaNoise(boolean value) ; +
-</div> +
-<div align="center"> +
-void setPhiNoise(boolean value) ; +
-</div> +
-<div align="center"> +
-void setDistanceNoise(boolean value) ; +
-</div> +
-&nbsp;+
  
-Each time a point is acquired, a noise factor is added to the angle _θand or _φand or the hit distance when computing the point’s position. Noise on _θ_ +> **void setThetaNoise(boolean value) ;** 
-and _φmodifies the direction in which the point is thought to be ; noise on the+> **void setPhiNoise(boolean value) ;** 
 +> **void setDistanceNoise(boolean value) ;** 
 + 
 +Each time a point is acquired, a noise factor is added to the angle θ and or φ and or the hit distance when computing the point’s position. Noise on θ 
 +and φ modifies the direction in which the point is thought to be ; noise on the
 hit distance the distance (in this direction) from the scanner. hit distance the distance (in this direction) from the scanner.
  
 The type of noise can be set through the following methods : The type of noise can be set through the following methods :
-<div align="center"> 
-void setThetaNoiseType(int type, boolean adapt, double param1, 
-double param2) ; 
-</div> 
-<div align="center"> 
-void setPhiNoiseType(int type, boolean adapt, double param1, 
-double param2) ; 
-</div> 
-<div align="center"> 
-void setDistanceNoiseType(int type, boolean adapt, double param1, 
-double param2) ; 
-</div> 
-&nbsp; 
  
-_type 0_ sets the noise to an uniform perturbation, _type 1_ to a gaussian +> **void setThetaNoiseType(int type, boolean adapt, double param1, 
-one (any other value inducing no noise at all). _adapt false_ produces a noise +double param2) ;** 
-with fixed parameters, whereas _adapt true_ produces a noise which parameters+> **void setPhiNoiseType(int type, boolean adapt, double param1, 
 +double param2) ;** 
 +> **void setDistanceNoiseType(int type, boolean adapt, double param1, 
 +double param2) ;** 
 + 
 +//type 0// sets the noise to an uniform perturbation, //type 1// to a gaussian 
 +one (any other value inducing no noise at all). //adapt false// produces a noise 
 +with fixed parameters, whereas //adapt true// produces a noise which parameters
 depends on the real value (see below). depends on the real value (see below).
  
-Given the real value $\alpha_{r}$ of one parameter (_θ__φor the hit distance), the +Given the real value $\alpha_{r}$ of one parameter (θ, φ or the hit distance), the 
-value used to compute the point’s position is $`\alpha_{r} = \alpha_{r} + \epsilon`$, where _ϵis the noise. +value used to compute the point’s position is $`\alpha_{r} = \alpha_{r} + \epsilon`$, where ϵ is the noise. 
-With _U(a, b)denoting the uniform density on [_a__b_] (a < b), and _N(μ, σ)the +With U(a, b) denoting the uniform density on [ab] (a < b), and N(μ, σ) the 
-gaussian density of mean _μand standard deviation _σ_, the perturbation _ϵhas the+gaussian density of mean μ and standard deviation σ, the perturbation ϵ has the
 corresponding density : corresponding density :
  
-![scanner_table](uploads/5e73ca7aa9356a1e8ca13eb3ce9f8f36/scanner_table.png)+{{:tutorials:scanner_table.png}}
  
-## Annexes+==== Annexes ====
  
-### Spherical coordinate system+=== Spherical coordinate system ===
  
 The spherical coordinate system is a 3d-coordinate system in which the position of a point is specified by two angular parameters θ and φ and the radial distance The spherical coordinate system is a 3d-coordinate system in which the position of a point is specified by two angular parameters θ and φ and the radial distance
-_r_. Given a direct orthonormal basis $B_{0} = (\vec{x}, \vec{y}, \vec{z})$, and a fixed origin point +//r//. Given a direct orthonormal basis $B_{0} = (\vec{x}, \vec{y}, \vec{z})$, and a fixed origin point 
-_O_, these parameters, for some point _M(r, θ, φ)_, are defined as follow (see Fig.2+//O//, these parameters, for some point M(r, θ, φ), are defined as follow (see Fig.2
 p.7) : p.7) :
  
-$\theta = \widehat{\vec{x}, \vec{OP}}, \theta \in \left[0; 2\pi\right]$+$\theta = \widehat{\vec{x}, \vec{OP}}, \theta \in \left[0; 2\pi\right]$ 
 +> $\phi = \widehat{\vec{z}, \vec{OM}}, \phi \in \left[0; \pi\right]$ 
 +> r = OM
  
-$\phi = \widehat{\vec{z}, \vec{OM}}, \phi \in \left[0; \pi\right]$ 
  
-_r = OM_ +with //P// the orthogonal projection of //M// on the plane $(O, \vec{y}, \vec{z})$. Note that 
- +only the two angular parameters θ and φ are needed to define a direction (see
- +
-with _P_ the orthogonal projection of _M_ on the plane $(O, \vec{y}, \vec{z})$. Note that +
-only the two angular parameters _θand _φare needed to define a direction (see+
 Fig.2 p.7). Fig.2 p.7).
  
-For each direction (_θ__φ_) a local direct orthonormal basis $B_{\theta, \phi} = (\vec{u_{r}}, \vec{u_{\phi}}, \vec{u_{\theta}})$+For each direction (θ, φ) a local direct orthonormal basis $B_{\theta, \phi} = (\vec{u_{r}}, \vec{u_{\phi}}, \vec{u_{\theta}})$
 can be de defined, with : can be de defined, with :
  
-![scanner_eq](uploads/a94377f18a58e5f614766136fd3abfdb/scanner_eq.png)+{{:tutorials:scanner_eq.png}}
  
-## Cylindrical coordinate system+=== Cylindrical coordinate system ===
  
-The cylindrical coordinate system is a 3d-coordinate system in which the position of a point is specified by one angular parameter θ, one distance _r_ and one height _z_. Given a direct orthonormal basis $B_{0} = (\vec{x}, \vec{y}, \vec{z})$, and a fixed origin +The cylindrical coordinate system is a 3d-coordinate system in which the position of a point is specified by one angular parameter θ, one distance _r_ and one height //z//. Given a direct orthonormal basis $B_{0} = (\vec{x}, \vec{y}, \vec{z})$, and a fixed origin 
-point _O_, these parameters, for some point _M (r, θ, z)_, are defined as follow (see+point //O//, these parameters, for some point //M (r, θ, z)//, are defined as follow (see
 Fig.2 p.7) Fig.2 p.7)
  
-$\theta = \widehat{\vec{x}, \vec{OP}}, \theta \in \left[0; 2\pi\right]$ 
  
-_r OM_+> $\theta \widehat{\vec{x}, \vec{OP}}, \theta \in \left[0; 2\pi\right]$ 
 +> //r = OM// 
 +> $z = \vec{OM} · \vec{z}$ 
  
-$z = \vec{OM} · \vec{z}$+{{:tutorials:scanner_coordinate.png}}
  
-![scanner_coordinate](uploads/ff06231abadb1d47aac0a7ff9a0a3c87/scanner_coordinate.png)+** Figure 2: Spherical and Cylindrical coordinate system **
  
-<div align="center"> 
-Figure 2: Spherical and Cylindrical coordinate system 
-</div> 
-&nbsp; 
  
-with _P_ the orthogonal projection of _M_ on the plane $(O, \vec{x}, \vec{y})$ (see Fig.2 p.7).+with the orthogonal projection of on the plane $(O, \vec{x}, \vec{y})$ (see Fig.2 p.7).
  
-For each angle _θa local direct orthonormal basis $B_{\theta} = (\vec{u}, \vec{u_{\theta}}, \vec{z})$ can be de+For each angle θ a local direct orthonormal basis $B_{\theta} = (\vec{u}, \vec{u_{\theta}}, \vec{z})$ can be de
 defined, with : defined, with :
  
-![scanner_eq2](uploads/982f238816bdc7b49d23fca14c544775/scanner_eq2.png)+{{:tutorials:scanner_eq2.png}}
  
  
-Original report: [etard_ls.pdf](uploads/ab75562dc87022a169f1e3ab929a78fa/etard_ls.pdf) 
tutorials/virtual-laser-scanner.1713175041.txt.gz · Last modified: 2024/04/15 11:57 by gaetan