From 76efd391e70d9a345420f4646f3ef88d31d5c70c Mon Sep 17 00:00:00 2001 From: philippewarren <55722645+philippewarren@users.noreply.github.com> Date: Mon, 11 Apr 2022 16:56:30 -0400 Subject: [PATCH] Fix online demo and initial online support for ttop (#45) * 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 9dae3080b947d8785dafff4480efcfe0b2c5b07a, 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 Co-authored-by: Your Name --- .gitmodules | 3 + README.md | 6 + .../launch/map_image_generator.launch | 3 +- opentera_client_ros/CMakeLists.txt | 1 + opentera_client_ros/launch/client.launch | 4 +- opentera_client_ros/package.xml | 3 + opentera_client_ros/requirements.txt | 1 - .../scripts/opentera_client_ros.py | 16 +- opentera_protobuf_messages/.gitignore | 2 + opentera_protobuf_messages/CMakeLists.txt | 241 ++++++++++++++++++ opentera_protobuf_messages/opentera_messages | 1 + opentera_protobuf_messages/package.xml | 58 +++++ opentera_protobuf_messages/setup.py | 11 + opentera_webrtc_demos/launch/demo-dev.launch | 1 + .../launch/demo-loopback.launch | 4 + opentera_webrtc_demos/launch/demo-odas.launch | 20 +- .../launch/demo-offline.launch | 32 +++ .../launch/demo-online.launch | 149 ++--------- opentera_webrtc_demos/launch/demo.launch | 110 ++------ .../launch/opentera_demo.launch | 110 ++++++++ .../launch/opentera_signaling_server.launch | 8 +- .../launch/opentera_turtlebot_sim.launch | 6 +- .../opentera-webrtc-teleop-frontend | 2 +- .../scripts/start_signaling_server.sh | 2 +- .../scripts/start_signaling_server_tls.sh | 2 +- opentera_webrtc_ros/CMakeLists.txt | 38 ++- .../launch/opentera_data_test.launch | 2 +- .../launch/ros_data_channel_client.launch | 6 +- .../launch/ros_json_data_handler.launch | 4 +- .../launch/ros_stream_client.launch | 6 +- opentera_webrtc_ros/opentera-webrtc | 2 +- .../src/RosDataChannelBridge.cpp | 5 +- 32 files changed, 593 insertions(+), 266 deletions(-) create mode 100644 opentera_protobuf_messages/.gitignore create mode 100644 opentera_protobuf_messages/CMakeLists.txt create mode 160000 opentera_protobuf_messages/opentera_messages create mode 100644 opentera_protobuf_messages/package.xml create mode 100644 opentera_protobuf_messages/setup.py create mode 100644 opentera_webrtc_demos/launch/demo-offline.launch create mode 100644 opentera_webrtc_demos/launch/opentera_demo.launch diff --git a/.gitmodules b/.gitmodules index f0796b5..a82a587 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/README.md b/README.md index a67798d..b9b6476 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/map_image_generator/launch/map_image_generator.launch b/map_image_generator/launch/map_image_generator.launch index be66541..7e61ad0 100644 --- a/map_image_generator/launch/map_image_generator.launch +++ b/map_image_generator/launch/map_image_generator.launch @@ -13,6 +13,7 @@ + @@ -30,7 +31,7 @@ - + diff --git a/opentera_client_ros/CMakeLists.txt b/opentera_client_ros/CMakeLists.txt index 315edd0..89bb247 100644 --- a/opentera_client_ros/CMakeLists.txt +++ b/opentera_client_ros/CMakeLists.txt @@ -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 diff --git a/opentera_client_ros/launch/client.launch b/opentera_client_ros/launch/client.launch index 37f7cce..6aa86dc 100644 --- a/opentera_client_ros/launch/client.launch +++ b/opentera_client_ros/launch/client.launch @@ -1,8 +1,10 @@ + + - + diff --git a/opentera_client_ros/package.xml b/opentera_client_ros/package.xml index c43837a..c7c5668 100644 --- a/opentera_client_ros/package.xml +++ b/opentera_client_ros/package.xml @@ -53,12 +53,15 @@ rospy std_msgs opentera_webrtc_ros_msgs + opentera_protobuf_messages rospy std_msgs opentera_webrtc_ros_msgs + opentera_protobuf_messages rospy std_msgs opentera_webrtc_ros_msgs + opentera_protobuf_messages diff --git a/opentera_client_ros/requirements.txt b/opentera_client_ros/requirements.txt index ff6e700..97c7886 100644 --- a/opentera_client_ros/requirements.txt +++ b/opentera_client_ros/requirements.txt @@ -1,3 +1,2 @@ -opentera==1.0.8 aiohttp asyncio diff --git a/opentera_client_ros/scripts/opentera_client_ros.py b/opentera_client_ros/scripts/opentera_client_ros.py index 03b1046..6ccbfe3 100755 --- a/opentera_client_ros/scripts/opentera_client_ros.py +++ b/opentera_client_ros/scripts/opentera_client_ros.py @@ -7,6 +7,7 @@ import json import os from signal import SIGINT, SIGTERM +from pathlib import Path # ROS import rospy @@ -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 @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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) @@ -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'] diff --git a/opentera_protobuf_messages/.gitignore b/opentera_protobuf_messages/.gitignore new file mode 100644 index 0000000..7131947 --- /dev/null +++ b/opentera_protobuf_messages/.gitignore @@ -0,0 +1,2 @@ +src/opentera_protobuf_messages/__init__.py +src/opentera_protobuf_messages/*_pb2.py diff --git a/opentera_protobuf_messages/CMakeLists.txt b/opentera_protobuf_messages/CMakeLists.txt new file mode 100644 index 0000000..a0628ff --- /dev/null +++ b/opentera_protobuf_messages/CMakeLists.txt @@ -0,0 +1,241 @@ +cmake_minimum_required(VERSION 3.16) +project(opentera_protobuf_messages) + +## Compile as C++11, supported in ROS Kinetic and newer +# add_compile_options(-std=c++11) + +## Find catkin macros and libraries +## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) +## is used, also find other catkin packages +find_package(catkin REQUIRED) + +## System dependencies are found with CMake's conventions +# find_package(Boost REQUIRED COMPONENTS system) + +find_package(Protobuf REQUIRED COMPONENTS protobuf_messages protoc) + +set(PROTOBUF_INPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/opentera_messages/proto) +set(PROTOBUF_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/opentera_protobuf_messages) +set(GOOGLE_PROTO_PATH ${Protobuf_INCLUDE_DIR}/google/protobuf) +set(PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE}) + +# Need to be done before the call to catkin_python_setup +file(COPY + ${CMAKE_CURRENT_SOURCE_DIR}/opentera_messages/python/__init__.py + DESTINATION ${PROTOBUF_OUTPUT_PATH} +) + +## Uncomment this if the package has a setup.py. This macro ensures +## modules and global scripts declared therein get installed +## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html +catkin_python_setup() + +################################################ +## Declare ROS messages, services and actions ## +################################################ + +## To declare and build messages, services or actions from within this +## package, follow these steps: +## * Let MSG_DEP_SET be the set of packages whose message types you use in +## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). +## * In the file package.xml: +## * add a build_depend tag for "message_generation" +## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET +## * If MSG_DEP_SET isn't empty the following dependency has been pulled in +## but can be declared for certainty nonetheless: +## * add a exec_depend tag for "message_runtime" +## * In this file (CMakeLists.txt): +## * add "message_generation" and every package in MSG_DEP_SET to +## find_package(catkin REQUIRED COMPONENTS ...) +## * add "message_runtime" and every package in MSG_DEP_SET to +## catkin_package(CATKIN_DEPENDS ...) +## * uncomment the add_*_files sections below as needed +## and list every .msg/.srv/.action file to be processed +## * uncomment the generate_messages entry below +## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) + +## Generate messages in the 'msg' folder +# add_message_files( +# FILES +# Message1.msg +# Message2.msg +# ) + +## Generate services in the 'srv' folder +# add_service_files( +# FILES +# Service1.srv +# Service2.srv +# ) + +## Generate actions in the 'action' folder +# add_action_files( +# FILES +# Action1.action +# Action2.action +# ) + +## Generate added messages and services with any dependencies listed here +# generate_messages( +# DEPENDENCIES +# geometry_msgs# nav_msgs# sensor_msgs# std_msgs +# ) + +################################################ +## Declare ROS dynamic reconfigure parameters ## +################################################ + +## To declare and build dynamic reconfigure parameters within this +## package, follow these steps: +## * In the file package.xml: +## * add a build_depend and a exec_depend tag for "dynamic_reconfigure" +## * In this file (CMakeLists.txt): +## * add "dynamic_reconfigure" to +## find_package(catkin REQUIRED COMPONENTS ...) +## * uncomment the "generate_dynamic_reconfigure_options" section below +## and list every .cfg file to be processed + +## Generate dynamic reconfigure parameters in the 'cfg' folder +# generate_dynamic_reconfigure_options( +# cfg/DynReconf1.cfg +# cfg/DynReconf2.cfg +# ) + +################################### +## catkin specific configuration ## +################################### +## The catkin_package macro generates cmake config files for your package +## Declare things to be passed to dependent projects +## INCLUDE_DIRS: uncomment this if your package contains header files +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need +catkin_package( + # INCLUDE_DIRS include + # LIBRARIES t_top + # CATKIN_DEPENDS geometry_msgs nav_msgs rospy sensor_msgs std_msgs tf + # DEPENDS system_lib +) + +########### +## Build ## +########### + +## Specify additional locations of header files +## Your package locations should be listed before other locations +include_directories( + # include + ${catkin_INCLUDE_DIRS} +) + +## Declare a C++ library +# add_library(${PROJECT_NAME} +# src/${PROJECT_NAME}/t_top.cpp +# ) + +## Add cmake target dependencies of the library +## as an example, code may need to be generated before libraries +## either from message generation or dynamic reconfigure +# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + +## Declare a C++ executable +## With catkin_make all packages are built within a single CMake context +## The recommended prefix ensures that target names across packages don't collide +# add_executable(${PROJECT_NAME}_node src/t_top_node.cpp) + +## Rename C++ executable without prefix +## The above recommended prefix causes long target names, the following renames the +## target back to the shorter version for ease of user use +## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" +# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") + +## Add cmake target dependencies of the executable +## same as for the library above +# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) + +## Specify libraries to link a library or executable target against +# target_link_libraries(${PROJECT_NAME}_node +# ${catkin_LIBRARIES} +# ) + +FILE(GLOB_RECURSE protofiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${PROTOBUF_INPUT_PATH}/*.proto") + +set(protobuf_python_targets) + +foreach(file ${protofiles}) + message(STATUS "Protobuf: processing ${file}") + get_filename_component (name_without_extension ${file} NAME_WE) + #Add command to generate target + set(outfile ${PROTOBUF_OUTPUT_PATH}/${name_without_extension}_pb2.py) + add_custom_command( + OUTPUT ${outfile} + DEPENDS ${file} + COMMAND ${PROTOC_EXECUTABLE} ${file} -I=opentera_messages/proto -I${GOOGLE_PROTO_PATH} --python_out ${PROTOBUF_OUTPUT_PATH} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + ) + #Add target + set(output_target opentera_messages_${name_without_extension}.proto.target) + list(APPEND protobuf_python_targets ${output_target}) + add_custom_target( + ${output_target} + DEPENDS ${outfile} + VERBATIM + ) +endforeach(file) + +add_custom_target(python-messages ALL DEPENDS ${protobuf_python_targets}) + +############# +## Install ## +############# + +# all install targets should use catkin DESTINATION variables +# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html + +## Mark executable scripts (Python etc.) for installation +## in contrast to setup.py, you can choose the destination +# catkin_install_python(PROGRAMS +# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +# ) + +## Mark executables for installation +## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html +# install(TARGETS ${PROJECT_NAME}_node +# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} +# ) + +## Mark libraries for installation +## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html +# install(TARGETS ${PROJECT_NAME} +# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} +# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} +# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} +# ) + +## Mark cpp header files for installation +# install(DIRECTORY include/${PROJECT_NAME}/ +# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} +# FILES_MATCHING PATTERN "*.h" +# PATTERN ".svn" EXCLUDE +# ) + +## Mark other files for installation (e.g. launch and bag files, etc.) +# install(FILES +# # myfile1 +# # myfile2 +# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} +# ) + +############# +## Testing ## +############# + +## Add gtest based cpp test target and link libraries +# catkin_add_gtest(${PROJECT_NAME}-test test/test_t_top.cpp) +# if(TARGET ${PROJECT_NAME}-test) +# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) +# endif() + +## Add folders to be run by python nosetests +# catkin_add_nosetests(test) diff --git a/opentera_protobuf_messages/opentera_messages b/opentera_protobuf_messages/opentera_messages new file mode 160000 index 0000000..4c67e7c --- /dev/null +++ b/opentera_protobuf_messages/opentera_messages @@ -0,0 +1 @@ +Subproject commit 4c67e7ca0224b0e762e78018c639ba2fcb5fb44f diff --git a/opentera_protobuf_messages/package.xml b/opentera_protobuf_messages/package.xml new file mode 100644 index 0000000..20ee907 --- /dev/null +++ b/opentera_protobuf_messages/package.xml @@ -0,0 +1,58 @@ + + + opentera_protobuf_messages + 0.0.0 + The opentera_protobuf_messages package + + + + + Dominic Létourneau + + + + + Apache-2.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + catkin + python3-protobuf + + + + + + + diff --git a/opentera_protobuf_messages/setup.py b/opentera_protobuf_messages/setup.py new file mode 100644 index 0000000..3c4938d --- /dev/null +++ b/opentera_protobuf_messages/setup.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from setuptools import setup +from catkin_pkg.python_setup import generate_distutils_setup + +d = generate_distutils_setup( + packages=['opentera_protobuf_messages'], + package_dir={'': 'src'}, +) + +setup(**d) diff --git a/opentera_webrtc_demos/launch/demo-dev.launch b/opentera_webrtc_demos/launch/demo-dev.launch index 241e284..8adfe7e 100644 --- a/opentera_webrtc_demos/launch/demo-dev.launch +++ b/opentera_webrtc_demos/launch/demo-dev.launch @@ -8,6 +8,7 @@ + diff --git a/opentera_webrtc_demos/launch/demo-loopback.launch b/opentera_webrtc_demos/launch/demo-loopback.launch index 45fa76a..845758f 100644 --- a/opentera_webrtc_demos/launch/demo-loopback.launch +++ b/opentera_webrtc_demos/launch/demo-loopback.launch @@ -4,10 +4,13 @@ + + + @@ -19,6 +22,7 @@ + diff --git a/opentera_webrtc_demos/launch/demo-odas.launch b/opentera_webrtc_demos/launch/demo-odas.launch index b54354b..306ae70 100644 --- a/opentera_webrtc_demos/launch/demo-odas.launch +++ b/opentera_webrtc_demos/launch/demo-odas.launch @@ -6,16 +6,22 @@ + + + + - - + + + + @@ -27,22 +33,26 @@ + + + - + - - + + + diff --git a/opentera_webrtc_demos/launch/demo-offline.launch b/opentera_webrtc_demos/launch/demo-offline.launch new file mode 100644 index 0000000..4cc43e9 --- /dev/null +++ b/opentera_webrtc_demos/launch/demo-offline.launch @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opentera_webrtc_demos/launch/demo-online.launch b/opentera_webrtc_demos/launch/demo-online.launch index cbd7cee..83a13be 100644 --- a/opentera_webrtc_demos/launch/demo-online.launch +++ b/opentera_webrtc_demos/launch/demo-online.launch @@ -1,142 +1,31 @@ - + - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opentera_webrtc_demos/launch/demo.launch b/opentera_webrtc_demos/launch/demo.launch index ac78421..6e04211 100644 --- a/opentera_webrtc_demos/launch/demo.launch +++ b/opentera_webrtc_demos/launch/demo.launch @@ -5,101 +5,33 @@ + + - - - - - - - - - - + - - - - - + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - diff --git a/opentera_webrtc_demos/launch/opentera_demo.launch b/opentera_webrtc_demos/launch/opentera_demo.launch new file mode 100644 index 0000000..cf2136b --- /dev/null +++ b/opentera_webrtc_demos/launch/opentera_demo.launch @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opentera_webrtc_demos/launch/opentera_signaling_server.launch b/opentera_webrtc_demos/launch/opentera_signaling_server.launch index a798bdc..d795b12 100644 --- a/opentera_webrtc_demos/launch/opentera_signaling_server.launch +++ b/opentera_webrtc_demos/launch/opentera_signaling_server.launch @@ -5,7 +5,7 @@ - + @@ -13,16 +13,18 @@ + + + name="opentera_signaling_server" output="$(arg output)"> + name="opentera_signaling_server" output="$(arg output)"> diff --git a/opentera_webrtc_demos/launch/opentera_turtlebot_sim.launch b/opentera_webrtc_demos/launch/opentera_turtlebot_sim.launch index b7671a2..925e9e0 100644 --- a/opentera_webrtc_demos/launch/opentera_turtlebot_sim.launch +++ b/opentera_webrtc_demos/launch/opentera_turtlebot_sim.launch @@ -21,6 +21,8 @@ + + @@ -104,11 +106,11 @@ args="-d $(find turtlebot3_navigation)/rviz/turtlebot3_navigation.rviz"/> - + - + diff --git a/opentera_webrtc_demos/opentera-webrtc-teleop-frontend b/opentera_webrtc_demos/opentera-webrtc-teleop-frontend index 8360a39..55012ff 160000 --- a/opentera_webrtc_demos/opentera-webrtc-teleop-frontend +++ b/opentera_webrtc_demos/opentera-webrtc-teleop-frontend @@ -1 +1 @@ -Subproject commit 8360a39a001bcebb84c4b067026c17ab67c04489 +Subproject commit 55012ff2191da5d85449e0d240e57dcb19196e8c diff --git a/opentera_webrtc_demos/scripts/start_signaling_server.sh b/opentera_webrtc_demos/scripts/start_signaling_server.sh index a770483..b64a4d9 100755 --- a/opentera_webrtc_demos/scripts/start_signaling_server.sh +++ b/opentera_webrtc_demos/scripts/start_signaling_server.sh @@ -14,4 +14,4 @@ echo "robot_type:" $robot_type echo "Client interface will be available at http://localhost:$port/index.html#/user?pwd=$password&robot=$robot_type" -(cd $1; $python_exec -m pip install -r requirements.txt; exec $python_exec opentera-signaling-server --port $port --password $password --static_folder $static_folder) +(cd $1; exec $python_exec opentera-signaling-server --port $port --password $password --static_folder $static_folder) diff --git a/opentera_webrtc_demos/scripts/start_signaling_server_tls.sh b/opentera_webrtc_demos/scripts/start_signaling_server_tls.sh index f2e82af..d82c4b7 100755 --- a/opentera_webrtc_demos/scripts/start_signaling_server_tls.sh +++ b/opentera_webrtc_demos/scripts/start_signaling_server_tls.sh @@ -19,4 +19,4 @@ echo "key:" $key echo "Client interface will be available at http://localhost:$port/index.html#/user?pwd=$password&robot=$robot_type" -(cd $1; $python_exec -m pip install -r requirements.txt; exec $python_exec opentera-signaling-server --port $port --password $password --static_folder $static_folder --certificate $certificate --key $key) +(cd $1; exec $python_exec opentera-signaling-server --port $port --password $password --static_folder $static_folder --certificate $certificate --key $key) diff --git a/opentera_webrtc_ros/CMakeLists.txt b/opentera_webrtc_ros/CMakeLists.txt index f94065f..450d987 100644 --- a/opentera_webrtc_ros/CMakeLists.txt +++ b/opentera_webrtc_ros/CMakeLists.txt @@ -65,39 +65,38 @@ set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_INSTALL_ON_BUILD ON) ## !! Needs to be after catkin_package !! # CATKIN_PACKAGE_PYTHON_DESTINATION and CATKIN_PACKAGE_BIN_DESTINATION are set by catkin_package # Install to develspace on build -set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_PIP_DEVEL_PREFIX ${CATKIN_DEVEL_PREFIX}) +set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_PIP_DEVEL_PREFIX ${CATKIN_DEVEL_PREFIX} CACHE STRING "") # Install to installspace on install -set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_PIP_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) -set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_PIP_PREFIX_USE_EXACT_LIB_SUBPATH "python3/dist-packages") +set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_PIP_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "") +set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_PIP_PREFIX_USE_EXACT_LIB_SUBPATH "python3/dist-packages" CACHE STRING "") + +execute_process( + COMMAND python3 --version + COMMAND bash -c "cut -f2 -d' '" + OUTPUT_VARIABLE OPENTERA_WEBRTC_ROS_PYTHON_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE +) -add_subdirectory(opentera-webrtc) +if (${OPENTERA_WEBRTC_ROS_PYTHON_VERSION} VERSION_LESS "3.8.0") + set(OPENTERA_WEBRTC_NATIVE_CLIENT_PYTHON_PIP_PYTHON_EXECUTABLE_SIGNALING_SERVER "python3.8" CACHE STRING "") +endif () -# TODO Fixme. Version is hard coded for now -# Needs to be after "add_subdirectory(opentera-webrtc/opentera-webrtc-native-client)" for "webrtc_native_build_version" to be set -set(OPENTERA_WEBRTC_NATIVE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/opentera-webrtc/opentera-webrtc-native-client/3rdParty/webrtc_native/webrtc-native-build-${webrtc_native_build_version}/include") -set(OPENTERA_WEBRTC_NATIVE_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/opentera-webrtc/opentera-webrtc-native-client/3rdParty/webrtc_native/webrtc-native-build-${webrtc_native_build_version}/lib") +add_subdirectory(opentera-webrtc) include_directories( - ${OPENTERA_WEBRTC_NATIVE_INCLUDE_DIR} + ${webrtc_native_INCLUDE} + ${boringssl_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/opentera-webrtc/opentera-webrtc-native-client/OpenteraWebrtcNativeClient/include ${CMAKE_CURRENT_SOURCE_DIR}/opentera-webrtc/opentera-webrtc-native-client/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/opentera-webrtc/opentera-webrtc-native-client/3rdParty/socket.io-client-cpp/src ) -link_directories( - ${OPENTERA_WEBRTC_NATIVE_LIB_DIR} - ${OPENTERA_WEBRTC_NATIVE_LIB_DIR}/boringssl_asm -) - set(opentera_webrtc_native_client_libs opencv_core opencv_imgproc OpenteraWebrtcNativeClient - boringssl - webrtc - dl - X11 - expat + ${webrtc_native_LIBRARY} + ${boringssl_LIBRARY} ) ########### @@ -150,7 +149,6 @@ target_link_libraries(${PROJECT_NAME}_data_channel_bridge ) target_link_libraries(${PROJECT_NAME}_json_data_handler - ${opentera_webrtc_native_client_libs} ${catkin_LIBRARIES} ) diff --git a/opentera_webrtc_ros/launch/opentera_data_test.launch b/opentera_webrtc_ros/launch/opentera_data_test.launch index 43f8b0f..e6a2ab3 100644 --- a/opentera_webrtc_ros/launch/opentera_data_test.launch +++ b/opentera_webrtc_ros/launch/opentera_data_test.launch @@ -17,7 +17,7 @@ $(arg is_stand_alone) { - server_url: $(arg server_url), # Signaling server URL + server_url: "$(arg server_url)", # Signaling server URL client_name: $(arg client_name), # Peer name as which to join the room room_name: $(arg room_name), # Room name to join room_password: $(arg room_password) # Room password diff --git a/opentera_webrtc_ros/launch/ros_data_channel_client.launch b/opentera_webrtc_ros/launch/ros_data_channel_client.launch index 8404ab1..900e620 100644 --- a/opentera_webrtc_ros/launch/ros_data_channel_client.launch +++ b/opentera_webrtc_ros/launch/ros_data_channel_client.launch @@ -9,11 +9,13 @@ - + + + $(arg is_stand_alone) { - server_url: $(arg server_url), # Signaling server URL + server_url: "$(arg server_url)", # Signaling server URL client_name: $(arg client_name), # Peer name as which to join the room room_name: $(arg room_name), # Room name to join room_password: $(arg room_password), # Room password diff --git a/opentera_webrtc_ros/launch/ros_json_data_handler.launch b/opentera_webrtc_ros/launch/ros_json_data_handler.launch index 5916e34..d01ca07 100644 --- a/opentera_webrtc_ros/launch/ros_json_data_handler.launch +++ b/opentera_webrtc_ros/launch/ros_json_data_handler.launch @@ -7,7 +7,9 @@ - + + + diff --git a/opentera_webrtc_ros/launch/ros_stream_client.launch b/opentera_webrtc_ros/launch/ros_stream_client.launch index a86cee2..9d576a0 100644 --- a/opentera_webrtc_ros/launch/ros_stream_client.launch +++ b/opentera_webrtc_ros/launch/ros_stream_client.launch @@ -4,6 +4,8 @@ + + @@ -37,7 +39,7 @@ - + $(arg is_stand_alone) { @@ -65,7 +67,7 @@ { - server_url: $(arg server_url), # Signaling server URL + server_url: "$(arg server_url)", # Signaling server URL client_name: $(arg client_name), # Peer name as which to join the room room_name: $(arg room_name), # Room name to join room_password: $(arg room_password), # Room password diff --git a/opentera_webrtc_ros/opentera-webrtc b/opentera_webrtc_ros/opentera-webrtc index a8d6af0..14d9060 160000 --- a/opentera_webrtc_ros/opentera-webrtc +++ b/opentera_webrtc_ros/opentera-webrtc @@ -1 +1 @@ -Subproject commit a8d6af0d599ca95b8e95ffdb2abdb3169f99558a +Subproject commit 14d906038c1433e54e26362b83f9e13c59395cf4 diff --git a/opentera_webrtc_ros/src/RosDataChannelBridge.cpp b/opentera_webrtc_ros/src/RosDataChannelBridge.cpp index 24f8750..6d42ec1 100644 --- a/opentera_webrtc_ros/src/RosDataChannelBridge.cpp +++ b/opentera_webrtc_ros/src/RosDataChannelBridge.cpp @@ -108,7 +108,10 @@ void RosDataChannelBridge::initDataChannelCallback() void RosDataChannelBridge::stopDataChannelCallback() { // Setup data channel callback - m_signalingClient->setOnDataChannelMessageString(nullptr); + if (m_signalingClient) + { + m_signalingClient->setOnDataChannelMessageString(nullptr); + } } void RosDataChannelBridge::onJoinSessionEvents(const std::vector& events)