Skip to content

Commit

Permalink
Merge pull request #348 from oleg-alexandrov/develop
Browse files Browse the repository at this point in the history
Add doc and tools for using Theia, and doc formatting
  • Loading branch information
oleg-alexandrov authored Dec 3, 2021
2 parents 03e9ee4 + df659e2 commit ff3287b
Show file tree
Hide file tree
Showing 18 changed files with 1,193 additions and 232 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ signaling, and sound. The flight software is hosted on each Astrobee's three int
uses the open-source [Robot Operating System (ROS)](https://www.ros.org/) framework as message-passing
middleware. It provides a high-level [Astrobee Command API](https://nasa.github.io/astrobee/html/command_dictionary.html) for controlling the robot and has multiple operating modes. It can execute a plan (command sequence), individual operator commands (teleoperation), or commands from guest science code running onboard Astrobee.

The Astrobee Robot Software simulator, built using [ROS](https://www.ros.org/) and [Gazebo](http://gazebosim.org/), enables the flight software to be evaluated without the need for robot hardware. The supporting tools include a tool that processes ISS imagery to [build maps for Astrobee localization](https://github.com/nasa/astrobee/tree/master/localization/sparse_mapping), along with many others.
The Astrobee Robot Software simulator, built using [ROS](https://www.ros.org/) and [Gazebo](http://gazebosim.org/), enables the flight software to be evaluated without the need for robot hardware. The supporting tools include a tool that processes ISS imagery to [build maps for Astrobee localization](https://nasa.github.io/astrobee/html/sparsemapping.html), along with many others.

Released separately, the Astrobee ground data system (GDS) includes Astrobee control station software that communicates with Astrobee flight software via the Data Distribution Service (DDS) network protocol over the ISS Ku-IP space-to-ground link. The control station is written primarily in Java using the Eclipse RCP framework. Source code is in the [`astrobee_gds`](https://github.com/nasa/astrobee_gds) repository, or you can download the [binary release](https://software.nasa.gov/software/ARC-17994-1B).

Expand Down
16 changes: 8 additions & 8 deletions astrobee/config/robots/bumble.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ robot_i2c_bus = "/dev/i2c-1"
robot_imu_drdy_pin = 4

robot_geometry = {
hazcam_to_navcam_transform = transform(vec3(0.070656217, -0.0053120391, -0.0086391367), quat4(-0.0033938631, 0.011939978, 0.99990009, -0.0067619677)),
scicam_to_hazcam_transform = transform(vec3(0.043949838, -0.026925687, -0.14459291), quat4(-0.009399956, 0.015955961, 0.99982772, -0.0012581665)),
hazcam_to_navcam_transform = transform(vec3(0.07142937, 0.00058221217, -0.001373669), quat4(-0.0030431141, 0.0092646368, 0.99993195, -0.0064039206)),
scicam_to_hazcam_transform = transform(vec3(-0.0052887445, 0.010298013, -0.043606689), quat4(0.0018545621, 0.012796392, 0.99991616, -0.00069204825)),
navcam_to_hazcam_timestamp_offset = -0.02,
scicam_to_hazcam_timestamp_offset = 0.5,
hazcam_depth_to_image_transform = {
0.91122714, -0.00020224138, -0.00066071236, 0.00091477566,
0.00020680677, 0.91120557, 0.0063030044, -0.0072143461,
0.00065929762, -0.0063031525, 0.91120536, -0.0035329091,
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, 0, 0, 1},

-- Engineering positions with idealized orientations
Expand Down Expand Up @@ -88,10 +88,10 @@ robot_camera_calibrations = {
exposure=150
},
sci_cam = {
distortion_coeff = {0.10733913, -0.10935864, 0.0010663099, 0.0010407278},
distortion_coeff = {0.029948958, -0.056854916, -0.00077885482, -0.0039909885},
intrinsic_matrix = {
1138.4943, 0.0, 680.36447,
0.0, 1138.4943, 534.00133,
1048.499, 0.0, 705.22914,
0.0, 1048.499, 511.03079,
0.0, 0.0, 1.0
},
gain=50,
Expand Down
30 changes: 26 additions & 4 deletions localization/camera/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\page camera Camera Library
\page camera Camera library

This library handles camera calibration parameters and
transformations, providing functions to handle between undistorted and
Expand All @@ -21,6 +21,28 @@ Usage:
undistort_image input_dir/*[0-9].jpg --output_directory output_dir \
--robot_camera nav_cam

Other options, useful with the dense mapper, are --save_bgr,
--undistorted_crop_win, -scale, and --image_list. See
undistort_image.cc for more information.
Options:

--image_list: A file having the list of images to undistort, one per
line. If not specified it is assumed they are passed in directly on
the command line.

--output_directory: Output directory. If not specified, undistorted
images will saved in the same directory as the inputs.

--scale: Undistort images at different resolution, with their width
being a multiple of this scale compared to the camera model. The
default is 1.

--undistorted_crop_win: After undistorting, apply a crop window of
these dimensions centered at the undistorted image center. The
adjusted dimensions and optical center will be printed on screen.
Specify as: 'crop_x crop_y'.

--save_bgr: Save the undistorted images as BGR instead of
grayscale. (Some tools expect BGR.)

--histogram_equalization: If true, do histogram equalization.

--robot_camera: Which of bot's cameras to use. Tested with nav_cam
and sci_cam. The default is nav_cam.
41 changes: 32 additions & 9 deletions localization/camera/tools/undistort_image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,24 @@
separate directory is specified.
*/

DEFINE_string(image_list, "", "The list of images to undistort, one per line. If not specified, "
"it is assumed they are passed in directly on the command line.");
DEFINE_string(image_list, "", "A file having the list of images to undistort, one per line. "
"If not specified, it is assumed they are passed in directly on the command line.");

DEFINE_string(output_directory, "", "If not specified, undistorted images will "
DEFINE_string(output_directory, "", "Output directory. If not specified, undistorted images will "
"saved in the same directory as the inputs.");

DEFINE_string(output_list, "", "Save the undistorted images with names given in this list, "
"instead of using the output directory.");

DEFINE_string(undistorted_intrinsics, "", "Save to this file the undistorted camera intrinsics.");

DEFINE_double(scale, 1.0, "Undistort images at different resolution, with their width "
"being a multiple of this scale compared to the camera model.");

DEFINE_string(undistorted_crop_win, "",
"After undistorting, apply a crop window of these dimensions "
"centered at the undistorted image center. The adjusted "
"dimensions and optical center will be displayed below. "
"dimensions and optical center will be printed on screen. "
"Specify as: 'crop_x crop_y'.");

DEFINE_bool(save_bgr, false,
Expand All @@ -67,7 +72,7 @@ DEFINE_bool(histogram_equalization, false,
"If true, do histogram equalization.");

DEFINE_string(robot_camera, "nav_cam",
"Which of bot's cameras to use. Anything except nav_cam is experimental.");
"Which of bot's cameras to use. Tested with nav_cam and sci_cam.");

int main(int argc, char ** argv) {
ff_common::InitFreeFlyerApplication(&argc, &argv);
Expand All @@ -87,6 +92,18 @@ int main(int argc, char ** argv) {
if (images.empty())
LOG(FATAL) << "Expecting at least one input image.";

std::vector<std::string> undist_images;
if (FLAGS_output_list != "") {
std::ifstream ifs(FLAGS_output_list);
std::string image;
while (ifs >> image)
undist_images.push_back(image);

if (undist_images.size() != images.size())
LOG(FATAL) << "There must be as many output undistorted "
<< "images as input distorted images.\n";
}

// Read the camera
config_reader::ConfigReader config;
config.AddFile("cameras.config");
Expand Down Expand Up @@ -243,7 +260,10 @@ int main(int argc, char ** argv) {

// The output file name
std::string undist_file;
if (!FLAGS_output_directory.empty()) {
if (!undist_images.empty()) {
// Was specified via a list
undist_file = undist_images[i];
} else if (!FLAGS_output_directory.empty()) {
// A separate output directory was specified
undist_file = FLAGS_output_directory + "/" + ff_common::basename(filename);
} else {
Expand Down Expand Up @@ -272,15 +292,18 @@ int main(int argc, char ** argv) {
std::cout << "Focal length: " << focal_length << "\n";
std::cout << "Undistorted optical center: " << optical_center.transpose() << "\n";

if (!FLAGS_output_directory.empty()) {
std::string intrinsics_file = FLAGS_output_directory + "/undistorted_intrinsics.txt";
std::string intrinsics_file = FLAGS_undistorted_intrinsics;
if (intrinsics_file.empty() && !FLAGS_output_directory.empty())
intrinsics_file = FLAGS_output_directory + "/undistorted_intrinsics.txt";

if (!intrinsics_file.empty()) {
std::cout << "Writing: " << intrinsics_file << std::endl;
std::ofstream ofs(intrinsics_file.c_str());
ofs.precision(17);
ofs << "# Unidistored width and height, focal length, undistorted optical center\n";
ofs << undist_size.transpose() << " " << focal_length << " "
<< optical_center.transpose() << "\n";
ofs.close();
std::cout << "Wrote: " << intrinsics_file << std::endl;
}

return 0;
Expand Down
Loading

0 comments on commit ff3287b

Please sign in to comment.