Skip to content

Commit

Permalink
Fix invalid default value.
Browse files Browse the repository at this point in the history
Signed-off-by: David Oberacker <[email protected]>
  • Loading branch information
Oberacda committed Jan 23, 2025
1 parent 123414a commit e1db1fb
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions ros_bt_py/ros_bt_py/custom_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,65 +30,69 @@
import rosidl_runtime_py
import rosidl_runtime_py.utilities


class FilePath(object):
def __init__(self, path=''):
self.path = path


#TODO Math types for operation and operand remain in `helpers.py`
# TODO Math types for operation and operand remain in `helpers.py`
# to not cause a breaking change. If those are ever updated,
# they should be moved here.
from .helpers import MathBinaryOperator, MathUnaryOperator
from .helpers import MathOperandType, MathUnaryOperandType


class FilePath(object):
def __init__(self, path=""):
self.path = path


class RosType(ABC):
#NOTE Subclasses should supply a working default
# NOTE Subclasses should supply a working default
@abstractmethod
def __init__(self, type_str):
self.type_str = type_str

#NOTE We can't do the conversion in `__init__`,
# NOTE We can't do the conversion in `__init__`,
# because jsonpickle bypasses the init function.
@abstractmethod
def get_type_obj(self):
pass



class RosTopicType(RosType):
def __init__(self, type_str='std_msgs/msg/Empty'):
def __init__(self, type_str="std_msgs/msg/Empty"):
super().__init__(type_str)

def get_type_obj(self):
return rosidl_runtime_py.utilities.get_message(self.type_str)



class RosServiceType(RosType):
def __init__(self, type_str='std_srvs/srv/Trigger'):
def __init__(self, type_str="std_srvs/srv/Trigger"):
super().__init__(type_str)

def get_type_obj(self):
return rosidl_runtime_py.utilities.get_service(self.type_str)



class RosActionType(RosType):
def __init__(self, type_str='ros_bt_py_interfaces/action/Empty'):
def __init__(self, type_str="example_interfaces/action/Fibonacci"):
super().__init__(type_str)

def get_type_obj(self):
return rosidl_runtime_py.utilities.get_action(self.type_str)



#NOTE These should only be used if the service name is specified via options.
# NOTE These should only be used if the service name is specified via options.
# If the name is specified via inputs just use string instead
class RosName(ABC):
def __init__(self, name=''):
def __init__(self, name=""):
self.name = name


class RosTopicName(RosName):
pass


class RosServiceName(RosName):
pass


class RosActionName(RosName):
pass
pass

0 comments on commit e1db1fb

Please sign in to comment.