{"id":330,"date":"2015-11-20T11:22:36","date_gmt":"2015-11-20T16:22:36","guid":{"rendered":"http:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/?page_id=330"},"modified":"2016-05-06T23:12:49","modified_gmt":"2016-05-07T03:12:49","slug":"software-subsystem-implementation","status":"publish","type":"page","link":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/system-implementation\/software-subsystem-implementation\/","title":{"rendered":"Software Subsystem Implementation"},"content":{"rendered":"<h3>1. Localization Algorithm<\/h3>\n<p>The localization algorithm is broken into three pieces:<\/p>\n<ul>\n<li>The mapping from the 2D beacon image to the 3D relative pose between the deck and the cameras\n<ul>\n<li><span style=\"line-height: 1.5\"><span style=\"line-height: 1.5\"><span style=\"line-height: 1.5\">OpenCV is used as the primary framework for this portion of the localization algorithm. Images are first converted from ROS sensor messages into OpenCV format images via the CVBridge ROS package. After converting the images, they are prepossessed using an intensity threshold value calibrated based on the exposure time of the camera. After the threshold is applied, a K-means algorithm is executed, identifying the centers each deck beacon. These centers are then paired with our &#8220;target image&#8221;, where the camera is orthogonal to the deck at some known distance. This allows for the computation of a homography matrix between our target image and our input image. This homography matrix can be combined with the matrix of camera parameters to solve the PnP problem and compute the 3D pose of the deck relative to the camera.<\/span><\/span><\/span><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/docs.opencv.org\/2.4\/_images\/math\/363c6d531e851a1eb934e7d6f875d593e2dc6f37.png\" alt=\"s \\; m' = A [R|t] M'\" \/><\/li>\n<li><a href=\"http:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/perspective_transform_matrix.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-352 aligncenter\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/perspective_transform_matrix.png\" alt=\"perspective_transform_matrix\" width=\"358\" height=\"89\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/perspective_transform_matrix.png 358w, https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/perspective_transform_matrix-300x75.png 300w\" sizes=\"auto, (max-width: 358px) 100vw, 358px\" \/><\/a>Variable Definitions:\n<ul class=\"simple\">\n<li><img decoding=\"async\" class=\"math\" src=\"http:\/\/docs.opencv.org\/2.4\/_images\/math\/0833ce84fc64962fec6e4416dde7fd4879186a96.png\" alt=\"(X, Y, Z)\" \/> are the coordinates of a 3D point in the world coordinate space<\/li>\n<li><img decoding=\"async\" class=\"math\" src=\"http:\/\/docs.opencv.org\/2.4\/_images\/math\/8a26bd6b76072e327e2462b2fe05546ba899e682.png\" alt=\"(u, v)\" \/> are the coordinates of the projection point in pixels<\/li>\n<li><img decoding=\"async\" class=\"math\" src=\"http:\/\/docs.opencv.org\/2.4\/_images\/math\/a4a22711db10ba4f6c1c70ad5f01fcc7f29a10ba.png\" alt=\"A\" \/> is a camera matrix, or a matrix of intrinsic parameters<\/li>\n<li><img decoding=\"async\" class=\"math\" src=\"http:\/\/docs.opencv.org\/2.4\/_images\/math\/48a7d669df1f15a8f8c44728809543114ce618f6.png\" alt=\"(cx, cy)\" \/> is a principal point that is usually at the image center<\/li>\n<li><img decoding=\"async\" class=\"math\" src=\"http:\/\/docs.opencv.org\/2.4\/_images\/math\/ec7ae7b879562c25d2732cdd63fd257748c99c44.png\" alt=\"fx, fy\" \/> are the focal lengths expressed in pixel units.<\/li>\n<li><img decoding=\"async\" class=\"math\" src=\"http:\/\/docs.opencv.org\/2.4\/_images\/math\/fad27ce6ccd005e429215a332c9d7a3a93c8246b.png\" alt=\"[R|t]\" \/>\u00a0is the homogeneous transformation matrix derived from the homography matrix<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>The motion estimate for the rotorcraft.\n<ul>\n<li>A Kalman filter is being utilized<\/li>\n<li>It combines information from the IMU, camera information, and the commands that are being sent to the rotorcraft to estimate the roll, pitch, yaw, and vertical velocity<\/li>\n<\/ul>\n<\/li>\n<li>The motion estimate for the deck.\n<ul>\n<li>This implementation is still in development<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>2. Trajectory Generation Algorithm<\/h3>\n<p>The trajectory generation algorithm for the quadrotor used the concept of the differential flatness and quintic polynomials to generate trajectories for x, y, z and yaw. The software flow is shown below.<\/p>\n<p><a href=\"http:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/trajFlow-e1448229845840.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-449 aligncenter\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/trajFlow-e1448229845840.png\" alt=\"trajFlow\" width=\"318\" height=\"392\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/trajFlow-e1448229845840.png 500w, https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/trajFlow-e1448229845840-244x300.png 244w\" sizes=\"auto, (max-width: 318px) 100vw, 318px\" \/><\/a>And the trajectory command generated by the quintic polynomial is shown below:<\/p>\n<p><a href=\"http:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/Trajectory_x_v_a.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-622\" src=\"http:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/Trajectory_x_v_a.png\" alt=\"Trajectory_x_v_a\" width=\"1535\" height=\"821\" srcset=\"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/Trajectory_x_v_a.png 1535w, https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/Trajectory_x_v_a-300x160.png 300w, https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/Trajectory_x_v_a-768x411.png 768w, https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-content\/uploads\/sites\/11\/2015\/11\/Trajectory_x_v_a-1024x548.png 1024w\" sizes=\"auto, (max-width: 1535px) 100vw, 1535px\" \/><\/a><\/p>\n<h3>3. Trajectory\u00a0Follower subsystem<\/h3>\n<p>The trajectory follower subsystem is responsible for generating the flight commands to keep the quadrotor on its planned trajectory. This is achieved through the use of feedback from the state estimator.<\/p>\n<h3>4. Flight Control subsystem<\/h3>\n<p>The flight control subsystem is broken into two pieces:<\/p>\n<ul>\n<li>The flight control subsystem should subscribe to the commands from trajectory generation, trajectory follower, and landing algorithm subsystems. It will intake these commands and transform them into\u00a0 RC commands for the quadrotor.<\/li>\n<li>The signal distribution subsystem subscribes to the RC commands generated from the flight control subsystem. It decides\u00a0which commands are sent to the flight controller of the quadrotor. In autopilot mode, this subsystem should send commands generated from the single board computer. In manual mode, it sends commands generated from the RC transmitter.<\/li>\n<\/ul>\n<h3>5. Prediction Algorithm<\/h3>\n<p class=\"western\">In this project, only the roll of the deck is predicted. All other motion of the deck is treated as noise and handled by the controller. The roll of the deck is observed and recorded. This information is analyzed in real time to determine when safe landing times are occurring. A safe landing time is defined such that the deck is flat compared to gravity. The time difference between safe landing times is calculated, and this time difference is filtered and propagated forward.<\/p>\n<p class=\"western\">Several assumptions are made about the motion of the deck. The motion is assumed to be periodic. The period of motion has to be relatively constant on the time scale of about 4 cycles. The motion is also assumed to be symmetric. That is to say that the deck rolls just as far to the right as it rolls to the left, and spends the same amount of time on each side.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Localization Algorithm The localization algorithm is broken into three pieces: The mapping from the 2D beacon image to the 3D relative pose between the deck and the cameras OpenCV is used as the primary framework for this portion of the localization algorithm. Images are first converted from ROS sensor messages into OpenCV format images<br \/><a class=\"moretag\" href=\"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/system-implementation\/software-subsystem-implementation\/\">+ Read More<\/a><\/p>\n","protected":false},"author":26,"featured_media":0,"parent":31,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template_parts\/page-fullwidth_template.php","meta":{"footnotes":""},"class_list":["post-330","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/pages\/330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/comments?post=330"}],"version-history":[{"count":22,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/pages\/330\/revisions"}],"predecessor-version":[{"id":624,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/pages\/330\/revisions\/624"}],"up":[{"embeddable":true,"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/pages\/31"}],"wp:attachment":[{"href":"https:\/\/mrsdprojects.ri.cmu.edu\/2015teamj\/wp-json\/wp\/v2\/media?parent=330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}