Skip to content

Commit

Permalink
Fix online demo and initial online support for ttop (introlab#45)
Browse files Browse the repository at this point in the history
* Updated to new opentera-webrtc API

* updated online-demo

* Added output screen to opentera_client_ros launch file

* Update opentera python dependency

* Update opentera-webrtc

* Fix python38 cmake

* WIP python38

* Revert 9dae308, but not its modifications to the CMakeLists.txt file

* Fix tilde in opentera_client config file not working

* Fix ttop being noetic and not melodic

* WIP docker

* WIP docker

* Added protobuf messages

* Fix relative paths for protoc

* WIP protobuf

* Removed opentera from client requirements

* WIP

* WIP

* WIP sammy

* WIP sammy

* Bump opentera requirement to 1.1.0

* Added opentera-webrtc requirements.txt requirement to README

* Fix problem in yaml rosparam with colon in url

* Updated demo-odas launch file for new echocancel script

* WIP

* WIP

* Fix PR

* Added arguments to demos to launch rviz, false by default

* Fix segfault sometimes in data channel client, maybe

* Update frontend to work on iPad

* Added launchfile output argument and merged common parts of demo and demo-online

* Added back demo.launch to pick dispatch between offline or online based on an argument

* Fix code review elements

* Removed useless linking with opentera_webrtc for json_data_handler

* Compatibility with new echocancel script in odas_ros

* Fix launch files

* Fix receive_video_stream for secondary video streamers

* Removed pip install when starting signaling server, and moved back error fetching ice servers as an error and not a warning

Co-authored-by: Dominic Letourneau <[email protected]>
Co-authored-by: Your Name <[email protected]>
  • Loading branch information
3 people authored Apr 11, 2022
1 parent b11d371 commit 76efd39
Show file tree
Hide file tree
Showing 32 changed files with 593 additions and 266 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "opentera-webrtc-demos/opentera-webrtc-teleop-frontend"]
path = opentera_webrtc_demos/opentera-webrtc-teleop-frontend
url = ../opentera-webrtc-teleop-frontend.git
[submodule "opentera_protobuf_messages/opentera_messages"]
path = opentera_protobuf_messages/opentera_messages
url = https://github.com/introlab/opentera_messages.git
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ The procedure is written for Ubuntu 20.04 using ROS noetic. We assume ROS is alr
# opentera-webrtc-ros packages
sudo apt-get install nodejs ros-noetic-turtlebot3 ros-noetic-turtlebot3-gazebo ros-noetic-dwa-local-planner ros-noetic-rtabmap-ros

# protobuf
sudo apt-get install libprotobuf-dev protobuf-compiler python3-protobuf

# python dependencies
sudo apt-get install python3-pip portaudio19-dev

Expand All @@ -30,6 +33,9 @@ sudo apt-get install build-essential gfortran texinfo libasound2-dev

# odas_ros packages
sudo apt-get install libfftw3-dev libconfig-dev libasound2-dev pulseaudio libpulse-dev

# opentera-webrtc Python packages
python3 -m pip install -r opentera_webrtc_ros/opentera-webrtc/requirements.txt
```

# Installation
Expand Down
3 changes: 2 additions & 1 deletion map_image_generator/launch/map_image_generator.launch
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<arg name="output_map_image_labels_topic" default="/map_image_generator/labels"/>

<arg name="rtabmap_list_label_service" default="/rtabmap/list_labels"/>
<arg name="output" default="log"/>

<arg name="refresh_rate_param" default="1.0"/>
<arg name="resolution_param" default="40"/>
Expand All @@ -30,7 +31,7 @@
<arg name="robot_vertical_offset" default="180"/>


<node name="map_image_generator" pkg="map_image_generator" type="map_image_generator" respawn="true" output="screen">
<node name="map_image_generator" pkg="map_image_generator" type="map_image_generator" respawn="true" output="$(arg output)">
<remap from="occupancy_grid" to="$(arg input_occupancy_grid_topic)"/>
<remap from="global_path" to="$(arg input_global_path_topic)"/>
<remap from="input_goal" to="$(arg input_goal_topic)"/>
Expand Down
1 change: 1 addition & 0 deletions opentera_client_ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ find_package(catkin REQUIRED COMPONENTS
std_msgs
message_runtime
opentera_webrtc_ros_msgs
opentera_protobuf_messages
)

## System dependencies are found with CMake's conventions
Expand Down
4 changes: 3 additions & 1 deletion opentera_client_ros/launch/client.launch
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<launch>
<arg name="opentera_client_config_file" default="$(find opentera_client_ros)/config/client_config.json"/>

<arg name="output" default="log"/>

<!-- OpenTera ROS Client -->
<node pkg="opentera_client_ros" type="opentera_client_ros.py" name="opentera_client" respawn="true">
<node pkg="opentera_client_ros" type="opentera_client_ros.py" name="opentera_client" respawn="true" output="$(arg output)">
<param name="config_file" type="string" value="$(arg opentera_client_config_file)"/>
</node>
</launch>
3 changes: 3 additions & 0 deletions opentera_client_ros/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>opentera_webrtc_ros_msgs</build_depend>
<build_depend>opentera_protobuf_messages</build_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<build_export_depend>opentera_webrtc_ros_msgs</build_export_depend>
<build_export_depend>opentera_protobuf_messages</build_export_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>opentera_webrtc_ros_msgs</exec_depend>
<exec_depend>opentera_protobuf_messages</exec_depend>

<!-- The export tag contains other, unspecified, tags -->
<export>
Expand Down
1 change: 0 additions & 1 deletion opentera_client_ros/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
opentera==1.0.8
aiohttp
asyncio
16 changes: 13 additions & 3 deletions opentera_client_ros/scripts/opentera_client_ros.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json
import os
from signal import SIGINT, SIGTERM
from pathlib import Path

# ROS
import rospy
Expand All @@ -24,7 +25,7 @@
from opentera_webrtc_ros_msgs.msg import RobotStatus

# OpenTera
import opentera.messages.python as messages
import opentera_protobuf_messages as messages
from google.protobuf.json_format import ParseDict, ParseError
from google.protobuf.json_format import MessageToJson

Expand Down Expand Up @@ -156,6 +157,7 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
event.device_name = device_event.device_name
event.device_status = device_event.device_status
opentera_events.device_events.append(event)
continue

# Test for JoinSessionEvent
join_session_event = messages.JoinSessionEvent()
Expand All @@ -172,6 +174,7 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
event.session_parameters = join_session_event.session_parameters
event.service_uuid = join_session_event.service_uuid
opentera_events.join_session_events.append(event)
continue

# Test for ParticipantEvent
participant_event = messages.ParticipantEvent()
Expand All @@ -184,6 +187,7 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
event.participant_project_name = participant_event.participant_project_name
event.participant_site_name = participant_event.participant_site_name
opentera_events.participant_events.append(event)
continue

# Test for StopSessionEvent
stop_session_event = messages.StopSessionEvent()
Expand All @@ -193,6 +197,7 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
event.session_uuid = stop_session_event.session_uuid
event.service_uuid = stop_session_event.service_uuid
opentera_events.stop_session_events.append(event)
continue

# Test for UserEvent
user_event = messages.UserEvent()
Expand All @@ -203,6 +208,7 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
event.type = user_event.type
event.user_fullname = user_event.user_fullname
opentera_events.user_events.append(event)
continue

# Test for LeaveSessionEvent
leave_session_event = messages.LeaveSessionEvent()
Expand All @@ -215,6 +221,7 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
event.leaving_users = leave_session_event.leaving_users
event.leaving_devices = leave_session_event.leaving_devices
opentera_events.leave_session_events.append(event)
continue

# Test for JoinSessionReply
join_session_reply = messages.JoinSessionReplyEvent()
Expand All @@ -228,8 +235,10 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
event.join_reply = join_session_reply.join_reply
event.reply_msg = join_session_reply.reply_msg
opentera_events.join_session_reply_events.append(event)
continue

# TODO Handle other events if required.
rospy.logerr(f"Unknown message type: {any_msg}")

self.__event_publisher.publish(opentera_events)

Expand All @@ -246,11 +255,12 @@ async def _parse_message(self, client: aiohttp.ClientSession, msg_dict: dict):
# Guessing config file path
base_folder = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(base_folder, '../config/client_config.json')
config_file_name = rospy.get_param('~config_file', config_path)
config_file_name = Path(rospy.get_param(
'~config_file', config_path)).expanduser().resolve()

# Read config file
# Should be a param for this node
with open(config_file_name) as json_file:
with config_file_name.open() as json_file:
data = json.load(json_file)
if 'url' in data and 'client_token' in data:
url = data['url']
Expand Down
2 changes: 2 additions & 0 deletions opentera_protobuf_messages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/opentera_protobuf_messages/__init__.py
src/opentera_protobuf_messages/*_pb2.py
Loading

0 comments on commit 76efd39

Please sign in to comment.