Skip to content

Commit

Permalink
add gdrive_recorder package
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Apr 2, 2023
1 parent 9a9890c commit e94f205
Show file tree
Hide file tree
Showing 27 changed files with 865 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gdrive_recorder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.0.2)
project(gdrive_recorder)

find_package(catkin REQUIRED)

catkin_package()

include_directories()
121 changes: 121 additions & 0 deletions gdrive_recorder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# gdrive_recorder

Long-term video logging with Google Drive

## Description

This packages is for logging image and audio topic in video format and uploading it to Google drive.

This package uses audio_video_recorder, influxdb and gdrive_ros.

## Sample

### Systemd

```bash
roscd gdrive_recorder
sudo cp systemd/*.service /etc/systemd/system
sudo systemctl daemon-reload
rosrun gdrive_recorder start_all_services.bash
```

### Launch

#### PR1040

```bash
rossetip
rossetmaster pr1040
roslaunch gdrive_recorder pr1040_gdrive_recorder.launch
```

#### Fetch15

```bash
rossetip
rossetmaster fetch15
roslaunch gdrive_recorder fetch15_gdrive_recorder.launch
```

#### Fetch1075

```bash
rossetip
rossetmaster fetch1075
roslaunch gdrive_recorder fetch1075_gdrive_recorder.launch
```

### Scripts

#### Systemd

```bash
# start
rosrun gdrive_recorder start_all_services.bash
# reload
rosrun gdrive_recorder reload_all_services.bash
# stop
rosrun gdrive_recorder stop_all_services.bash
```

## Node

### gdrive_recorder.py

#### Parameters

- `~robot_type`: (`String`, default: `pr2`)

robot type

- `~robot_name`: (`String`, default: `pr2`)

robot name

- `~timezone`: (`String`, default: `UTC`)

timezone

- `~gdrive_server_name`: (`String`, default: `gdrive_record_server`)

gdrive_ros upload server name

- `~upload_parents_path`: (`String`, default: `{robot_name}_recorder`)

gdrive_ros upload parents path

- `~video_path`: (`String`, default: `/tmp`)

temporary video saving directory

- `video_topic_name`: (`String`, default: `None`)

video topic name. this is for checking whether video topic is available or not.

- `record_duration`: (`Int`, default: `60*20`)

maximum recording duration into one video file

- `upload_duration`: (`Int`, default: `60*20`)

uploading interval

- `decompress_monitor_duration`: (`Int`, default: `10`)

monitoring decompress launch duration

- `store_url`: (`Bool`, default: `true`)

Store gdrive_ros upload parents path in InfluxDB or not

- `host`: (`String`, default: `localhost`)

InfluxDB host name

- `port`: (`Int`, default: `8086`)

InfluxDB port number

- `database`: (`String`, default: `test`)

InfluxDB database name
36 changes: 36 additions & 0 deletions gdrive_recorder/launch/fetch_audio_video_recorder.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<launch>
<!-- start: arguments -->
<arg name="video_path" />
<arg name="video_title" />
<!-- end: arguments -->

<arg name="audio_topic_name" default="/audio" />
<arg name="audio_channels" default="1" />
<arg name="audio_sample_rate" default="16000" />
<arg name="audio_format" default="wave" />
<arg name="audio_sample_format" default="S16LE" />
<arg name="video_topic_name" default="/head_camera_fetch_recorder/rgb/image_rect_color" />
<arg name="video_height" default="480" />
<arg name="video_width" default="640" />
<arg name="video_framerate" default="30" />
<arg name="video_encoding" default="RGB" />

<node name="$(anon audio_video_recorder)" pkg="audio_video_recorder"
type="audio_video_recorder" output="screen">
<remap from="~input/audio" to="$(arg audio_topic_name)" />
<remap from="~input/image" to="$(arg video_topic_name)" />
<rosparam subst_value="true">
queue_size: 100
file_name: $(arg video_path)/$(arg video_title)
file_format: avi
audio_channels: $(arg audio_channels)
audio_sample_rate: $(arg audio_sample_rate)
audio_format: $(arg audio_format)
audio_sample_format: $(arg audio_sample_format)
video_height: $(arg video_height)
video_width: $(arg video_width)
video_framerate: $(arg video_framerate)
video_encoding: $(arg video_encoding)
</rosparam>
</node>
</launch>
10 changes: 10 additions & 0 deletions gdrive_recorder/launch/fetch_decompress.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<launch>
<arg name="compressed_video_topic_name" default="/head_camera/rgb/image_rect_color" />
<arg name="video_topic_name" default="/head_camera_fetch_recorder/rgb/image_rect_color" />

<group ns="head_camera_fetch_recorder">
<node name="rgb_image_transport" pkg="image_transport" type="republish" respawn="false"
args="compressed in:=$(arg compressed_video_topic_name)
raw out:=$(arg video_topic_name)" />
</group>
</launch>
10 changes: 10 additions & 0 deletions gdrive_recorder/launch/fetch_gdrive_recorder.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<launch>
<arg name="robot_name" />
<arg name="video_topic_name" default="/head_camera_fetch_recorder/rgb/image_rect_color" />

<include file="$(find gdrive_recorder)/launch/gdrive_recorder.launch">
<arg name="robot_name" value="$(arg robot_name)" />
<arg name="robot_type" value="fetch" />
<arg name="video_topic_name" value="$(arg video_topic_name)" />
</include>
</launch>
16 changes: 16 additions & 0 deletions gdrive_recorder/launch/gdrive_recorder.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<launch>

<arg name="robot_type" />
<arg name="robot_name" />
<arg name="video_topic_name" />

<arg name="timezone" default="Asia/Tokyo" />
<arg name="video_path" default="/mnt/hdd1/data/gdrive_recorder/$(arg robot_name)_recorder" />

<node name="gdrive_recorder" pkg="jsk_tools" type="roscore_regardless.py"
args="--respawn --timeout 1 --ping-trials 1 --sigint-timeout 5 --sigterm-timeout 5
rosrun gdrive_recorder gdrive_recorder.py
_video_path:=$(arg video_path) _video_topic_name:=$(arg video_topic_name)
_database:=$(arg robot_name) _timezone:=Asia/Tokyo
_robot_type:=$(arg robot_type) _robot_name:=$(arg robot_name)" />
</launch>
36 changes: 36 additions & 0 deletions gdrive_recorder/launch/pr2_audio_video_recorder.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<launch>
<!-- start: arguments -->
<arg name="video_path" />
<arg name="video_title" />
<!-- end: arguments -->

<arg name="audio_topic_name" default="/audio" />
<arg name="audio_channels" default="1" />
<arg name="audio_sample_rate" default="16000" />
<arg name="audio_format" default="wave" />
<arg name="audio_sample_format" default="S16LE" />
<arg name="video_topic_name" default="/kinect_head_pr2_recorder/rgb/image_rect_color" />
<arg name="video_height" default="480" />
<arg name="video_width" default="640" />
<arg name="video_framerate" default="30" />
<arg name="video_encoding" default="BGR" />

<node name="$(anon audio_video_recorder)" pkg="audio_video_recorder"
type="audio_video_recorder" output="screen">
<remap from="~input/audio" to="$(arg audio_topic_name)" />
<remap from="~input/image" to="$(arg video_topic_name)" />
<rosparam subst_value="true">
queue_size: 100
file_name: $(arg video_path)/$(arg video_title)
file_format: avi
audio_channels: $(arg audio_channels)
audio_sample_rate: $(arg audio_sample_rate)
audio_format: $(arg audio_format)
audio_sample_format: $(arg audio_sample_format)
video_height: $(arg video_height)
video_width: $(arg video_width)
video_framerate: $(arg video_framerate)
video_encoding: $(arg video_encoding)
</rosparam>
</node>
</launch>
10 changes: 10 additions & 0 deletions gdrive_recorder/launch/pr2_decompress.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<launch>
<arg name="compressed_video_topic_name" default="/kinect_head/rgb/image_rect_color" />
<arg name="video_topic_name" default="/kinect_head_pr2_recorder/rgb/image_rect_color" />

<group ns="kinect_head_pr2_recorder">
<node name="rgb_image_transport" pkg="image_transport" type="republish" respawn="false"
args="compressed in:=$(arg compressed_video_topic_name)
raw out:=$(arg video_topic_name)" />
</group>
</launch>
10 changes: 10 additions & 0 deletions gdrive_recorder/launch/pr2_gdrive_recorder.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<launch>
<arg name="robot_name" />
<arg name="video_topic_name" default="/kinect_head_pr2_recorder/rgb/image_rect_color" />

<include file="$(find gdrive_recorder)/launch/gdrive_recorder.launch">
<arg name="robot_name" value="$(arg robot_name)" />
<arg name="robot_type" value="pr2" />
<arg name="video_topic_name" value="$(arg video_topic_name)" />
</include>
</launch>
Loading

0 comments on commit e94f205

Please sign in to comment.