Skip to content

Commit

Permalink
moved python code from fkie_multimaster_msgs to fkie_multimaster_pylib
Browse files Browse the repository at this point in the history
  • Loading branch information
atiderko committed Aug 11, 2023
1 parent 90324c7 commit dd81a8e
Show file tree
Hide file tree
Showing 169 changed files with 562 additions and 493 deletions.
7 changes: 3 additions & 4 deletions fkie_master_discovery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if(POLICY CMP0057)
endif()

find_package(ament_cmake QUIET)
find_package(fkie_multimaster_msgs REQUIRED)

if ( ament_cmake_FOUND )

Expand All @@ -36,8 +37,6 @@ if ( ament_cmake_FOUND )
set(BUILD_TOOL_INCLUDE_DIRS ${ament_INCLUDE_DIRS})

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(fkie_multimaster_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(rmw_dds_common REQUIRED)
Expand All @@ -50,15 +49,15 @@ elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)

set(catkin_FOUND 1)
add_definitions( -DUSING_ROS )
find_package(catkin REQUIRED COMPONENTS fkie_multimaster_msgs rosgraph roslib rospy std_srvs)
find_package(catkin REQUIRED COMPONENTS fkie_multimaster_pylib rosgraph roslib rospy std_srvs)
find_package(GTest)

message(STATUS "------------------------------------------")
message(STATUS "FKIE Master Discovery is being built using CATKIN.")
message(STATUS "------------------------------------------")

catkin_python_setup()
catkin_package( CATKIN_DEPENDS fkie_multimaster_msgs rosgraph roslib rospy std_srvs )
catkin_package( CATKIN_DEPENDS fkie_multimaster_msgs fkie_multimaster_pylib rosgraph roslib rospy std_srvs )

endif()

Expand Down
1 change: 1 addition & 0 deletions fkie_master_discovery/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<buildtool_depend condition="$ROS_PYTHON_VERSION == 3">python3-setuptools</buildtool_depend>

<depend>fkie_multimaster_msgs</depend>
<depend condition="$ROS_VERSION == 1">fkie_multimaster_pylib</depend>
<depend condition="$ROS_VERSION == 1">std_srvs</depend>
<depend condition="$ROS_VERSION == 1">rospy</depend>
<depend condition="$ROS_VERSION == 1">roslib</depend>
Expand Down
5 changes: 2 additions & 3 deletions fkie_master_discovery/src/fkie_master_discovery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import signal
import sys

import roslib
import rospy
import time

Expand All @@ -45,7 +44,7 @@
except ImportError:
from urllib.parse import urlparse

from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_pylib.logging.logging import Log


# MCAST_GROUP = "ff02::1"# ipv6 multicast group
Expand All @@ -56,7 +55,7 @@

def get_default_rtcp_port(zeroconf=False):
try:
from fkie_multimaster_msgs.system.ros1_masteruri import from_ros
from fkie_multimaster_pylib.system.ros1_masteruri import from_ros
masteruri = from_ros()
# Log.info(f'ROS Master URI: {masteruri}')
return urlparse(masteruri).port + (600 if zeroconf else 300)
Expand Down
4 changes: 2 additions & 2 deletions fkie_master_discovery/src/fkie_master_discovery/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
import roslib.names
import rospy

from fkie_multimaster_msgs.defines import EMPTY_PATTERN
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_pylib.defines import EMPTY_PATTERN
from fkie_multimaster_pylib.logging.logging import Log


IP4_PATTERN = re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

from .common import create_pattern, gen_pattern, is_empty_pattern
from .common import get_ros_param, resolve_url, read_interface
from fkie_multimaster_msgs.defines import EMPTY_PATTERN
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_pylib.defines import EMPTY_PATTERN
from fkie_multimaster_pylib.logging.logging import Log


class FilterInterface(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

import rospy
from .common import get_hostname
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_pylib.logging.logging import Log


def get_changes_topic(masteruri, wait=True, check_host=True):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
from .common import get_hostname
from .master_monitor import MasterMonitor, MasterConnectionException
from .udp import DiscoverSocket, QueueReceiveItem, SEND_ERRORS
from fkie_multimaster_msgs.crossbar.runtime_interface import RosProvider
from fkie_multimaster_msgs.crossbar.runtime_interface import SystemWarning
from fkie_multimaster_msgs.crossbar.runtime_interface import SystemWarningGroup
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_pylib.crossbar.runtime_interface import RosProvider
from fkie_multimaster_pylib.crossbar.runtime_interface import SystemWarning
from fkie_multimaster_pylib.crossbar.runtime_interface import SystemWarningGroup
from fkie_multimaster_pylib.logging.logging import Log


try: # to avoid the problems with autodoc on ros.org/wiki site
Expand Down
10 changes: 5 additions & 5 deletions fkie_master_discovery/src/fkie_master_discovery/master_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@

from .common import get_hostname
from .filter_interface import FilterInterface
from fkie_multimaster_msgs import names
from fkie_multimaster_msgs.crossbar.runtime_interface import RosNode
from fkie_multimaster_msgs.crossbar.runtime_interface import RosService
from fkie_multimaster_msgs.crossbar.runtime_interface import RosTopic
from fkie_multimaster_msgs.system import screen
from fkie_multimaster_pylib import names
from fkie_multimaster_pylib.crossbar.runtime_interface import RosNode
from fkie_multimaster_pylib.crossbar.runtime_interface import RosService
from fkie_multimaster_pylib.crossbar.runtime_interface import RosTopic
from fkie_multimaster_pylib.system import screen

from typing import List, Dict

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@
from .common import gen_pattern
from .filter_interface import FilterInterface
from .master_info import MasterInfo
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_msgs.crossbar.base_session import CrossbarBaseSession
from fkie_multimaster_msgs.crossbar.base_session import SelfEncoder
from fkie_multimaster_msgs.crossbar.runtime_interface import RosNode
from fkie_multimaster_msgs.crossbar.runtime_interface import ScreensMapping
from fkie_multimaster_msgs.crossbar.runtime_interface import SystemWarning
from fkie_multimaster_msgs.crossbar.runtime_interface import SystemWarningGroup
from fkie_multimaster_msgs.system import screen
from fkie_multimaster_msgs.system import ros1_masteruri
from fkie_multimaster_pylib.logging.logging import Log
from fkie_multimaster_pylib.crossbar.base_session import CrossbarBaseSession
from fkie_multimaster_pylib.crossbar.base_session import SelfEncoder
from fkie_multimaster_pylib.crossbar.runtime_interface import RosNode
from fkie_multimaster_pylib.crossbar.runtime_interface import ScreensMapping
from fkie_multimaster_pylib.crossbar.runtime_interface import SystemWarning
from fkie_multimaster_pylib.crossbar.runtime_interface import SystemWarningGroup
from fkie_multimaster_pylib.system import screen
from fkie_multimaster_pylib.system import ros1_masteruri


try: # to avoid the problems with autodoc on ros.org/wiki site
Expand Down
2 changes: 1 addition & 1 deletion fkie_master_discovery/src/fkie_master_discovery/udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
_use_netifaces = False

from rosgraph.network import get_local_addresses
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_pylib.logging.logging import Log


SEND_ERRORS = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from urllib.parse import urlparse

import rospy
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_pylib.logging.logging import Log


from .common import get_hostname
Expand Down
4 changes: 2 additions & 2 deletions fkie_master_sync/nodes/param_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import rospy

from fkie_multimaster_msgs.msg import MasterState
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_msgs.system import ros1_masteruri
from fkie_multimaster_pylib.logging.logging import Log
from fkie_multimaster_pylib.system import ros1_masteruri


def master_changed(msg, cb_args):
Expand Down
4 changes: 2 additions & 2 deletions fkie_master_sync/src/fkie_master_sync/master_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
from fkie_master_discovery.common import resolve_url, read_interface, create_pattern, is_empty_pattern, get_hostname
from fkie_master_discovery.master_info import MasterInfo
import fkie_master_discovery.interface_finder as interface_finder
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_msgs.system import ros1_masteruri
from fkie_multimaster_pylib.logging.logging import Log
from fkie_multimaster_pylib.system import ros1_masteruri

from .sync_thread import SyncThread

Expand Down
4 changes: 2 additions & 2 deletions fkie_master_sync/src/fkie_master_sync/sync_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@

from fkie_master_discovery.common import get_hostname
from fkie_master_discovery.filter_interface import FilterInterface
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_msgs.system import ros1_masteruri
from fkie_multimaster_pylib.logging.logging import Log
from fkie_multimaster_pylib.system import ros1_masteruri


class SyncThread(object):
Expand Down
1 change: 1 addition & 0 deletions fkie_multimaster/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<buildtool_depend condition="$ROS_VERSION == 2">ament_cmake</buildtool_depend>

<exec_depend>fkie_multimaster_msgs</exec_depend>
<exec_depend>fkie_multimaster_pylib</exec_depend>
<exec_depend>fkie_master_discovery</exec_depend>
<exec_depend>fkie_node_manager_daemon</exec_depend>
<exec_depend condition="$ROS_VERSION == 1">fkie_master_sync</exec_depend>
Expand Down
15 changes: 2 additions & 13 deletions fkie_multimaster_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ if ( ament_cmake_FOUND )
message(STATUS "FKIE multimaster msgs is being built using AMENT.")
message(STATUS "------------------------------------------")

find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclpy REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)

Expand All @@ -36,9 +33,6 @@ if ( ament_cmake_FOUND )
DEPENDENCIES builtin_interfaces
)

# Install Python modules
ament_python_install_package(${PROJECT_NAME})

ament_package()
elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)

Expand Down Expand Up @@ -79,12 +73,12 @@ elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
Task.srv
)

catkin_python_setup()
#catkin_python_setup()
generate_messages(DEPENDENCIES std_msgs)

catkin_package(
CFG_EXTRAS version.cmake.in
CATKIN_DEPENDS message_runtime std_msgs rospy
CATKIN_DEPENDS message_runtime std_msgs
)

# generate code for gRPC protocols
Expand All @@ -102,9 +96,4 @@ elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

# # Add folders to be run by python nosetests
if(CATKIN_ENABLE_TESTING)
add_subdirectory(${PROJECT_NAME}/tests)
endif()

endif()
8 changes: 0 additions & 8 deletions fkie_multimaster_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

<buildtool_depend condition="$ROS_VERSION == 1">catkin</buildtool_depend>
<buildtool_depend condition="$ROS_VERSION == 2">ament_cmake</buildtool_depend>
<buildtool_depend condition="$ROS_VERSION == 2">ament_cmake_python</buildtool_depend>

<build_depend condition="$ROS_VERSION == 1">message_generation</build_depend>
<build_depend condition="$ROS_VERSION == 1">std_msgs</build_depend>
Expand All @@ -22,21 +21,14 @@
<build_depend condition="$ROS_VERSION == 1 and $ROS_PYTHON_VERSION == 3">python3-grpc-tools</build_depend>
<exec_depend condition="$ROS_VERSION == 1">message_runtime</exec_depend>
<exec_depend condition="$ROS_VERSION == 1">std_msgs</exec_depend>
<depend condition="$ROS_VERSION == 1">rospy</depend>
<depend condition="$ROS_VERSION == 2">rclpy</depend>

<build_depend condition="$ROS_VERSION == 2">builtin_interfaces</build_depend>
<build_depend condition="$ROS_VERSION == 2">rosidl_default_generators</build_depend>
<exec_depend condition="$ROS_VERSION == 2">builtin_interfaces</exec_depend>
<exec_depend condition="$ROS_VERSION == 2">rosidl_default_runtime</exec_depend>

<depend condition="$ROS_VERSION == 2 or $ROS_PYTHON_VERSION == 3">python3-autobahn</depend>

<member_of_group condition="$ROS_VERSION == 2">rosidl_interface_packages</member_of_group>

<test_depend condition="$ROS_VERSION == 1">rostest</test_depend>
<test_depend condition="$ROS_VERSION == 2">python3-pytest</test_depend>

<export>
<build_type condition="$ROS_VERSION == 1">catkin</build_type>
<build_type condition="$ROS_VERSION == 2">ament_cmake</build_type>
Expand Down
4 changes: 4 additions & 0 deletions fkie_multimaster_pylib/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package fkie_multimaster_pylib
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

52 changes: 52 additions & 0 deletions fkie_multimaster_pylib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.5)
project(fkie_multimaster_pylib)

# Update the policy setting to avoid an error when loading the ament_cmake package
# at the current cmake version level
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()

find_package(ament_cmake QUIET)

if ( ament_cmake_FOUND )
elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)

set(catkin_FOUND 1)
add_definitions( -DUSING_ROS )

message(STATUS "------------------------------------------")
message(STATUS "FKIE multimaster lib is being built using CATKIN.")
message(STATUS "------------------------------------------")

find_package(catkin REQUIRED COMPONENTS
fkie_multimaster_msgs
rospy
)

catkin_python_setup()

catkin_package(
CATKIN_DEPENDS
fkie_multimaster_msgs
rospy
)

# generate version files; cmake from fkie_multimaster_msgs
generate_version(TARGETS version_TARGETS)

# install generated version files; cmake from multimaster_msgs
if(DEFINED version_TARGETS)
install(
FILES
${version_TARGETS}
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
endif()

# # Add folders to be run by python nosetests
if(CATKIN_ENABLE_TESTING)
add_subdirectory(${PROJECT_NAME}/tests)
endif()

endif()
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
from asyncio import coroutine


from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_msgs.system.host import get_host_name
from fkie_multimaster_pylib.logging.logging import Log
from fkie_multimaster_pylib.system.host import get_host_name
from .server import crossbar_start_server, CROSSBAR_PATH


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from typing import Union
from numbers import Number

from fkie_multimaster_msgs.defines import SEARCH_IN_EXT
from fkie_multimaster_pylib.defines import SEARCH_IN_EXT
from .runtime_interface import RosParameter


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import platform
from typing import List, Dict, Union
import re
from fkie_multimaster_msgs.logging.logging import Log
from fkie_multimaster_msgs import names
from fkie_multimaster_pylib.logging.logging import Log
from fkie_multimaster_pylib import names

SEP = '/'
if 'ROS_VERSION' in os.environ and os.environ['ROS_VERSION'] == "1":
Expand Down
Loading

0 comments on commit dd81a8e

Please sign in to comment.