forked from Unity-Technologies/ROS-TCP-Endpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging dev branch into main (Unity-Technologies#22)
* Renaming and reorganizing package to better catkinify/pep8ify * Commands Unity can send to manage the ROS endpoint * Unregister the old handler when a new one is registered (Unity-Technologies#21) * Rewrite server core loop * Handle socket timeout * Remove the pointless threads list * Start the server on its own thread Co-authored-by: Devin Miller <[email protected]>
- Loading branch information
1 parent
68ade1c
commit b61ba41
Showing
30 changed files
with
461 additions
and
764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.DS_Store | ||
*.pyc | ||
.idea | ||
*~ | ||
build | ||
devel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(ros_tcp_endpoint) | ||
|
||
find_package(catkin REQUIRED COMPONENTS | ||
rospy | ||
std_msgs | ||
message_generation | ||
) | ||
|
||
catkin_python_setup() | ||
|
||
add_message_files(DIRECTORY msg) | ||
|
||
add_service_files(DIRECTORY srv) | ||
|
||
generate_messages(DEPENDENCIES std_msgs) | ||
|
||
catkin_package(CATKIN_DEPENDS message_runtime) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
string command | ||
string params_json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>ros_tcp_endpoint</name> | ||
<version>0.0.1</version> | ||
<description>Acts as the bridge between Unity messages sent via Websocket and ROS messages.</description> | ||
|
||
<maintainer email="[email protected]">Unity Robotics</maintainer> | ||
|
||
<license>Apache 2.0</license> | ||
<buildtool_depend>catkin</buildtool_depend> | ||
<build_depend>rospy</build_depend> | ||
<build_depend>message_generation</build_depend> | ||
<build_export_depend>rospy</build_export_depend> | ||
<exec_depend>rospy</exec_depend> | ||
<exec_depend>message_runtime</exec_depend> | ||
|
||
|
||
<!-- The export tag contains other, unspecified, tags --> | ||
<export> | ||
<!-- Other tools can request additional information be placed here --> | ||
|
||
</export> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2020 Unity Technologies | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from .publisher import RosPublisher | ||
from .subscriber import RosSubscriber | ||
from .service import RosService | ||
from .server import TcpServer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2020 Unity Technologies | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
class RosSender: | ||
""" | ||
Base class for ROS communication where data is sent to the ROS network. | ||
""" | ||
def __init__(self): | ||
pass | ||
|
||
def send(self, *args): | ||
raise NotImplementedError | ||
|
||
|
||
class RosReceiver: | ||
""" | ||
Base class for ROS communication where data is being sent outside of the ROS network. | ||
""" | ||
def __init__(self): | ||
pass | ||
|
||
def send(self, *args): | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
|
||
import rospy | ||
import actionlib_msgs.msg | ||
import diagnostic_msgs.msg | ||
import geometry_msgs.msg | ||
import nav_msgs.msg | ||
import sensor_msgs.msg | ||
import shape_msgs.msg | ||
import stereo_msgs.msg | ||
import trajectory_msgs.msg | ||
import visualization_msgs.msg | ||
|
||
from ros_tcp_endpoint import TcpServer | ||
|
||
def main(): | ||
ros_node_name = rospy.get_param("/TCP_NODE_NAME", 'TCPServer') | ||
tcp_server = TcpServer(ros_node_name) | ||
|
||
# Start the Server Endpoint | ||
rospy.init_node(ros_node_name, anonymous=True) | ||
tcp_server.start() | ||
rospy.spin() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2020 Unity Technologies | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
class RosTcpEndpointError(Exception): | ||
"""Base class for this package's custom exceptions""" | ||
pass | ||
|
||
|
||
class TopicOrServiceNameDoesNotExistError(RosTcpEndpointError): | ||
"""The topic or service name passed does not exist in the source destination dictionary.""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.