Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved logging #292

Merged
merged 5 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyrobosim/examples/demo_pddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def start_planner(world, args):
# Wait for the GUI to load
while not world.has_gui:
time.sleep(1.0)
time.sleep(0.5) # Extra time for log messages to not interfere with prompt

if args.example == "01_simple":
# Task specification for simple example.
Expand Down
6 changes: 4 additions & 2 deletions pyrobosim/pyrobosim/core/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import copy
import numpy as np
import warnings

from ..utils.logging import get_global_logger
from ..utils.pose import Pose


Expand Down Expand Up @@ -86,7 +86,9 @@ def step(self, cmd_vel, dt, world=None, check_collisions=False):
# Check collisions
if check_collisions:
if world is None:
warnings.warn("Cannot check collisions without a world.")
warn_msg = "Cannot check collisions without a world."
logger = self.robot.logger if self.robot else get_global_logger()
logger.warning(warn_msg)
return

if world.collides_with_robots(
Expand Down
14 changes: 9 additions & 5 deletions pyrobosim/pyrobosim/core/gazebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,16 @@ def export(self, classic=False, out_folder=None):
model_path_env = "GAZEBO_MODEL_PATH"
command = "gazebo"

print(f"\nWorld file saved to {world_file_name}\n")
print(f"Ensure to update your Gazebo model path:")
include_path_str = ":".join(self.include_model_paths)
print(f" export {model_path_env}=${model_path_env}:{include_path_str}\n")
print(f"To start the world, enter")
print(f" {command} {world_file_name}\n")
help_string = f"\nWorld file saved to {world_file_name}\n"
help_string += "Ensure to update your Gazebo model path:\n"
help_string += (
f" export {model_path_env}=${model_path_env}:{include_path_str}\n"
)
help_string += "To start the world, enter:\n"
help_string += f" {command} {world_file_name}\n"
self.world.logger.info(help_string)

return self.out_folder

def create_walls_for_export(self, walls_name="walls"):
Expand Down
Loading
Loading