forked from nasa/astrobee
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build 3 - CERT Release. Prepared for CERT testing and upgraded simulator.
- Loading branch information
Showing
697 changed files
with
14,076 additions
and
5,696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
-- Copyright (c) 2017, United States Government, as represented by the | ||
-- Administrator of the National Aeronautics and Space Administration. | ||
-- | ||
-- All rights reserved. | ||
-- | ||
-- The Astrobee platform is licensed under the Apache License, Version 2.0 | ||
-- (the "License"); you may not use this file except in compliance with the | ||
-- License. You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
-- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
-- License for the specific language governing permissions and limitations | ||
-- under the License. | ||
|
||
--[[ | ||
Computes the locations of the AR markers on the dock in World | ||
frame from the location of the makers defined on the target plate. | ||
|
||
AR targets are currently caraterized by the positions of three | ||
corners. The naming refering the a coordinate system attached | ||
to the marker itself when printed using generate_svg_markers: | ||
- top left | ||
- top right | ||
- bottom left | ||
|
||
The markers (from dock_markers_specs.config) are expressed in a 2D coordinate | ||
system facilitating the printing (X to the right, Y going down). | ||
|
||
We define a dock frame as follow: | ||
- origin: coincide with the origin of the target drawing | ||
(mid-point between the two berth bases) | ||
- X normal to the target plate, positive in the egress | ||
direction | ||
- Z along the short side of the target plate, positive down (if | ||
looking at the drawing) | ||
- Y is thus | ||
|
||
We start by placing the markers from the drawing coordinates | ||
into the dock frame. Then we apply a transform to find the | ||
marker coordinates in world frame by using the dock location in the world. | ||
|
||
The dock location is defined in the "world" config with: | ||
- world_dock_position | ||
- world_dock_orientation | ||
If using this file without a context + world, these two variable should be | ||
first defined. | ||
|
||
--]] | ||
|
||
require "context" | ||
require "rotations" | ||
local matrix = require 'matrix' | ||
|
||
require "dock_markers_specs" | ||
|
||
-- Compute the corners of a marker in dock frame in function of its | ||
-- size and position in 2D target frame | ||
function marker_corners(m, scale) | ||
-- express corners in dock frame (see intro) | ||
top_left = scale * matrix{0.0, -m['pos'][1], m['pos'][2]} | ||
top_right = top_left + scale * matrix{0.0, -m['size'], 0.0} | ||
bottom_left = top_left + scale * matrix{0.0, 0.0, m['size']} | ||
return top_left, top_right, bottom_left | ||
end | ||
|
||
-- Units transformation | ||
if ( drawing_unit == "mm") then | ||
-- print("tagets drawing expressed in millimeters") | ||
scale_factor = 0.001 | ||
elseif ( drawing_unit =="in") then | ||
-- print("targets drawing are expressed in inches") | ||
scale_factor = 0.0254 | ||
else | ||
print("Warning: targets drawing unit not defined or not recognized") | ||
print(" assume meters") | ||
scale_factor = 1.0 | ||
end | ||
|
||
|
||
-- Processing | ||
markers_world = {} | ||
for k,v in pairs(markers) do | ||
marker_in_world = {} | ||
top_left, top_right, bottom_left = marker_corners(v, scale_factor) | ||
marker_in_world['id'] = v['id'] | ||
-- Edited by Andrew to put dock markers in DOCK frame not WORLD frame, since | ||
-- the EKF now works in a local frame AND that having the features in the | ||
-- DOCK frame allows us to use the feature messages for etrinsic calibration. | ||
top_left_world = top_left | ||
top_right_world = top_right | ||
bottom_left_world = bottom_left | ||
-- corners results are in Matrix form, transpose them back into a table | ||
marker_in_world['top_left'] = { | ||
top_left_world[1][1], top_left_world[2][1], top_left_world[3][1] } | ||
marker_in_world['top_right'] = { | ||
top_right_world[1][1], top_right_world[2][1], top_right_world[3][1] } | ||
marker_in_world['bottom_left'] = { | ||
bottom_left_world[1][1], bottom_left_world[2][1], bottom_left_world[3][1] } | ||
table.insert(markers_world, marker_in_world) | ||
end | ||
|
||
--[[ | ||
-- Simple utility function to print a 3x1 matrix as a vector | ||
function print_vec3(v, str) | ||
-- TODO should check the size first | ||
print(string.format("%s=(%.3f, %.3f, %.3f)", | ||
str, v[1], v[2], v[3])) | ||
end | ||
|
||
for k,v in pairs(markers_world) do | ||
print("-------- marker", k) | ||
print(string.format("id=%d", v['id'])) | ||
print_vec3(v['top_left'], "top_left") | ||
print_vec3(v['top_right'], "top_right") | ||
print_vec3(v['bottom_left'], "bottom_left") | ||
end | ||
--]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.