<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rsewiki.electro.dtu.dk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=S130067</id>
	<title>Rsewiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://rsewiki.electro.dtu.dk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=S130067"/>
	<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=Special:Contributions/S130067"/>
	<updated>2026-05-21T04:15:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3947</id>
		<title>AruCo Markers</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3947"/>
		<updated>2019-08-26T19:17:33Z</updated>

		<summary type="html">&lt;p&gt;S130067: /* How to use the functions from the umission */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= ArUco functions and camera calibration overview =&lt;br /&gt;
[[File:Test6image_5b.jpg|180px|thumb|right|Block with 3 ArUco marker visible]]&lt;br /&gt;
The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to use the OpenCv ArUco library.&lt;br /&gt;
&lt;br /&gt;
The ArUcu module from the OpenCv library is used to detect the markers. The library can be downloaded on [https://docs.opencv.org/4.1.1/d5/dae/tutorial_aruco_detection.html this] website, where there also is some information about the functions from the library.&lt;br /&gt;
&lt;br /&gt;
The objective of the implementation of the functions from the OpenCv library is to detect markers on a 3D printed block. The block has 6 ArUco markers on it. One on each side. The markers are placed in the following way:&lt;br /&gt;
&lt;br /&gt;
top: 30, bottom: 31, front: 33, back: 34, right: 35, left: 36&lt;br /&gt;
&lt;br /&gt;
The functions are only tested with this specific block, but it should also work with other markers if the last digit in their ID corresponds to those on the blocks. eg the numbers {50, 51, 53, 54, 55, 56} &lt;br /&gt;
== Settings ==&lt;br /&gt;
&lt;br /&gt;
Some of the settings are dependable of the printed ArUcu markers and the hardware (camera) used to detect. So the first thing to do, when starting a new project is to check and if necessary update this parameter.&lt;br /&gt;
&lt;br /&gt;
=== markerDictionary ===&lt;br /&gt;
&lt;br /&gt;
The DICT_4X4_100 predefined dictionary is used in this code. DICT_4X4_100 means that the marker is a grid of 4 by 4 black or white squares and valid marker Id are from 0 to 99.&lt;br /&gt;
Change the variable markerDictionary if it desired to be able to detect other markers.&lt;br /&gt;
 &lt;br /&gt;
===arucoSqaureDimentions===&lt;br /&gt;
The physical size of the markers influences the scale of the translation vector. In this setup, the markers with Id 30 and 31 are 10 cm the other 4 markers are 2 cm. A variable arucoSqaureDimentionsSmall is used to scale the vector if it has detected a small marker&lt;br /&gt;
Change the arucoSqaureDimentions and/or arucoSqaureDimentionsSmall, if it is desired to detect markers of other sizes.&lt;br /&gt;
&lt;br /&gt;
===cameraMatrix and distanceCoefficients===&lt;br /&gt;
To estimate the position of the markers is a camera matrix and distance coefficients needed. The file &amp;quot;ILoveCameraCalibration&amp;quot; contains these variables. At the beginning of the program is the variable loaded from the file. The camera matrix and distance coefficients can also be obtained by running the camera calibration process. The camera calibration process changes the variables in the file. &lt;br /&gt;
It is recommended to run the camera calibration process, to be sure that the values in the file not have been obtained on another robot.&lt;br /&gt;
Go to the [[AruCo_Markers#Camera_Calibration]] section for more details on camera calibration.&lt;br /&gt;
&lt;br /&gt;
== How to use the functions from the umission ==&lt;br /&gt;
&lt;br /&gt;
When a new detection of AcUco markers is wanted, simply call the function:&lt;br /&gt;
 cam-&amp;gt;startWebcamMonitoring();&lt;br /&gt;
&lt;br /&gt;
The function takes a picture and runs through all the AruCo functions. The results are saved in an array of structs called arUcoVal. The values are directly accessible from umission. For example, can the distance to the AruCo marker 30, be accessed in the following way:&lt;br /&gt;
 cam-&amp;gt;arUcoVal[30].disteance2marker;&lt;br /&gt;
&lt;br /&gt;
The struct ArUcoVal contains the values related to one ArUco marker&lt;br /&gt;
* markerId is the ID of the marker ectracted from the vector markerIds found by the cv::aruco::detectMarkers function&lt;br /&gt;
* frame is the picture where the markers are detected.&lt;br /&gt;
* rVec and tVec are also found by cv::aruco::detectMarkers.&lt;br /&gt;
* label is a sting printet on the picture with rVec, tVec ect.&lt;br /&gt;
* robotTurnCommand is a string that can be send to the robot, so that it turn and is positioned parallel to a on of the markers axes&lt;br /&gt;
* robotDriveCommand drives the robot the marker&lt;br /&gt;
* rob_Ar_H is the homogeneous transformation and rotation matrix that transform a point in the marker frame to a point in the robot frame.&lt;br /&gt;
* done indicate that the robotTurnCommand has been found&lt;br /&gt;
* markerUnitVecX, markerUnitVecY, markerUnitVecCaliperZ; is the unitvectors of the marker represented in the robot frame&lt;br /&gt;
* disteance2marker id the distance from the robot to the marker in meters&lt;br /&gt;
* angle2markerX and angle2markerY are the angle between the robot and the x or y axis of the marker frame respectively */&lt;br /&gt;
&lt;br /&gt;
== Rotation and Translation ==&lt;br /&gt;
The function [https://docs.opencv.org/4.1.1/d9/d6a/group__aruco.html#ga84dd2e88f3e8c3255eb78e0f79571bd1 estimatePoseSingleMarkers] calculates a rotation vector. &lt;br /&gt;
 rVec=[a b c] &lt;br /&gt;
The rotation vector is a compact notation of the Rodrigues notation. The Rodrigues notation notates a 3D rotation by rotation axis v and an angle &amp;amp;theta;. The object is rotated around v with the angle &amp;amp;theta;. The compact notation uses only 3 values to represent the rotation.  &lt;br /&gt;
 &amp;amp;theta; = sqrt(a²+b²+c²) &lt;br /&gt;
and &lt;br /&gt;
 v = [a/&amp;amp;theta; b/&amp;amp;theta; c/&amp;amp;theta;]&lt;br /&gt;
The [https://docs.opencv.org/4.1.1/d9/d0c/group__calib3d.html#ga61585db663d9da06b68e70cfbf6a1eac Rodrigues] function from the OpenCv library is used to convert the compact Rodrigues notation to a rotation matrix.&lt;br /&gt;
&lt;br /&gt;
This rotation matrix together with the translation vector forms a homogeneous transformation and rotation matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;. When a point &amp;lt;sup&amp;gt;Ar&amp;lt;/sup&amp;gt;P in the marker coordinates system is post multiplied on this matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;, will the result be the point in 3d coordinate system of the camera. A similar transformation matrix &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; transform coordinate from camera to robot coordinate system. Together &lt;br /&gt;
 &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; = &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; x &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; &lt;br /&gt;
is formed.  ArRobH transform vectors from marker coordinate to robot coordinate system.&lt;br /&gt;
&lt;br /&gt;
== Camera Calibration ==&lt;br /&gt;
The Ucamera class also include functions to find the camera matrix, by using a checkerboard to calibrate the camera. &lt;br /&gt;
follow the following procedure to calibrate the camera: &lt;br /&gt;
# Measure the size of a single square on the checkerboard and update chessboardDimensions. (Be as accurate as possible and use a Caliper)&lt;br /&gt;
# Count the number of squares in each row and column and subtract 1. And update chessboardDimensions. [[File:chessboard.png|180px|thumb|right|Checkerboard with dimensions (6,8) marked]]&lt;br /&gt;
# Then uncomment the function cameraCalibrationProcess(cameraMatrix, distanceCoefficients);&lt;br /&gt;
# Run the program.&lt;br /&gt;
# Position the checkerboard in front of the camera and confirm by looking at the screen that it has been detected.&lt;br /&gt;
# Press space to save the frame (in the image window, not the terminal).&lt;br /&gt;
# Move the checkerboard to a new position and repeat from step 5.&lt;br /&gt;
# When more than 15 frames have been saved the Enter button can be pushed to calibrate. 15 is the minimum frames the code will accept, but it is advisable to take 20+. The more frames the better result. &lt;br /&gt;
# When the terminal writes “calibrated and saved&amp;quot;, exit the calibration by pressing ESC.&lt;br /&gt;
# The cameraMatrix and the distanceCoefficients are saved to a file called ILoveCameraCalibration. The function loadCameraCalibration loads the values from the file. The function loadCameraCalibration is called by the UCamera constructor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last updated by --[[User:S130067|S130067]] ([[User talk:S130067|talk]]) 18:13, 26 August 2019 (CEST)&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3946</id>
		<title>AruCo Markers</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3946"/>
		<updated>2019-08-26T19:16:14Z</updated>

		<summary type="html">&lt;p&gt;S130067: /* How to use the functions from the umission */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= ArUco functions and camera calibration overview =&lt;br /&gt;
[[File:Test6image_5b.jpg|180px|thumb|right|Block with 3 ArUco marker visible]]&lt;br /&gt;
The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to use the OpenCv ArUco library.&lt;br /&gt;
&lt;br /&gt;
The ArUcu module from the OpenCv library is used to detect the markers. The library can be downloaded on [https://docs.opencv.org/4.1.1/d5/dae/tutorial_aruco_detection.html this] website, where there also is some information about the functions from the library.&lt;br /&gt;
&lt;br /&gt;
The objective of the implementation of the functions from the OpenCv library is to detect markers on a 3D printed block. The block has 6 ArUco markers on it. One on each side. The markers are placed in the following way:&lt;br /&gt;
&lt;br /&gt;
top: 30, bottom: 31, front: 33, back: 34, right: 35, left: 36&lt;br /&gt;
&lt;br /&gt;
The functions are only tested with this specific block, but it should also work with other markers if the last digit in their ID corresponds to those on the blocks. eg the numbers {50, 51, 53, 54, 55, 56} &lt;br /&gt;
== Settings ==&lt;br /&gt;
&lt;br /&gt;
Some of the settings are dependable of the printed ArUcu markers and the hardware (camera) used to detect. So the first thing to do, when starting a new project is to check and if necessary update this parameter.&lt;br /&gt;
&lt;br /&gt;
=== markerDictionary ===&lt;br /&gt;
&lt;br /&gt;
The DICT_4X4_100 predefined dictionary is used in this code. DICT_4X4_100 means that the marker is a grid of 4 by 4 black or white squares and valid marker Id are from 0 to 99.&lt;br /&gt;
Change the variable markerDictionary if it desired to be able to detect other markers.&lt;br /&gt;
 &lt;br /&gt;
===arucoSqaureDimentions===&lt;br /&gt;
The physical size of the markers influences the scale of the translation vector. In this setup, the markers with Id 30 and 31 are 10 cm the other 4 markers are 2 cm. A variable arucoSqaureDimentionsSmall is used to scale the vector if it has detected a small marker&lt;br /&gt;
Change the arucoSqaureDimentions and/or arucoSqaureDimentionsSmall, if it is desired to detect markers of other sizes.&lt;br /&gt;
&lt;br /&gt;
===cameraMatrix and distanceCoefficients===&lt;br /&gt;
To estimate the position of the markers is a camera matrix and distance coefficients needed. The file &amp;quot;ILoveCameraCalibration&amp;quot; contains these variables. At the beginning of the program is the variable loaded from the file. The camera matrix and distance coefficients can also be obtained by running the camera calibration process. The camera calibration process changes the variables in the file. &lt;br /&gt;
It is recommended to run the camera calibration process, to be sure that the values in the file not have been obtained on another robot.&lt;br /&gt;
Go to the [[AruCo_Markers#Camera_Calibration]] section for more details on camera calibration.&lt;br /&gt;
&lt;br /&gt;
== How to use the functions from the umission ==&lt;br /&gt;
&lt;br /&gt;
When a new detection of AcUco markers is wanted, simply call the function:&lt;br /&gt;
 cam-&amp;gt;startWebcamMonitoring();&lt;br /&gt;
&lt;br /&gt;
The function takes a picture and runs through all the AruCo functions. The results are saved in an array of structs called arUcoVal. The values are directly accessible from umission. For example, can the distance to the AruCo marker 30, be accessed in the following way:&lt;br /&gt;
 cam-&amp;gt;arUcoVal[30].disteance2marker;&lt;br /&gt;
&lt;br /&gt;
The struct ArUcoVal contains the values related to one ArUco marker&lt;br /&gt;
* markerId is the ID of the marker ectracted from the vector markerIds found by the cv::aruco::detectMarkers function&lt;br /&gt;
* frame is the picture where the markers are detected.&lt;br /&gt;
* rVec and tVec are also found by cv::aruco::detectMarkers.&lt;br /&gt;
* label is a sting printet on the picture with rVec, tVec ect.&lt;br /&gt;
* robotTurnCommand is a string that can be send to the robot, so that it turn and is positioned parallel to a on of the markers axes&lt;br /&gt;
* robotDriveCommand drives the robot the marker&lt;br /&gt;
* rob_Ar is the homogeneous transformation and rotation matrix that transform a point in the marker frame to a point in the robot frame.&lt;br /&gt;
* done indicate that the robotTurnCommand has been found&lt;br /&gt;
* markerUnitVecX, markerUnitVecY, markerUnitVecCaliperZ; is the unitvectors of the marker represented in the robot frame&lt;br /&gt;
* disteance2marker id the distance from the robot to the marker in meters&lt;br /&gt;
* angle2markerX and angle2markerY are the angle between the robot and the x or y axis of the marker frame respectively */&lt;br /&gt;
&lt;br /&gt;
== Rotation and Translation ==&lt;br /&gt;
The function [https://docs.opencv.org/4.1.1/d9/d6a/group__aruco.html#ga84dd2e88f3e8c3255eb78e0f79571bd1 estimatePoseSingleMarkers] calculates a rotation vector. &lt;br /&gt;
 rVec=[a b c] &lt;br /&gt;
The rotation vector is a compact notation of the Rodrigues notation. The Rodrigues notation notates a 3D rotation by rotation axis v and an angle &amp;amp;theta;. The object is rotated around v with the angle &amp;amp;theta;. The compact notation uses only 3 values to represent the rotation.  &lt;br /&gt;
 &amp;amp;theta; = sqrt(a²+b²+c²) &lt;br /&gt;
and &lt;br /&gt;
 v = [a/&amp;amp;theta; b/&amp;amp;theta; c/&amp;amp;theta;]&lt;br /&gt;
The [https://docs.opencv.org/4.1.1/d9/d0c/group__calib3d.html#ga61585db663d9da06b68e70cfbf6a1eac Rodrigues] function from the OpenCv library is used to convert the compact Rodrigues notation to a rotation matrix.&lt;br /&gt;
&lt;br /&gt;
This rotation matrix together with the translation vector forms a homogeneous transformation and rotation matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;. When a point &amp;lt;sup&amp;gt;Ar&amp;lt;/sup&amp;gt;P in the marker coordinates system is post multiplied on this matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;, will the result be the point in 3d coordinate system of the camera. A similar transformation matrix &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; transform coordinate from camera to robot coordinate system. Together &lt;br /&gt;
 &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; = &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; x &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; &lt;br /&gt;
is formed.  ArRobH transform vectors from marker coordinate to robot coordinate system.&lt;br /&gt;
&lt;br /&gt;
== Camera Calibration ==&lt;br /&gt;
The Ucamera class also include functions to find the camera matrix, by using a checkerboard to calibrate the camera. &lt;br /&gt;
follow the following procedure to calibrate the camera: &lt;br /&gt;
# Measure the size of a single square on the checkerboard and update chessboardDimensions. (Be as accurate as possible and use a Caliper)&lt;br /&gt;
# Count the number of squares in each row and column and subtract 1. And update chessboardDimensions. [[File:chessboard.png|180px|thumb|right|Checkerboard with dimensions (6,8) marked]]&lt;br /&gt;
# Then uncomment the function cameraCalibrationProcess(cameraMatrix, distanceCoefficients);&lt;br /&gt;
# Run the program.&lt;br /&gt;
# Position the checkerboard in front of the camera and confirm by looking at the screen that it has been detected.&lt;br /&gt;
# Press space to save the frame (in the image window, not the terminal).&lt;br /&gt;
# Move the checkerboard to a new position and repeat from step 5.&lt;br /&gt;
# When more than 15 frames have been saved the Enter button can be pushed to calibrate. 15 is the minimum frames the code will accept, but it is advisable to take 20+. The more frames the better result. &lt;br /&gt;
# When the terminal writes “calibrated and saved&amp;quot;, exit the calibration by pressing ESC.&lt;br /&gt;
# The cameraMatrix and the distanceCoefficients are saved to a file called ILoveCameraCalibration. The function loadCameraCalibration loads the values from the file. The function loadCameraCalibration is called by the UCamera constructor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last updated by --[[User:S130067|S130067]] ([[User talk:S130067|talk]]) 18:13, 26 August 2019 (CEST)&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3945</id>
		<title>AruCo Markers</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3945"/>
		<updated>2019-08-26T18:49:58Z</updated>

		<summary type="html">&lt;p&gt;S130067: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= ArUco functions and camera calibration overview =&lt;br /&gt;
[[File:Test6image_5b.jpg|180px|thumb|right|Block with 3 ArUco marker visible]]&lt;br /&gt;
The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to use the OpenCv ArUco library.&lt;br /&gt;
&lt;br /&gt;
The ArUcu module from the OpenCv library is used to detect the markers. The library can be downloaded on [https://docs.opencv.org/4.1.1/d5/dae/tutorial_aruco_detection.html this] website, where there also is some information about the functions from the library.&lt;br /&gt;
&lt;br /&gt;
The objective of the implementation of the functions from the OpenCv library is to detect markers on a 3D printed block. The block has 6 ArUco markers on it. One on each side. The markers are placed in the following way:&lt;br /&gt;
&lt;br /&gt;
top: 30, bottom: 31, front: 33, back: 34, right: 35, left: 36&lt;br /&gt;
&lt;br /&gt;
The functions are only tested with this specific block, but it should also work with other markers if the last digit in their ID corresponds to those on the blocks. eg the numbers {50, 51, 53, 54, 55, 56} &lt;br /&gt;
== Settings ==&lt;br /&gt;
&lt;br /&gt;
Some of the settings are dependable of the printed ArUcu markers and the hardware (camera) used to detect. So the first thing to do, when starting a new project is to check and if necessary update this parameter.&lt;br /&gt;
&lt;br /&gt;
=== markerDictionary ===&lt;br /&gt;
&lt;br /&gt;
The DICT_4X4_100 predefined dictionary is used in this code. DICT_4X4_100 means that the marker is a grid of 4 by 4 black or white squares and valid marker Id are from 0 to 99.&lt;br /&gt;
Change the variable markerDictionary if it desired to be able to detect other markers.&lt;br /&gt;
 &lt;br /&gt;
===arucoSqaureDimentions===&lt;br /&gt;
The physical size of the markers influences the scale of the translation vector. In this setup, the markers with Id 30 and 31 are 10 cm the other 4 markers are 2 cm. A variable arucoSqaureDimentionsSmall is used to scale the vector if it has detected a small marker&lt;br /&gt;
Change the arucoSqaureDimentions and/or arucoSqaureDimentionsSmall, if it is desired to detect markers of other sizes.&lt;br /&gt;
&lt;br /&gt;
===cameraMatrix and distanceCoefficients===&lt;br /&gt;
To estimate the position of the markers is a camera matrix and distance coefficients needed. The file &amp;quot;ILoveCameraCalibration&amp;quot; contains these variables. At the beginning of the program is the variable loaded from the file. The camera matrix and distance coefficients can also be obtained by running the camera calibration process. The camera calibration process changes the variables in the file. &lt;br /&gt;
It is recommended to run the camera calibration process, to be sure that the values in the file not have been obtained on another robot.&lt;br /&gt;
Go to the [[AruCo_Markers#Camera_Calibration]] section for more details on camera calibration.&lt;br /&gt;
&lt;br /&gt;
== How to use the functions from the umission ==&lt;br /&gt;
&lt;br /&gt;
When a new detection of AcUco markers is wanted, simply call the function:&lt;br /&gt;
 cam-&amp;gt;startWebcamMonitoring();&lt;br /&gt;
&lt;br /&gt;
The function takes a picture and runs through all the AruCo functions. The results are saved in an array of structs called arUcoVal. The values are directly accessible from umission. For example, can the distance to the AruCo marker 30, be accessed in the following way:&lt;br /&gt;
 cam-&amp;gt;arUcoVal[30].disteance2marker;&lt;br /&gt;
&lt;br /&gt;
The struct ArUcoVal contains the values related to one ArUco marker&lt;br /&gt;
* markerId is the ID of the marker ectracted from the vector markerIds found by the cv::aruco::detectMarkers function&lt;br /&gt;
* frame is the picture where the markers are detected.&lt;br /&gt;
* rVec and tVec are also found by cv::aruco::detectMarkers.&lt;br /&gt;
* label is a sting printet on the picture with rVec, tVec ect.&lt;br /&gt;
* robotTurnCommand is a string that can be send to the robot, so that it turn and is positioned parallel to a on of the markers axes&lt;br /&gt;
* robotDriveCommand drives the robot the marker&lt;br /&gt;
* rob_Ar_H30 is the homogeneous transformation and rotation matrix that transform a point in the marker frame to a point in the robot frame.&lt;br /&gt;
* done indicate that the robotTurnCommand has been found&lt;br /&gt;
* markerUnitVecX, markerUnitVecY, markerUnitVecCaliperZ; is the unitvectors of the marker represented in the robot frame&lt;br /&gt;
* disteance2marker id the distance from the robot to the marker in meters&lt;br /&gt;
* angle2markerX and angle2markerY are the angle between the robot and the x or y axis of the marker frame respectively */&lt;br /&gt;
&lt;br /&gt;
== Rotation and Translation ==&lt;br /&gt;
The function [https://docs.opencv.org/4.1.1/d9/d6a/group__aruco.html#ga84dd2e88f3e8c3255eb78e0f79571bd1 estimatePoseSingleMarkers] calculates a rotation vector. &lt;br /&gt;
 rVec=[a b c] &lt;br /&gt;
The rotation vector is a compact notation of the Rodrigues notation. The Rodrigues notation notates a 3D rotation by rotation axis v and an angle &amp;amp;theta;. The object is rotated around v with the angle &amp;amp;theta;. The compact notation uses only 3 values to represent the rotation.  &lt;br /&gt;
 &amp;amp;theta; = sqrt(a²+b²+c²) &lt;br /&gt;
and &lt;br /&gt;
 v = [a/&amp;amp;theta; b/&amp;amp;theta; c/&amp;amp;theta;]&lt;br /&gt;
The [https://docs.opencv.org/4.1.1/d9/d0c/group__calib3d.html#ga61585db663d9da06b68e70cfbf6a1eac Rodrigues] function from the OpenCv library is used to convert the compact Rodrigues notation to a rotation matrix.&lt;br /&gt;
&lt;br /&gt;
This rotation matrix together with the translation vector forms a homogeneous transformation and rotation matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;. When a point &amp;lt;sup&amp;gt;Ar&amp;lt;/sup&amp;gt;P in the marker coordinates system is post multiplied on this matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;, will the result be the point in 3d coordinate system of the camera. A similar transformation matrix &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; transform coordinate from camera to robot coordinate system. Together &lt;br /&gt;
 &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; = &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; x &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; &lt;br /&gt;
is formed.  ArRobH transform vectors from marker coordinate to robot coordinate system.&lt;br /&gt;
&lt;br /&gt;
== Camera Calibration ==&lt;br /&gt;
The Ucamera class also include functions to find the camera matrix, by using a checkerboard to calibrate the camera. &lt;br /&gt;
follow the following procedure to calibrate the camera: &lt;br /&gt;
# Measure the size of a single square on the checkerboard and update chessboardDimensions. (Be as accurate as possible and use a Caliper)&lt;br /&gt;
# Count the number of squares in each row and column and subtract 1. And update chessboardDimensions. [[File:chessboard.png|180px|thumb|right|Checkerboard with dimensions (6,8) marked]]&lt;br /&gt;
# Then uncomment the function cameraCalibrationProcess(cameraMatrix, distanceCoefficients);&lt;br /&gt;
# Run the program.&lt;br /&gt;
# Position the checkerboard in front of the camera and confirm by looking at the screen that it has been detected.&lt;br /&gt;
# Press space to save the frame (in the image window, not the terminal).&lt;br /&gt;
# Move the checkerboard to a new position and repeat from step 5.&lt;br /&gt;
# When more than 15 frames have been saved the Enter button can be pushed to calibrate. 15 is the minimum frames the code will accept, but it is advisable to take 20+. The more frames the better result. &lt;br /&gt;
# When the terminal writes “calibrated and saved&amp;quot;, exit the calibration by pressing ESC.&lt;br /&gt;
# The cameraMatrix and the distanceCoefficients are saved to a file called ILoveCameraCalibration. The function loadCameraCalibration loads the values from the file. The function loadCameraCalibration is called by the UCamera constructor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last updated by --[[User:S130067|S130067]] ([[User talk:S130067|talk]]) 18:13, 26 August 2019 (CEST)&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3944</id>
		<title>AruCo Markers</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3944"/>
		<updated>2019-08-26T18:36:43Z</updated>

		<summary type="html">&lt;p&gt;S130067: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= ArUco functions and camera calibration overview =&lt;br /&gt;
[[File:Test6image_5b.jpg|180px|thumb|right|Block with 3 ArUco marker visible]]&lt;br /&gt;
The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to use the OpenCv ArUco library.&lt;br /&gt;
&lt;br /&gt;
The ArUcu module from the OpenCv library is used to detect the markers. The library can be downloaded on [https://docs.opencv.org/4.1.1/d5/dae/tutorial_aruco_detection.html this] website, where there also is some information about the functions from the library.&lt;br /&gt;
&lt;br /&gt;
The objective of the implementation of the functions from the OpenCv library is to detect markers on a 3D printed block. The block has 6 ArUco markers on it. One on each side. The markers are placed in the following way:&lt;br /&gt;
&lt;br /&gt;
top: 30, bottom: 31, front: 33, back: 34, right: 35, left: 36&lt;br /&gt;
&lt;br /&gt;
The functions are only tested with this specific block, but it should also work with other markers if the last digit in their ID corresponds to those on the blocks. eg the numbers {50, 51, 53, 54, 55, 56} &lt;br /&gt;
== Settings ==&lt;br /&gt;
&lt;br /&gt;
Some of the settings are dependable of the printed ArUcu markers and the hardware (camera) used to detect. So the first thing to do, when starting a new project is to check and if necessary update this parameter.&lt;br /&gt;
&lt;br /&gt;
=== markerDictionary ===&lt;br /&gt;
&lt;br /&gt;
The DICT_4X4_100 predefined dictionary is used in this code. DICT_4X4_100 means that the marker is a grid of 4 by 4 black or white squares and valid marker Id are from 0 to 99.&lt;br /&gt;
Change the variable markerDictionary if it desired to be able to detect other markers.&lt;br /&gt;
 &lt;br /&gt;
===arucoSqaureDimentions===&lt;br /&gt;
The physical size of the markers influences the scale of the translation vector. In this setup, the markers with Id 30 and 31 are 10 cm the other 4 markers are 2 cm. A variable arucoSqaureDimentionsSmall is used to scale the vector if it has detected a small marker&lt;br /&gt;
Change the arucoSqaureDimentions and/or arucoSqaureDimentionsSmall, if it is desired to detect markers of other sizes.&lt;br /&gt;
&lt;br /&gt;
===cameraMatrix and distanceCoefficients===&lt;br /&gt;
To estimate the position of the markers is a camera matrix and distance coefficients needed. The file &amp;quot;ILoveCameraCalibration&amp;quot; contains these variables. At the beginning of the program is the variable loaded from the file. The camera matrix and distance coefficients can also be obtained by running the camera calibration process. The camera calibration process changes the variables in the file. &lt;br /&gt;
It is recommended to run the camera calibration process, to be sure that the values in the file not have been obtained on another robot.&lt;br /&gt;
&lt;br /&gt;
== How to use the functions from the umission ==&lt;br /&gt;
&lt;br /&gt;
When a new detection of AcUco markers is wanted, simply call the function:&lt;br /&gt;
 cam-&amp;gt;startWebcamMonitoring();&lt;br /&gt;
&lt;br /&gt;
The function takes a picture and runs through all the AruCo functions. The results are saved in an array of structs called arUcoVal. The values are directly accessible from umission. For example, can the distance to the AruCo marker 30, be accessed in the following way:&lt;br /&gt;
 cam-&amp;gt;arUcoVal[30].disteance2marker;&lt;br /&gt;
&lt;br /&gt;
The struct ArUcoVal contains the values related to one ArUco marker&lt;br /&gt;
* markerId is the ID of the marker ectracted from the vector markerIds found by the cv::aruco::detectMarkers function&lt;br /&gt;
* frame is the picture where the markers are detected.&lt;br /&gt;
* rVec and tVec are also found by cv::aruco::detectMarkers.&lt;br /&gt;
* label is a sting printet on the picture with rVec, tVec ect.&lt;br /&gt;
* robotTurnCommand is a string that can be send to the robot, so that it turn and is positioned parallel to a on of the markers axes&lt;br /&gt;
* robotDriveCommand drives the robot the marker&lt;br /&gt;
* rob_Ar_H30 is the homogeneous transformation and rotation matrix that transform a point in the marker frame to a point in the robot frame.&lt;br /&gt;
* done indicate that the robotTurnCommand has been found&lt;br /&gt;
* markerUnitVecX, markerUnitVecY, markerUnitVecCaliperZ; is the unitvectors of the marker represented in the robot frame&lt;br /&gt;
* disteance2marker id the distance from the robot to the marker in meters&lt;br /&gt;
* angle2markerX and angle2markerY are the angle between the robot and the x or y axis of the marker frame respectively */&lt;br /&gt;
&lt;br /&gt;
== Rotation and Translation ==&lt;br /&gt;
The function [https://docs.opencv.org/4.1.1/d9/d6a/group__aruco.html#ga84dd2e88f3e8c3255eb78e0f79571bd1 estimatePoseSingleMarkers] calculates a rotation vector. &lt;br /&gt;
 rVec=[a b c] &lt;br /&gt;
The rotation vector is a compact notation of the Rodrigues notation. The Rodrigues notation notates a 3D rotation by rotation axis v and an angle &amp;amp;theta;. The object is rotated around v with the angle &amp;amp;theta;. The compact notation uses only 3 values to represent the rotation.  &lt;br /&gt;
 &amp;amp;theta; = sqrt(a²+b²+c²) &lt;br /&gt;
and &lt;br /&gt;
 v = [a/&amp;amp;theta; b/&amp;amp;theta; c/&amp;amp;theta;]&lt;br /&gt;
The [https://docs.opencv.org/4.1.1/d9/d0c/group__calib3d.html#ga61585db663d9da06b68e70cfbf6a1eac Rodrigues] function from the OpenCv library is used to convert the compact Rodrigues notation to a rotation matrix.&lt;br /&gt;
&lt;br /&gt;
This rotation matrix together with the translation vector forms a homogeneous transformation and rotation matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;. When a point &amp;lt;sup&amp;gt;Ar&amp;lt;/sup&amp;gt;P in the marker coordinates system is post multiplied on this matrix &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039;, will the result be the point in 3d coordinate system of the camera. A similar transformation matrix &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; transform coordinate from camera to robot coordinate system. Together &lt;br /&gt;
 &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; = &amp;lt;sub&amp;gt;cam&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;rob&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; x &amp;lt;sub&amp;gt;Ar&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;cam&amp;lt;/sup&amp;gt;&#039;&#039;&#039;H&#039;&#039;&#039; &lt;br /&gt;
is formed.  ArRobH transform vectors from marker coordinate to robot coordinate system.&lt;br /&gt;
&lt;br /&gt;
== Camera Calibration ==&lt;br /&gt;
The Ucamera class also include functions to find the camera matrix, by using a checkerboard to calibrate the camera. &lt;br /&gt;
follow the following procedure to calibrate the camera: &lt;br /&gt;
# Measure the size of a single square on the checkerboard and update chessboardDimensions. (Be as accurate as possible and use a Caliper)&lt;br /&gt;
# Count the number of squares in each row and column and subtract 1. And update chessboardDimensions. [[File:chessboard.png|180px|thumb|right|Checkerboard with dimensions (6,8) marked]]&lt;br /&gt;
# Then uncomment the function cameraCalibrationProcess(cameraMatrix, distanceCoefficients);&lt;br /&gt;
# Run the program.&lt;br /&gt;
# Position the checkerboard in front of the camera and confirm by looking at the screen that it has been detected.&lt;br /&gt;
# Press space to save the frame (in the image window, not the terminal).&lt;br /&gt;
# Move the checkerboard to a new position and repeat from step 5.&lt;br /&gt;
# When more than 15 frames have been saved the Enter button can be pushed to calibrate. 15 is the minimum frames the code will accept, but it is advisable to take 20+. The more frames the better result. &lt;br /&gt;
# When the terminal writes “calibrated and saved&amp;quot;, exit the calibration by pressing ESC.&lt;br /&gt;
# The cameraMatrix and the distanceCoefficients are saved to a file called ILoveCameraCalibration. The function loadCameraCalibration loads the values from the file. The function loadCameraCalibration is called by the UCamera constructor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last updated by --[[User:S130067|S130067]] ([[User talk:S130067|talk]]) 18:13, 26 August 2019 (CEST)&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=File:Test6image_5b.jpg&amp;diff=3943</id>
		<title>File:Test6image 5b.jpg</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=File:Test6image_5b.jpg&amp;diff=3943"/>
		<updated>2019-08-26T18:16:20Z</updated>

		<summary type="html">&lt;p&gt;S130067: block with ArUco Markers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;block with ArUco Markers&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=File:Chessboard.png&amp;diff=3942</id>
		<title>File:Chessboard.png</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=File:Chessboard.png&amp;diff=3942"/>
		<updated>2019-08-26T17:09:05Z</updated>

		<summary type="html">&lt;p&gt;S130067: S130067 uploaded a new version of &amp;amp;quot;File:Chessboard.png&amp;amp;quot;: downsized&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Chessboard for calibration with dimensions illustrated&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=File:Chessboard.png&amp;diff=3941</id>
		<title>File:Chessboard.png</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=File:Chessboard.png&amp;diff=3941"/>
		<updated>2019-08-26T17:04:48Z</updated>

		<summary type="html">&lt;p&gt;S130067: Chessboard for calibration with dimensions illustrated&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Chessboard for calibration with dimensions illustrated&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3940</id>
		<title>AruCo Markers</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3940"/>
		<updated>2019-08-26T16:13:27Z</updated>

		<summary type="html">&lt;p&gt;S130067: information about different aspects with the ArUco and camera calibration functions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= ArUco functions and camera calibration overview =&lt;br /&gt;
The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to use the OpenCv ArUco library.&lt;br /&gt;
&lt;br /&gt;
The ArUcu module from the OpenCv library is used to detect the markers. The library can be downloaded on [https://docs.opencv.org/4.1.1/d5/dae/tutorial_aruco_detection.html this] website, where there also is some information about the functions from the library.&lt;br /&gt;
&lt;br /&gt;
The objective of the implementation of the functions from the OpenCv library is to detect markers on a 3D printed block. The block has 6 ArUco markers on it. One on each side. The markers are placed in the following way:&lt;br /&gt;
&lt;br /&gt;
top: 30, bottom: 31, front: 33, back: 34, right: 35, left: 36&lt;br /&gt;
&lt;br /&gt;
The functions are only tested with this specific block, but it should also work with other markers if the last digit in their ID corresponds to those on the blocks. eg the numbers {50, 51, 53, 54, 55, 56} &lt;br /&gt;
== Settings ==&lt;br /&gt;
&lt;br /&gt;
Some of the settings are dependable of the printed ArUcu markers and the hardware (camera) used to detect. So the first thing to do, when starting a new project is to check and if necessary update this parameter.&lt;br /&gt;
&lt;br /&gt;
=== markerDictionary ===&lt;br /&gt;
&lt;br /&gt;
The DICT_4X4_100 predefined dictionary is used in this code. DICT_4X4_100 means that the marker is a grid of 4 by 4 black or white squares and valid marker Id are from 0 to 99.&lt;br /&gt;
Change the variable markerDictionary if it desired to be able to detect other markers.&lt;br /&gt;
 &lt;br /&gt;
===arucoSqaureDimentions===&lt;br /&gt;
The physical size of the markers influences the scale of the translation vector. In this setup, the markers with Id 30 and 31 are 10 cm the other 4 markers are 2 cm. A variable arucoSqaureDimentionsSmall is used to scale the vector if it has detected a small marker&lt;br /&gt;
Change the arucoSqaureDimentions and/or arucoSqaureDimentionsSmall, if it is desired to detect markers of other sizes.&lt;br /&gt;
&lt;br /&gt;
===cameraMatrix and distanceCoefficients===&lt;br /&gt;
To estimate the position of the markers is a camera matrix and distance coefficients needed. The file &amp;quot;ILoveCameraCalibration&amp;quot; contains these variables. At the beginning of the program is the variable loaded from the file. The camera matrix and distance coefficients can also be obtained by running the camera calibration process. The camera calibration process changes the variables in the file. &lt;br /&gt;
It is recommended to run the camera calibration process, to be sure that the values in the file not have been obtained on another robot.&lt;br /&gt;
&lt;br /&gt;
== How to use the functions from the umission ==&lt;br /&gt;
&lt;br /&gt;
When a new detection of AcUco markers is wanted, simply call the function:&lt;br /&gt;
 cam-&amp;gt;startWebcamMonitoring();&lt;br /&gt;
&lt;br /&gt;
The function takes a picture and runs through all the AruCo functions. The results are saved in an array of structs called arUcoVal. The values are directly accessible from umission. For example, can the distance to the AruCo marker 30, be accessed in the following way:&lt;br /&gt;
 cam-&amp;gt;arUcoVal[30].disteance2marker;&lt;br /&gt;
&lt;br /&gt;
== Rotation and Translation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Camera Calibration ==&lt;br /&gt;
The Ucamera class also include functions to find the camera matrix, by using a checkerboard to calibrate the camera. &lt;br /&gt;
follow the following procedure to calibrate the camera: &lt;br /&gt;
# Measure the size of a single square on the checkerboard and update chessboardDimensions. (be as accurate as possible and use a Caliper)&lt;br /&gt;
# Count the number of squares in each row and column and subtract 1. And update chessboardDimensions. (A normal board used for a game of chess has Size(7,7) )&lt;br /&gt;
# Then uncomment the function cameraCalibrationProcess(cameraMatrix, distanceCoefficients);&lt;br /&gt;
# Run the program.&lt;br /&gt;
# Position the checkerboard in front of the camera and confirm by looking at the screen that it has been detected.&lt;br /&gt;
# Press space to save the frame (in the image window, not the terminal).&lt;br /&gt;
# Move the checkerboard to a new position and repeat from step 5.&lt;br /&gt;
# When more than 15 frames have been saved the enter button can be pushed to calibrate. 15 is the minimum frames the code will accept, but it is advisable to take 20+. The more frames the better result. &lt;br /&gt;
# When the terminal writes “calibrated and saved&amp;quot;, exit the calibration by pressing ESC.&lt;br /&gt;
# The cameraMatrix and the distanceCoefficients are saved to a file called ILoveCameraCalibration. The function loadCameraCalibration loads the values from the file. The function loadCameraCalibration is called by the UCamera constructor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last updated by --[[User:S130067|S130067]] ([[User talk:S130067|talk]]) 18:13, 26 August 2019 (CEST)&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3939</id>
		<title>AruCo Markers</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3939"/>
		<updated>2019-08-26T11:59:56Z</updated>

		<summary type="html">&lt;p&gt;S130067: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== ArUco functions and camera calibration overview ====&lt;br /&gt;
The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to use the OpenCv ArUco library.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
&lt;br /&gt;
Some of the settings is dependable of the printed ArUcu markers and the hardware (camera) used to detect. So the first thing to do, when starting a new project is to check and if necessary update this parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How to use the functions from the umission ===&lt;br /&gt;
&lt;br /&gt;
When a new detection of AcUco markers is wantet, simply call the function:&lt;br /&gt;
 cam-&amp;gt;startWebcamMonitoring();&lt;br /&gt;
&lt;br /&gt;
The function takes a picture and run trough all the AruCo functions. The results is saved in an array of structs called arUcoVal. The values are directly azzessable fra umission. For example can the distance to the AruCo marker 30, be accessed in the following way:&lt;br /&gt;
 cam-&amp;gt;arUcoVal[30].disteance2marker;&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3938</id>
		<title>AruCo Markers</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=AruCo_Markers&amp;diff=3938"/>
		<updated>2019-08-26T11:59:23Z</updated>

		<summary type="html">&lt;p&gt;S130067: Created page with &amp;quot;==== ArUco functions and camera calibration overview ==== The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== ArUco functions and camera calibration overview ====&lt;br /&gt;
The ArUco functions in the camera class are meant as an inspiration, to give a starting point to people, who want to use the OpenCv ArUco library.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
&lt;br /&gt;
Some of the settings is dependable of the printed ArUcu markers and the hardware (camera) used to detect. So the first thing to do, when starting a new project is to check and if necessary update this parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How to use the functions from the umission ===&lt;br /&gt;
&lt;br /&gt;
When a new detection of AcUco markers is wantet, simply call the function:&lt;br /&gt;
 cam-&amp;gt;startWebcamMonitoring();&lt;br /&gt;
 &lt;br /&gt;
The function takes a picture and run trough all the AruCo functions. The results is saved in an array of structs called arUcoVal. The values are directly azzessable fra umission. For example can the distance to the AruCo marker 30, be accessed in the following way:&lt;br /&gt;
 cam-&amp;gt;arUcoVal[30].disteance2marker;&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
	<entry>
		<id>https://rsewiki.electro.dtu.dk/index.php?title=Mission_template_software&amp;diff=3937</id>
		<title>Mission template software</title>
		<link rel="alternate" type="text/html" href="https://rsewiki.electro.dtu.dk/index.php?title=Mission_template_software&amp;diff=3937"/>
		<updated>2019-08-26T10:02:23Z</updated>

		<summary type="html">&lt;p&gt;S130067: The AruCo Marker section is added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===ROBOBOT mission demo C++===&lt;br /&gt;
&lt;br /&gt;
This is an example software in C++ to access both raspberry camera and REGBOT, and with an example mission controlled from the raspberry.&lt;br /&gt;
&lt;br /&gt;
====Get software====&lt;br /&gt;
&lt;br /&gt;
Get the ROBOBOT software from the svn repository:&lt;br /&gt;
&lt;br /&gt;
 svn checkout svn://repos.gbar.dtu.dk/jcan/regbot/mission mission&lt;br /&gt;
&lt;br /&gt;
or just update if there already&lt;br /&gt;
&lt;br /&gt;
 svn up&lt;br /&gt;
&lt;br /&gt;
====Compile====&lt;br /&gt;
&lt;br /&gt;
To be able to compile the demo software CMAKE needs also to use the user installed library (raspicam installed above), &lt;br /&gt;
so add the following line to ~/.bashrc:&lt;br /&gt;
&lt;br /&gt;
 export CMAKE_PREFIX_PATH=/usr/local/lib&lt;br /&gt;
&lt;br /&gt;
Then build Makefiles and compile:&lt;br /&gt;
&lt;br /&gt;
 cd ~/mission&lt;br /&gt;
 mkdir -p build&lt;br /&gt;
 cd build&lt;br /&gt;
 cmake ..&lt;br /&gt;
 make&lt;br /&gt;
&lt;br /&gt;
Then test-run the application:&lt;br /&gt;
&lt;br /&gt;
 ./mission&lt;br /&gt;
&lt;br /&gt;
It should print that the camera is open and connected to the robot (bidge).&lt;br /&gt;
&lt;br /&gt;
===Software structure===&lt;br /&gt;
&lt;br /&gt;
The software is structures as shown in figure 1 below.&lt;br /&gt;
&lt;br /&gt;
[[file:mission-software.png | 500px]]&lt;br /&gt;
&lt;br /&gt;
Figure 1. The example mission software intended as basis for full mission control. In the main.cpp file, three objects are created: bridge (UBridge reg(127.0.0.1)), camera (UCamera cam()) and mission (UMission mission(&amp;amp;reg, &amp;amp;cam)). The bridge handles communication and stores all data from the robot and the gamepad. The camera can capture images and image processing is intended here. The mission object is intended for splitting long missions into mission snippets that the REGBOT can execute.&lt;br /&gt;
&lt;br /&gt;
The mission class has access to robot data and the camera at all times using the pointers &amp;quot;bot-&amp;gt;&amp;quot; and &amp;quot;cam-&amp;gt;&amp;quot;. e.g. the heading (relative to the start position) and if the yellow gamepad button is pressed, can be fetched as:&lt;br /&gt;
&lt;br /&gt;
 float heading = bot-&amp;gt;pose-&amp;gt;h;&lt;br /&gt;
 bool yellowButton = bot-&amp;gt;joy-&amp;gt;button[3];&lt;br /&gt;
&lt;br /&gt;
Details about the data code may be found in the upose.cpp, uinfo.cpp, ujoy.cpp, umotor.cpp ... files.&lt;br /&gt;
&lt;br /&gt;
The sound system can be used for debugging, e.g. add a C++ line like:&lt;br /&gt;
&lt;br /&gt;
 system(&amp;quot;espeak \&amp;quot;bettina reached point 3\&amp;quot; -ven+f4 -a30 -s130&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
This line makes the robot say &amp;quot;bettina reached point 3&amp;quot; the parameters &amp;quot;-a30&amp;quot; turns amplitude down to 30%, &amp;quot;-ven+f4&amp;quot; sets language to english with female voice 4 and &amp;quot;-s130&amp;quot; makes the speech a little slower and easier to understand. &lt;br /&gt;
It requires that espeak is installed (sudo apt install espeak).&lt;br /&gt;
&lt;br /&gt;
To use on Raspberry pi, it is better to use&lt;br /&gt;
&lt;br /&gt;
 system(&amp;quot;espeak \&amp;quot;Mission paused.\&amp;quot; -ven+f4 -s130 -a60 2&amp;gt;/dev/null &amp;amp;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;2&amp;gt;/dev/null&amp;quot; tell that error messages should be dumped, and the final &amp;quot;&amp;amp;&amp;quot; say that it should run in the background (not to pause the mission).&lt;br /&gt;
&lt;br /&gt;
===AruCo Marker===&lt;br /&gt;
&lt;br /&gt;
The camera class contains some functions to detect Aruco markers.&lt;br /&gt;
It it described in more details on [[AruCo Markers]].&lt;br /&gt;
&lt;br /&gt;
===Software documentation (doxygen)===&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_graph_2.png | 200px]]&lt;br /&gt;
&lt;br /&gt;
Figure: generated with doxygen http://aut.elektro.dtu.dk/robobot/doc/html/classes.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The classes that inherit from UData are classes that makes data available for the mission, e.g. joystick buttons (in UJoy) event flags (in UEvent) or IR distance data (in UIRdist).&lt;br /&gt;
&lt;br /&gt;
The classes that inherit from URun has a thread running to receive data from an external source, e.g. UBridge that handles communication with the ROBOBOT_BRIDGE.&lt;br /&gt;
&lt;br /&gt;
The camera class (UCamera) is intended to do the image processing.&lt;br /&gt;
&lt;br /&gt;
====HTML documentation - Doxygen====&lt;br /&gt;
&lt;br /&gt;
To generate doxygen html files go to mission directory and run doxygen.&lt;br /&gt;
&lt;br /&gt;
 cd ~/mission&lt;br /&gt;
 doxygen Doxyfile&lt;br /&gt;
&lt;br /&gt;
then open the index.html with a browser.&lt;br /&gt;
&lt;br /&gt;
If doxygen is not installed, then install using&lt;br /&gt;
&lt;br /&gt;
 sudo apt install doxygen&lt;/div&gt;</summary>
		<author><name>S130067</name></author>
	</entry>
</feed>