Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
[percep, ansible] percep upgraded streaming (#1132)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgiger00 authored Jun 1, 2022
1 parent e2e5ddb commit 263edbd
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 64 deletions.

This file was deleted.

10 changes: 10 additions & 0 deletions ansible/roles/base_station_services/files/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Base Station Video Stream %I

[Service]
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/mrover/.Xauthority"
EnvironmentFile=/etc/default/rover.env
User={{ running_user }}
ExecStart=/usr/bin/gst-launch-1.0 -v udpsrc port=%i caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
Restart=always
File renamed without changes.

This file was deleted.

3 changes: 3 additions & 0 deletions ansible/roles/base_station_services/files/rover.env
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
LCM_DEFAULT_URL="udpm://239.255.76.67:7667?ttl=255"
usbcam0=5000
usbcam1=5001
zed=5002
16 changes: 8 additions & 8 deletions ansible/roles/base_station_services/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
dest: "/etc/systemd/system/{{ item }}"
with_items:
- rover-base_station_gui.service
- rover-base_station_gstreamer.service
- rover-base_station_gstreamer_2.service
- [email protected]
- rover-lcm_bridge_server.service
- rover-base_station_kineval.service
- rover-base_station_gstreamer.timer
- rover-base_station_gstreamer_2.timer
- [email protected]

- name: Copy environment variable definitions
copy:
Expand All @@ -29,9 +27,11 @@
systemd: name={{item}} enabled=yes
with_items:
- rover-base_station_gui.service
- rover-base_station_gstreamer.service
- rover-base_station_gstreamer_2.service
- [email protected]
- [email protected]
- [email protected]
- rover-lcm_bridge_server.service
- rover-base_station_kineval.service
- rover-base_station_gstreamer.timer
- rover-base_station_gstreamer_2.timer
- [email protected]
- [email protected]
- [email protected]

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 9 additions & 0 deletions ansible/roles/science_services/files/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Base Station Video Stream %I

[Service]
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/mrover/.Xauthority"
User={{ running_user }}
ExecStart=/usr/bin/gst-launch-1.0 -v udpsrc port=%i caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink
Restart=always
14 changes: 6 additions & 8 deletions ansible/roles/science_services/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
dest: "/etc/systemd/system/{{ item }}"
with_items:
- rover-lcm-bridge-server.service
- rover-science-gstreamer.service
- rover-science-gstreamer-2.service
- rover-science-gstreamer.timer
- rover-science-gstreamer-2.timer
- [email protected]
- [email protected]
- rover-science-gui.service
- rover-science-raman.service

Expand All @@ -23,9 +21,9 @@
systemd: name={{ item }} enabled=yes
with_items:
- rover-lcm-bridge-server.service
- rover-science-gstreamer.service
- rover-science-gstreamer-2.service
- rover-science-gstreamer.timer
- rover-science-gstreamer-2.timer
- rover-science-gstreamer@5000.service
- rover-science-gstreamer@5001.service
- rover-science-gstreamer@5000.timer
- rover-science-gstreamer@5001.timer
- rover-science-gui.service
- rover-science-raman.service
1 change: 1 addition & 0 deletions jetson/percep/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#mesondefine OBS_RECORD
#mesondefine ZED_SDK_PRESENT
#mesondefine PERCEPTION_DEBUG
#mesondefine STREAM_ZED
#mesondefine WRITE_CURR_FRAME_TO_DISK
#mesondefine DEFAULT_ONLINE_DATA_FOLDER

Expand Down
21 changes: 20 additions & 1 deletion jetson/percep/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,20 @@ int main() {
DoubleTrack(&detector.getAlvarParams()->maxErroneousBitsInBorderRate).setup("maxErroneousBitsInBorderRate", "ARUCO Debug", 1);
DoubleTrack(&detector.getAlvarParams()->minOtsuStdDev).setup("minOtsuStdDev", "ARUCO Debug", 20);
DoubleTrack(&detector.getAlvarParams()->errorCorrectionRate).setup("errorCorrectionRate", "ARUCO Debug", 1);

#endif

#if AR_DETECTION && STREAM_ZED
std::string const gstLaunch = "appsrc ! video/x-raw, format=BGR !"
"queue ! videoconvert ! x264enc tune=zerolatency bitrate=500000 speed-preset=superfast !"
"rtph264pay ! udpsink host=10.0.0.1 port=5002";

cv::Size streamSize(256, 144);
cv::VideoWriter writer(gstLaunch, 0, 30, streamSize);
cv::Mat send(streamSize, CV_8UC3);

#endif

/* --- Main Processing Stuff --- */
while (true) {
//Check to see if we were able to grab the frame
Expand All @@ -143,6 +155,7 @@ int main() {
cv::Mat src = cam.image();
cv::Mat depth_img = cam.depth();
cv::Mat xyz_img = cam.xyz();

#endif

#if OBSTACLE_DETECTION
Expand Down Expand Up @@ -170,11 +183,17 @@ int main() {
#if AR_RECORD
cam.record_ar(rgb);
#endif
#if STREAM_ZED
cv::Mat bgr, sendMat;
cv::cvtColor(rgb, bgr, cv::COLOR_RGB2BGR);
cv::resize(bgr, sendMat, streamSize);
writer.write(sendMat);
#endif

detector.updateDetectedTagInfo(arTags, tagPair, depth_img, xyz_img);

#if PERCEPTION_DEBUG && AR_DETECTION
// cv::imshow("depth", depth_img);
cv::imshow("depth", depth_img);
cv::waitKey(1);
#endif

Expand Down
2 changes: 2 additions & 0 deletions jetson/percep/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ obs_record = get_option('obs_record')
perception_debug = get_option('perception_debug')
write_frame = get_option('write_frame')
data_folder = get_option('data_folder')
stream_zed = get_option('stream_zed')

conf_data = configuration_data()
conf_data.set10('AR_DETECTION', ar_detection)
Expand All @@ -74,6 +75,7 @@ conf_data.set10('OBSTACLE_DETECTION', obs_detection)
conf_data.set10('OBSTACLE_RECORD', obs_record)
conf_data.set10('ZED_SDK_PRESENT', with_zed)
conf_data.set10('PERCEPTION_DEBUG', perception_debug)
conf_data.set10('STREAM_ZED', stream_zed)
conf_data.set10('WRITE_CURR_FRAME_TO_DISK', write_frame)
conf_data.set10('VIRTUAL_MACHINE_CONFIG', vm_config)
conf_data.set_quoted('DEFAULT_ONLINE_DATA_FOLDER', data_folder)
Expand Down
3 changes: 2 additions & 1 deletion jetson/percep/meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ option('ar_detection', type: 'boolean', value : true)
option('ar_record', type: 'boolean', value : false)
option('obs_detection', type: 'boolean', value: false)
option('obs_record', type: 'boolean', value : false)
option('stream_zed', type: 'boolean', value: false)
option('with_zed', type: 'boolean', value : true)
option('perception_debug', type: 'boolean', value: true)
option('perception_debug', type: 'boolean', value: false)
option('write_frame', type: 'boolean', value: false)
option('data_folder', type: 'string', value: '/home/jessica/auton_data/')
option('vm_config',type: 'boolean', value: false)
Expand Down

0 comments on commit 263edbd

Please sign in to comment.