Skip to content

Commit

Permalink
Tested and working, need some checking with service autostart file. A…
Browse files Browse the repository at this point in the history
…fter that just need to scale upp loging to start loging everything, jsut some repetitive work, thats it. Rest is good, tested and runing :D
  • Loading branch information
RoseKapps committed Mar 3, 2024
1 parent 889a23d commit a85f23c
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 302 deletions.
2 changes: 1 addition & 1 deletion mission/blackbox/blackbox/blackbox_log_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self,
writer.writerow(self.csv_headers)

# Methods for inside use of the class ----------
def manage_csv_files(self, max_file_age_in_days=1, max_size_kb=3_000): #adjust the max size before you start deleting old files (1 000 000 kb = 1 000 mb = 1 gb)
def manage_csv_files(self, max_file_age_in_days=1, max_size_kb=3_000_000): #adjust the max size before you start deleting old files (1 000 000 kb = 1 000 mb = 1 gb)
current_time = datetime.now()
older_than_time = current_time - timedelta(days=max_file_age_in_days)

Expand Down
28 changes: 28 additions & 0 deletions mission/blackbox/blackbox/blackbox_node.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
"""
TODO
From Martynas:
To Rose:
Add data recording for these ROS2 topics:
MOST IMPORTANT:
'/internal/status/bms0',
'/internal/status/bms1',
'/asv/temperature/ESC1',
'/asv/temperature/ESC2',
'/asv/temperature/ESC3',
'/asv/temperature/ESC4',
'/asv/temperature/ambient1',
'/asv/temperature/ambient2',
'/thrust/thruster_forces',
'/pwm',
Nice to have:
'/joy',
'/joystick/joy',
'/thrust/wrench_input',
'/controller/lqr/enable',
'/tf',
'/tf_static'
"""


# ROS2 Libraries
import rclpy
from rclpy.node import Node
Expand Down
12 changes: 12 additions & 0 deletions mission/blackbox/launch/blackbox.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
return LaunchDescription([
Node(
package='blackbox',
namespace='blackbox',
executable='blackbox_node',
name='blackbox_node'
),
])
4 changes: 4 additions & 0 deletions mission/blackbox/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os
from glob import glob
from setuptools import find_packages, setup

package_name = 'blackbox'
Expand All @@ -10,6 +12,8 @@
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),

(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*'))),
],
install_requires=['setuptools'],
zip_safe=True,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[Unit]
Description=Launch recording of ROS 2 data
Description=Launch internal status node
After=network.target

[Service]
# Use the wrapper script for ExecStart
ExecStart=/bin/bash <path-to-home-directory>/<your-worskpace-name>/src/vortex-asv/mission/blackbox/blackbox.sh
ExecStart=/bin/bash <home directory>/<username>/<workspace>/src/vortex-asv/mission/blackbox/startup_scripts/blackbox.sh
WorkingDirectory=/home/vortex/
StandardOutput=journal+console
User=vortex
Expand Down
7 changes: 7 additions & 0 deletions mission/blackbox/startup_scripts/blackbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Determine the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

cd $SCRIPT_DIR
cd ../../../../.. # Go back to workspace
source install/setup.bash
ros2 launch blackbox blackbox.launch.py
1 change: 0 additions & 1 deletion mission/blackbox_backup/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion mission/blackbox_backup/README.md

This file was deleted.

18 changes: 0 additions & 18 deletions mission/blackbox_backup/blackbox.sh

This file was deleted.

149 changes: 0 additions & 149 deletions mission/blackbox_backup/blackbox_startup copy.service

This file was deleted.

130 changes: 0 additions & 130 deletions mission/blackbox_backup/record_data.py

This file was deleted.

0 comments on commit a85f23c

Please sign in to comment.