Skip to content

Commit

Permalink
Pano build update (#169)
Browse files Browse the repository at this point in the history
* making spawn changes and adding double handed cargo

* running pano build using the docker images

* fixing function after api change

* add reason for splitting pip commands

* accomodate hugin changing API
  • Loading branch information
marinagmoreira committed Jun 26, 2024
1 parent 597a0d0 commit 9449b49
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
5 changes: 2 additions & 3 deletions dense_map/geometry_mapper/tools/get_depth_data_from_mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char** argv) {
"Directory containing groundtruth poses with timestamps as filenames.")(
"mesh", po::value<std::string>()->required(), "Mesh used to provide depth data.")(
"config-path,c", po::value<std::string>()->required(), "Path to astrobee config directory.")(
"robot-config-file,r", po::value<std::string>(&robot_config_file)->default_value("config/robots/bumble.config"),
"robot-config-file,r", po::value<std::string>(&robot_config_file)->default_value("bumble.config"),
"Robot config file")("world,w", po::value<std::string>(&world)->default_value("iss"), "World name")(
"output-file,o", po::value<std::string>(&output_file)->default_value("depths.csv"),
"Output file containing timestamp, depth, x, y values on each line. Timestamps for which depth data was not "
Expand Down Expand Up @@ -84,7 +84,6 @@ int main(int argc, char** argv) {
const std::string sensor_rays_file = vm["sensor-rays-file"].as<std::string>();
const std::string groundtruth_directory = vm["groundtruth-directory"].as<std::string>();
const std::string mesh_file = vm["mesh"].as<std::string>();
const std::string config_path = vm["config-path"].as<std::string>();

// Only pass program name to free flyer so that boost command line options
// are ignored when parsing gflags.
Expand All @@ -104,7 +103,7 @@ int main(int argc, char** argv) {
LOG(FATAL) << "Mesh " << mesh_file << " not found.";
}

lc::SetEnvironmentConfigs(config_path, world, robot_config_file);
lc::SetEnvironmentConfigs(world, robot_config_file);
config_reader::ConfigReader config;
config.AddFile("geometry.config");
if (!config.ReadFiles()) {
Expand Down
13 changes: 8 additions & 5 deletions pano/docker/pano.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ RUN apt-get update \
hugin \
libvips-tools \
python3-pip \
gfortran libopenblas-dev libfftw3-dev \
&& rm -rf /var/lib/apt/lists/*

# pandas: pulled in as pyshtools dependency but install breaks if not mentioned explicitly (?)
# pyshtools: used during Pannellum multires generation
# snakemake: modern build system based on Python, manages stitching workflows
RUN pip3 install --no-cache-dir --upgrade pip \
&& pip3 install --no-cache-dir \
pandas \
pyshtools \
snakemake

# Install Jupyter explicitly first
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir jupyter

# Install other Python packages: jupyter package needs to be installed before attempting to build pyshtools
RUN pip3 install --no-cache-dir pandas pyshtools snakemake pulp==2.7 --ignore-installed PyYAML

# pannellum: library for viewing/navigating panorama tours
RUN mkdir -p /opt \
Expand Down
7 changes: 4 additions & 3 deletions pano/pano_stitch/scripts/pano_image_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import rosbag
from tf.transformations import euler_from_quaternion

IMAGE_TOPIC = "/hw/cam_sci/compressed"
IMAGE_TOPIC = ["/hw/cam_sci/compressed", "/hw/cam_sci_info"]
POSE_TOPIC = "/loc/pose"
FIELD_NAMES = (
"timestamp",
Expand All @@ -50,8 +50,9 @@ def get_image_meta(inbag_path, num_images=None):
images = []
with rosbag.Bag(inbag_path) as bag:
img_meta = None
for topic, msg, t in bag.read_messages([IMAGE_TOPIC, POSE_TOPIC]):
if topic == IMAGE_TOPIC:
topics = IMAGE_TOPIC + [POSE_TOPIC]
for topic, msg, t in bag.read_messages(topics):
if topic in IMAGE_TOPIC:
if num_images is not None and len(images) == num_images:
break

Expand Down
18 changes: 16 additions & 2 deletions pano/pano_stitch/scripts/stitch_panorama.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,26 @@ def next(self):

def read_pto(pano, pto_path):
print("\nread_pto: %s" % pto_path)
pano.ReadPTOFile(pto_path)
# Accomodate hugin changing API
try:
# Attempt the first method
ifs = hsi.ifstream(pto_path)
pano.readData(ifs)
except AttributeError:
# Fallback to the second method if the first method fails
pano.ReadPTOFile(pto_path)


def write_pto(pano, pto_path):
print("\nwrite_pto: %s" % pto_path)
pano.WritePTOFile(pto_path)
# Accomodate hugin changing API
try:
# Attempt the first method
ofs = hsi.ofstream(pto_path)
pano.writeData(ofs)
except AttributeError:
# Fallback to the second method if the first method fails
pano.WritePTOFile(pto_path)


def get_timestamp():
Expand Down

0 comments on commit 9449b49

Please sign in to comment.