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

fix logging #63

Merged
merged 2 commits into from
Jul 30, 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 .github/workflows/catkin_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
# 1. Install basic requirements
- run: apt-get update && apt-get install -y git
- run: if [[ "$ROS_DISTRO" = "noetic" ]] ; then apt-get install -y python3-pip ros-noetic-catkin python3-catkin-tools ; fi
- run: pip install setuptools==68.0.0 importlib-metadata==8.2.0 # hack because there is an issue on >=71.0.0 https://github.com/pypa/setuptools/issues/4478

# 2. Checkout repo with submodules
- uses: actions/checkout@v2
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ WORKDIR /catkin_ws/src/uav_hitl_simulator
# 1. Install basic requirements
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git ros-$ROS_DISTRO-catkin python3-pip python3-catkin-tools
apt-get install -y git ros-$ROS_DISTRO-catkin python3-pip

# hack because there is an issue on >=71.0.0 https://github.com/pypa/setuptools/issues/4478
RUN pip install setuptools==68.0.0 importlib-metadata==8.2.0
RUN apt-get install -y python3-catkin-tools

RUN if [[ "$ROS_DISTRO" = "melodic" ]] ; then apt-get install -y python-pip python-catkin-tools ; fi

# 2. Install requirements
Expand Down
5 changes: 4 additions & 1 deletion scripts/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import logging
import datetime
from typing import Optional
from pathlib import Path

from argparse import ArgumentParser, RawTextHelpFormatter
from configurator import configure
Expand All @@ -30,7 +31,8 @@
VEHICLES_DIR = os.path.join(REPO_DIR, "configs", "vehicles")
BINARY_OUTPUT_PATH = os.path.join(REPO_DIR, "firmware.bin")
LOG_FILENAME = f"log_{datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.log"
LOG_PATH = os.path.join(REPO_DIR, "logs", LOG_FILENAME)
LOGS_DIR = os.path.join(REPO_DIR, "logs")
LOG_PATH = os.path.join(LOGS_DIR, LOG_FILENAME)

COMMANDS = [
SimCommand(name="build", alias='b', mode=None, info="Build the Docker image"),
Expand Down Expand Up @@ -107,6 +109,7 @@ def process(self, command: Optional[str]) -> None:


def main():
Path(LOGS_DIR).mkdir(parents=True, exist_ok=True)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
filename=LOG_PATH,
Expand Down
Loading