Skip to content

Commit

Permalink
Use relative imports, housekeeping++
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeFinder2 committed Oct 23, 2021
1 parent d165763 commit a750ce3
Show file tree
Hide file tree
Showing 17 changed files with 107 additions and 94 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.0.2)
project(roslaunch2)

find_package(catkin REQUIRED)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* [License & Citing](#cite)

# Overview <a name="overview"/>
roslaunch2 is a (pure Python based) ROS package that facilitates writing **versatile, flexible and dynamic launch configurations for the Robot Operating System (ROS 1) using Python**, both for simulation and real hardware setups, as contrasted with the existing XML based launch file system of ROS, namely [roslaunch](http://wiki.ros.org/roslaunch). Note that roslaunch2 is not (yet) designed and developed for ROS 2 but for ROS 1 only although it may also inspire the development (of the launch system) of ROS 2. It is **compatible with all ROS versions providing roslaunch** which is used as its backend. roslaunch2 has been tested and heavily used on ROS Indigo, Jade, Kinetic, and Lunar; it also supports a “dry-mode” to generate launch files without ROS being installed at all. The **key features** of roslaunch2 are
roslaunch2 is a (pure Python based) ROS package that facilitates writing **versatile, flexible and dynamic launch configurations for the Robot Operating System (ROS 1) using Python**, both for simulation and real hardware setups, as contrasted with the existing XML based launch file system of ROS, namely [roslaunch](http://wiki.ros.org/roslaunch). Note that roslaunch2 is not (yet) designed and developed for ROS 2 but for ROS 1 only although it may also inspire the development (of the launch system) of ROS 2. It is **compatible with all ROS versions providing roslaunch** which is used as its backend. roslaunch2 has been tested and used on ROS Indigo, Jade, Kinetic, Lunar, Melodic, and Noetic; it also supports a “dry-mode” to generate launch files without ROS being installed at all. The **key features** of roslaunch2 are
- versatile control structures (conditionals, loops),
- extended support for launching and querying information remotely,
- an easy-to-use API for also launching from Python based ROS nodes dynamically, as well as
Expand Down Expand Up @@ -106,6 +106,6 @@ The entire code is **BSD 3-Clause licenced**, see [here](https://github.com/Code
}
```

Copyright (c) 2017-2019, Adrian Böckenkamp, Department of Computer Science VII, TU Dortmund University.
Copyright (c) 2017-2020, Adrian Böckenkamp, Department of Computer Science VII, TU Dortmund University.

All rights reserved.
5 changes: 4 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<package format="2">
<package format="3">
<name>roslaunch2</name>
<version>0.0.1</version>
<description>
Expand All @@ -18,9 +18,12 @@
<buildtool_depend>catkin</buildtool_depend>

<build_depend>python-catkin-pkg</build_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 3">python3-setuptools</buildtool_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 2">python-setuptools</buildtool_depend>

<exec_depend>python-enum34-pip</exec_depend>
<exec_depend version_gte="4.62">pyro4</exec_depend>
<exec_depend>python-rospkg</exec_depend>
<exec_depend>roslaunch</exec_depend>
<exec_depend>rosbash</exec_depend>
</package>
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from distutils.core import setup
from setuptools import setup
from catkin_pkg.python_setup import generate_distutils_setup

d = generate_distutils_setup(
Expand Down
29 changes: 15 additions & 14 deletions src/roslaunch2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 12/11/2019
# Date: 08/06/2020

# Import all submodules typically used in launch modules:
from group import *
from parameter import *
from machine import *
from package import *
from logger import *
from utils import *
from remote import *
from launch import *
from node import *
from environment import *
from test import *
from helpers import *
from .group import *
from .parameter import *
from .machine import *
from .package import *
from .logger import *
from .utils import *
from .remote import *
from .launch import *
from .node import *
from .environment import *
from .test import *
from .helpers import *

import argparse

Expand Down Expand Up @@ -172,7 +172,8 @@ def terminate(instance):
def main(command_line_args=None):
"""
Defines the core logic (= Python based dynamic launch files) of roslaunch2. It does NOT create any
launch modules or the like.
launch modules or the like. This function is not meant to be called directly. See `start()` and
`start_async()` for more details.
:param command_line_args: List with command line arguments as strings
:return: None
Expand Down
6 changes: 3 additions & 3 deletions src/roslaunch2/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 13/03/2018
# Date: 08/06/2020

import lxml.etree
import warnings

import interfaces
import machine
from . import interfaces
from . import machine


class EnvironmentVariable(interfaces.GeneratorBase, interfaces.Composable):
Expand Down
10 changes: 5 additions & 5 deletions src/roslaunch2/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 13/03/2018
# Date: 08/06/2020

import lxml.etree
import warnings

import interfaces
import remapable
import node
import launch
from . import interfaces
from . import remapable
from . import node
from . import launch


class Group(remapable.Remapable, interfaces.Composer, interfaces.Composable):
Expand Down
6 changes: 3 additions & 3 deletions src/roslaunch2/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 12/11/2019
# Date: 08/06/2020

import logger
import node
from . import logger
from . import node


class Helpers:
Expand Down
8 changes: 4 additions & 4 deletions src/roslaunch2/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 26/01/2018
# Date: 08/06/2020

import copy
import lxml.etree
Expand Down Expand Up @@ -126,9 +126,9 @@ def add_env_variables_to_nodes(self, environment_variable_dict=None):
"""
if environment_variable_dict is None:
environment_variable_dict = {}
from environment import EnvironmentVariable
from group import Group
from node import Node
from .environment import EnvironmentVariable
from .group import Group
from .node import Node

# Copy dict to not change the argument in higher recursion levels:
tmp_env_dict = dict(environment_variable_dict)
Expand Down
12 changes: 6 additions & 6 deletions src/roslaunch2/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 13/03/2018
# Date: 08/06/2020

import warnings
import lxml.etree

import interfaces
import machine
import remapable
import node
import group
from . import interfaces
from . import machine
from . import remapable
from . import node
from . import group


class Launch(interfaces.Composable, interfaces.Composer, remapable.Remapable):
Expand Down
8 changes: 4 additions & 4 deletions src/roslaunch2/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 13/03/2018
# Date: 08/06/2020

import lxml.etree
import getpass
Expand All @@ -12,9 +12,9 @@
import socket
import enum

import interfaces
import utils
import remote
from . import interfaces
from . import utils
from . import remote


class Machine(interfaces.GeneratorBase):
Expand Down
18 changes: 9 additions & 9 deletions src/roslaunch2/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
#
# Author: Adrian Böckenkamp
# License: BSD (https://opensource.org/licenses/BSD-3-Clause)
# Date: 13/03/2018
# Date: 08/06/2020

import warnings
import lxml.etree
import enum

import remapable
import interfaces
import package
import machine
import parameter
import environment
import random
import string

from . import remapable
from . import interfaces
from . import package
from . import machine
from . import parameter
from . import environment


class Output(enum.IntEnum):
"""
Expand Down Expand Up @@ -151,7 +151,7 @@ def __del__(self):
warnings.warn('{} has been created but never add()ed.'.format(str(self)), Warning, 2)

def __str__(self):
return '{:s}@{:s}: {:s}'.format(self.node, self.pkg, self.name)
return '{:s}@{:s}: {:s}'.format(str(self.node), str(self.pkg), str(self.name))

def add(self, param):
"""
Expand Down
Loading

0 comments on commit a750ce3

Please sign in to comment.