Skip to content

Commit

Permalink
Minor config fixes (nasa#383)
Browse files Browse the repository at this point in the history
* bsharp2 calibration refinement
* cameras.config: Remove comment which is no longer true, haz_cam is used
* Update bumble and bsharp config files
* Minor doc formatting tweaks
  • Loading branch information
oleg-alexandrov authored Jan 4, 2022
1 parent d859eba commit d14d2fa
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 69 deletions.
12 changes: 5 additions & 7 deletions astrobee/config/cameras.config
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ dock_cam = {
bayer_throttle_ratio = 3
};

-- The haz and perch cam params below are ignored for the time being.
-- The distortion_coeff, etc, must be set in each bot's config file.
haz_cam = {
width = 224,
height = 171,
Expand All @@ -77,11 +75,11 @@ perch_cam = {
height = 171,
undistorted_width = 250,
undistorted_height = 200,
distortion_coeff=robot_camera_calibrations.perch_cam.distortion_coeff,
intrinsic_matrix=robot_camera_calibrations.perch_cam.intrinsic_matrix,
device="/dev/perch_cam",
gain= robot_camera_calibrations.perch_cam.gain,
exposure= robot_camera_calibrations.perch_cam.exposure,
distortion_coeff = robot_camera_calibrations.perch_cam.distortion_coeff,
intrinsic_matrix = robot_camera_calibrations.perch_cam.intrinsic_matrix,
device = "/dev/perch_cam",
gain = robot_camera_calibrations.perch_cam.gain,
exposure = robot_camera_calibrations.perch_cam.exposure,
calibration_gain = 105,
calibration_exposure = 30
};
Expand Down
28 changes: 14 additions & 14 deletions astrobee/config/robots/bsharp2.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ robot_geometry = {
-- dock_cam_transform = transform(vec3(-0.1032-0.0029, -0.0540, -0.0064), quat4(0.54029868, -0.45297017, -0.47464308, 0.52688644)),
-- imu_transform = transform(vec3(0.0247, 0.0183, 0.0094), quat4(0.0043601096, -0.0066617904, 0.75077957, 0.66050535)),

nav_cam_to_haz_cam_transform = transform(vec3(0.078127994, 0.0044668059, -0.013530384), quat4(-0.0027776443, -0.018759555, 0.9998178, 0.0021748829)),
nav_cam_to_sci_cam_transform = transform(vec3(-0.043573807, 0.017679731, 0.0012984777), quat4(0.009395152, 0.004566833, -0.0020554282, 0.99994332)),
nav_cam_to_haz_cam_transform = transform(vec3(0.079350378, 0.0020932693, -0.025811147), quat4(0.0045827434, -0.00067115432, 0.99998583, 0.0026256072)),
nav_cam_to_sci_cam_transform = transform(vec3(-0.041219515, 0.019857798, 0.015677018), quat4(0.0019155044, 0.00092629811, -0.0019321095, 0.99999587)),
haz_cam_depth_to_image_transform = {
0.94687664, -0.00042839579, -0.0009798677, 0.001373455,
0.00042815681, 0.94687712, -0.00023113888, 0.00046083491,
0.00097997214, 0.00023069566, 0.94687671, 0.00056469039,
0.94713911, 0.00063710851, 0.0043044568, 0.0084247659,
-0.00057512557, 0.94311399, 0.032836596, 0.00075736623,
-0.016608396, -0.036455481, 0.95435862, -0.026870438,
0, 0, 0, 1},

-- Engineering positions with idealized orientations
Expand All @@ -54,10 +54,10 @@ robot_geometry = {

robot_camera_calibrations = {
nav_cam = {
distortion_coeff = 1.0033897,
distortion_coeff = 1.0092039,
intrinsic_matrix = {
620.67509, 0.0, 580.25394,
0.0, 620.67509, 494.45803,
621.04422, 0.0, 580.56427,
0.0, 621.04422, 495.51236,
0.0, 0.0, 1.0
},
gain=100,
Expand All @@ -84,20 +84,20 @@ nav_cam = {
exposure=150
},
haz_cam = {
distortion_coeff = {-0.36056524, 0.063303105, 0.0017514406, 3.3229736e-05},
distortion_coeff = {-0.34478639, 0.029176425, 0.0061109035, 0.0011360463},
intrinsic_matrix = {
219.1313, 0.0, 110.9028,
0.0, 219.1313, 90.52451,
215.92492, 0.0, 108.00909,
0.0, 215.92492, 82.795963,
0.0, 0.0, 1.0
},
gain=100,
exposure=150
},
sci_cam = {
distortion_coeff = {0.00013126118, 0.011836873, 0.0014470664, -0.00011076796},
distortion_coeff = {-0.011275619, 0.049569258, -0.00085412642, 0.0016215327},
intrinsic_matrix = {
1040.0823, 0.0, 663.45304,
0.0, 1040.0823, 523.50871,
1056.7224, 0.0, 668.60496,
0.0, 1056.7224, 507.31654,
0.0, 0.0, 1.0
},
gain=100,
Expand Down
24 changes: 12 additions & 12 deletions astrobee/config/robots/bumble.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ robot_i2c_bus = "/dev/i2c-1"
robot_imu_drdy_pin = 4

robot_geometry = {
nav_cam_to_haz_cam_transform = transform(vec3(0.071421481, -0.00030319673, 0.0018058249), quat4(-0.0030431141, 0.0092646368, 0.99993195, 0.0064039206)),
nav_cam_to_sci_cam_transform = transform(vec3(-0.076526224, 0.011869553, 0.045409155), quat4(-0.0035414316, 0.0048089362, -0.0071515076, 0.99995659)),
nav_cam_to_haz_cam_transform = transform(vec3(0.072789474, 0.0010512418, -0.048805003), quat4(-0.00014444836, 0.020741299, 0.99976044, 0.006988339)),
nav_cam_to_sci_cam_transform = transform(vec3(-0.035350038, 0.019131216, 0.0083921009), quat4(0.0007718104, -0.0043221056, -0.0069533111, 0.99996619)),
haz_cam_depth_to_image_transform = {
0.91602851, -0.00031586647, -0.0028485861, 0.0029767338,
0.00032189197, 0.91603089, 0.0019373744, -0.0020741879,
0.0028479115, -0.0019383659, 0.91602652, -0.0042296964,
0.91037857, 8.4134405e-05, 0.0050848035, 0.0020508297,
-0.0003594422, 0.9113776, 0.023508033, -0.0011003268,
-0.0044235394, -0.018620972, 0.88773717, -0.028333293,
0, 0, 0, 1},

-- Engineering positions with idealized orientations
Expand Down Expand Up @@ -76,27 +76,27 @@ robot_camera_calibrations = {
exposure=150
},
haz_cam = {
distortion_coeff = {-0.050689743, -1.1461691, -0.001373226, -0.00056427513},
distortion_coeff = {-0.259498, -0.08484934, 0.0032980311, -0.00024045673},
intrinsic_matrix = {
215.88697, 0.0, 114.12908,
0.0, 215.88697, 86.547331,
206.19095, 0.0, 112.48999,
0.0, 206.19095, 81.216598,
0.0, 0.0, 1.0
},
gain=50,
exposure=150
},
sci_cam = {
distortion_coeff = {0.029948958, -0.056854916, -0.00077885482, -0.0039909885},
distortion_coeff = {-0.025598438, 0.048258987, -0.00041380657, 0.0056673533},
intrinsic_matrix = {
1048.499, 0.0, 705.22914,
0.0, 1048.499, 511.03079,
1023.6054, 0.0, 683.97547,
0.0, 1023.6054, 511.2185,
0.0, 0.0, 1.0
},
gain=50,
exposure=150
},
nav_cam_to_haz_cam_timestamp_offset = -0.02,
nav_cam_to_sci_cam_timestamp_offset = 0.18
nav_cam_to_sci_cam_timestamp_offset = 0.08
}

-- PMC bus ordering and i2c trims {stbd, port}
Expand Down
3 changes: 3 additions & 0 deletions localization/sparse_mapping/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ name can change.
The ``build_map`` tools is used to construct a map. See \ref
map_building for further details.

See \ref theia_map for how to build a map with the external
Theia package and import it into Astrobee.

### Visualization

To visualize a map, or just a list of images, use the command:
Expand Down
72 changes: 36 additions & 36 deletions localization/sparse_mapping/theia_map.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Create and activate the environment:

Run the following command to install some packages and GCC 11:

conda install -c conda-forge cmake \
gcc_linux-64==11.1.0 gxx_linux-64==11.1.0 \
lapack blas eigen==3.3.7 suitesparse rapidjson \
glog gflags rocksdb OpenImageIO \
ceres-solver=1.14.0=h0948850_10
conda install -c conda-forge cmake \
gcc_linux-64==11.1.0 gxx_linux-64==11.1.0 \
lapack blas eigen==3.3.7 suitesparse rapidjson \
glog gflags rocksdb OpenImageIO \
ceres-solver=1.14.0=h0948850_10

The Ceres package can be quite particular about the version of Eigen
it uses, and some versions of Ceres are not built with suitesparse
Expand All @@ -40,13 +40,13 @@ care is needed with choosing the versions of the packages.

# Fetch and build Theia

git clone [email protected]:sweeneychris/TheiaSfM.git
cd TheiaSfM
git checkout d2112f1 # this version was tested
git clone [email protected]:sweeneychris/TheiaSfM.git
cd TheiaSfM
git checkout d2112f1 # this version was tested

Edit the file:

applications/CMakeLists.txt
applications/CMakeLists.txt

and comment out all the lines regarding OpenGL, GLEW, GLUT, and
view_reconstruction. That visualizer logic is not easy to compile
Expand All @@ -56,10 +56,10 @@ Run ``which cmake`` to ensure its version in the ``theia`` environemnt
installed earlier is used. Otherwise run again ``conda activate
theia``. Do:

mkdir build
cd build
cmake ..
make -j 20
mkdir build
cd build
cmake ..
make -j 20

This will create the executables ``build_reconstruction`` and
``export_to_nvm_file`` in the ``bin`` subdirectory of ``build``. That
Expand All @@ -75,15 +75,15 @@ one should ensure that the ``env`` command has no mentions of conda.
Set the environment. The following lines should be adjusted as needed,
especially the robot name:

export ASTROBEE_SOURCE_PATH=$HOME/projects/astrobee/src
source $ASTROBEE_SOURCE_PATH/../devel/setup.bash
export ASTROBEE_RESOURCE_DIR=$ASTROBEE_SOURCE_PATH/astrobee/resources
export ASTROBEE_CONFIG_DIR=$ASTROBEE_SOURCE_PATH/astrobee/config
export ASTROBEE_WORLD=iss
export ASTROBEE_ROBOT=bumble
export ASTROBEE_SOURCE_PATH=$HOME/projects/astrobee/src
source $ASTROBEE_SOURCE_PATH/../devel/setup.bash
export ASTROBEE_RESOURCE_DIR=$ASTROBEE_SOURCE_PATH/astrobee/resources
export ASTROBEE_CONFIG_DIR=$ASTROBEE_SOURCE_PATH/astrobee/config
export ASTROBEE_WORLD=iss
export ASTROBEE_ROBOT=bumble

python $ASTROBEE_SOURCE_PATH/localization/sparse_mapping/tools/build_theia_map.py \
--output_map theia.map --work_dir theia_work --image_list image_list.txt
python $ASTROBEE_SOURCE_PATH/localization/sparse_mapping/tools/build_theia_map.py \
--output_map theia.map --work_dir theia_work --image_list image_list.txt

This will take care of preparing everything Theia needs, will run it,
and will export the resulting map to Astrobee's expected format. This
Expand All @@ -92,19 +92,19 @@ documentation. The work directory can be deleted later.

This tool has the following command-line options:

--theia_flags: The flags to pass to Theia. If not specified, use
localization/sparse_mapping/theia_flags.txt in the Astrobee repo.
--image_list: The list of distorted (original) nav cam images to
use, one per line.
--output_map: The resulting output map.
--skip_rebuilding: Do not rebuild the map after importing it from
Theia.
--work_dir: A temporary work directory to be deleted by the user
later.
--keep_undistorted_images: Do not replace the undistorted images
Theia used with the original distorted ones in the sparse map
imported from Theia. This is for testing purposes.
--help: Show this help message and exit.
--theia_flags: The flags to pass to Theia. If not specified, use
localization/sparse_mapping/theia_flags.txt in the Astrobee repo.
--image_list: The list of distorted (original) nav cam images to
use, one per line.
--output_map: The resulting output map.
--skip_rebuilding: Do not rebuild the map after importing it from
Theia.
--work_dir: A temporary work directory to be deleted by the user
later.
--keep_undistorted_images: Do not replace the undistorted images
Theia used with the original distorted ones in the sparse map
imported from Theia. This is for testing purposes.
--help: Show this help message and exit.

# Auxiliary import_map tool

Expand All @@ -114,7 +114,7 @@ exports to. These operations are done automatically by the
reference only.

An NVM map exported by Theia (or some other SfM tool) can be saved as
an Astrobee sparse map with the command::
an Astrobee sparse map with the command:

astrobee/devel/lib/sparse_mapping/import_map \
-undistorted_camera_params "wid_x wid_y focal_len opt_ctr_x opt_ctr_y" \
Expand All @@ -129,7 +129,7 @@ should be as printed on the screen (and saved to disk) by

If desired to replace on importing the undistorted images with the
original distorted ones, as it is usually expected of a sparse map,
the above command should be called instead as::
the above command should be called instead as:

astrobee/devel/lib/sparse_mapping/import_map \
-undistorted_images_list undist_list.txt \
Expand Down

0 comments on commit d14d2fa

Please sign in to comment.