Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions OpenRTM_aist/InPortBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,11 @@ def createProvider(self, cprof, prop):

if provider is not None:
self._rtcout.RTC_DEBUG("provider created")
provider.init(prop.getNode("provider"))
try:
provider.init(prop.getNode("provider"))
except BaseException:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
return None

if not provider.publishInterface(cprof.properties):
self._rtcout.RTC_ERROR(
Expand Down Expand Up @@ -1334,7 +1338,11 @@ def createConsumer(self, cprof, prop):

if consumer is not None:
self._rtcout.RTC_DEBUG("consumer created")
consumer.init(prop.getNode("consumer"))
try:
consumer.init(prop.getNode("consumer"))
except BaseException:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
return None

if not consumer.subscribeInterface(cprof.properties):
self._rtcout.RTC_ERROR("interface subscription failed.")
Expand Down
5 changes: 3 additions & 2 deletions OpenRTM_aist/InPortPullConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(self, info, consumer, listeners, buffer=None):
self._buffer = self.createBuffer(self._profile)

if not self._buffer or not self._consumer:
raise
raise MemoryError("InPortPullConnector creation failed")

self._buffer.init(info.properties.getNode("buffer"))
self._consumer.init(info.properties)
Expand Down Expand Up @@ -414,4 +414,5 @@ def unsubscribeInterface(self, prop):

def setDataType(self, data):
OpenRTM_aist.InPortConnector.setDataType(self, data)
self._serializer = OpenRTM_aist.SerializerFactories.instance().createSerializer(self._marshaling_type, data)
self._serializer = OpenRTM_aist.SerializerFactories.instance(
).createSerializer(self._marshaling_type, data)
2 changes: 1 addition & 1 deletion OpenRTM_aist/InPortPushConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __init__(self, info, provider, listeners, buffer=None):
self._buffer = self.createBuffer(info)

if self._buffer is None or not self._provider:
raise
raise MemoryError("InPortPushConnector creation failed")

self._buffer.init(info.properties.getNode("buffer"))
self._provider.init(info.properties)
Expand Down
70 changes: 52 additions & 18 deletions OpenRTM_aist/Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3128,9 +3128,13 @@ def connectDataPorts(self, port, target_ports):
con_name += ":"
con_name += p1.name
prop = OpenRTM_aist.Properties()
if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
con_name, prop, port, p):
self._rtcout.RTC_ERROR("Connection error in topic connection.")
try:
if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
con_name, prop, port, p):
self._rtcout.RTC_ERROR(
"Connection error in topic connection.")
except BaseException:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())

##
# @if jp
Expand Down Expand Up @@ -3159,9 +3163,13 @@ def connectServicePorts(self, port, target_ports):
con_name += ":"
con_name += p1.name
prop = OpenRTM_aist.Properties()
if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
con_name, prop, port, p):
self._rtcout.RTC_ERROR("Connection error in topic connection.")
try:
if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
con_name, prop, port, p):
self._rtcout.RTC_ERROR(
"Connection error in topic connection.")
except BaseException:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())

##
# @if jp
Expand Down Expand Up @@ -3239,8 +3247,13 @@ def initPreConnection(self):
comp0_ref = rtcs[0]
port0_name = port0_str.split("/")[-1]

port0_var = OpenRTM_aist.CORBA_RTCUtil.get_port_by_name(
comp0_ref, port0_name)
port0_var = None
try:
port0_var = OpenRTM_aist.CORBA_RTCUtil.get_port_by_name(
comp0_ref, port0_name)
except BaseException:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
continue

if CORBA.is_nil(port0_var):
self._rtcout.RTC_DEBUG("port %s not found: " % port0_str)
Expand All @@ -3254,9 +3267,14 @@ def initPreConnection(self):
v = v.strip()
prop.setProperty("dataport." + k, v)

if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
c, prop, port0_var, RTC.PortService._nil):
self._rtcout.RTC_ERROR("Connection error: %s" % c)
try:
if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
c, prop, port0_var, RTC.PortService._nil):
self._rtcout.RTC_ERROR("Connection error: %s" % c)
except BaseException:
self._rtcout.RTC_ERROR(
OpenRTM_aist.Logger.print_exception())
continue

for port_str in ports:

Expand Down Expand Up @@ -3284,8 +3302,14 @@ def initPreConnection(self):
comp_ref = rtcs[0]
port_name = port_str.split("/")[-1]

port_var = OpenRTM_aist.CORBA_RTCUtil.get_port_by_name(
comp_ref, port_name)
port_var = None
try:
port_var = OpenRTM_aist.CORBA_RTCUtil.get_port_by_name(
comp_ref, port_name)
except BaseException:
self._rtcout.RTC_ERROR(
OpenRTM_aist.Logger.print_exception())
continue

if CORBA.is_nil(port_var):
self._rtcout.RTC_DEBUG("port %s not found: " % port_str)
Expand All @@ -3297,10 +3321,13 @@ def initPreConnection(self):
k = k.strip()
v = v.strip()
prop.setProperty("dataport." + k, v)

if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
c, prop, port0_var, port_var):
self._rtcout.RTC_ERROR("Connection error: %s" % c)
try:
if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(
c, prop, port0_var, port_var):
self._rtcout.RTC_ERROR("Connection error: %s" % c)
except BaseException:
self._rtcout.RTC_ERROR(
OpenRTM_aist.Logger.print_exception())

##
# @if jp
Expand Down Expand Up @@ -3336,7 +3363,14 @@ def initPreActivation(self):
self._rtcout.RTC_ERROR("%s not found." % c)
continue
comp_ref = rtcs[0]
ret = OpenRTM_aist.CORBA_RTCUtil.activate(comp_ref)
ret = RTC.RTC_OK
try:
ret = OpenRTM_aist.CORBA_RTCUtil.activate(comp_ref)
except BaseException:
self._rtcout.RTC_ERROR(
OpenRTM_aist.Logger.print_exception())
continue

if ret != RTC.RTC_OK:
self._rtcout.RTC_ERROR("%s activation failed." % c)
else:
Expand Down
12 changes: 10 additions & 2 deletions OpenRTM_aist/OutPortBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,11 @@ def createProvider(self, cprof, prop):

if provider is not None:
self._rtcout.RTC_DEBUG("provider created")
provider.init(prop.getNode("provider"))
try:
provider.init(prop.getNode("provider"))
except BaseException:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
return None

if not provider.publishInterface(cprof.properties):
self._rtcout.RTC_ERROR(
Expand Down Expand Up @@ -1339,7 +1343,11 @@ def createConsumer(self, cprof, prop):
if consumer is not None:
self._rtcout.RTC_DEBUG("consumer created")

consumer.init(prop.getNode("consumer"))
try:
consumer.init(prop.getNode("consumer"))
except BaseException:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
return None

if not consumer.subscribeInterface(cprof.properties):
self._rtcout.RTC_ERROR("interface subscription failed.")
Expand Down
5 changes: 3 additions & 2 deletions OpenRTM_aist/OutPortPullConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self, info, provider, listeners, buffer=None):
if not self._provider or not self._buffer:
self._rtcout.RTC_ERROR(
"Exeption: in OutPortPullConnector.__init__().")
raise
raise MemoryError("OutPortPullConnector creation failed")

self._buffer.init(info.properties.getNode("buffer"))
self._provider.init(info.properties)
Expand Down Expand Up @@ -417,7 +417,8 @@ def setDirectMode(self):

def setDataType(self, data):
OpenRTM_aist.OutPortConnector.setDataType(self, data)
self._serializer = OpenRTM_aist.SerializerFactories.instance().createSerializer(self._marshaling_type, data)
self._serializer = OpenRTM_aist.SerializerFactories.instance(
).createSerializer(self._marshaling_type, data)

class WorkerThreadCtrl:
def __init__(self):
Expand Down
9 changes: 5 additions & 4 deletions OpenRTM_aist/OutPortPushConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ def __init__(self, info, consumer, listeners, buffer=None):
self._buffer = self.createBuffer(info)

if not self._publisher or not self._buffer or not self._consumer:
raise
raise MemoryError("OutPortPushConnector creation failed")

if self._publisher.init(info.properties) != self.PORT_OK:
raise
raise MemoryError("OutPortPushConnector creation failed")

if self._profile.properties.hasKey("serializer"):
endian = self._profile.properties.getProperty(
"serializer.cdr.endian")
if not endian:
self._rtcout.RTC_ERROR("write(): endian is not set.")
raise
raise MemoryError("OutPortPushConnector creation failed")

# Maybe endian is ["little","big"]
endian = OpenRTM_aist.split(endian, ",")
Expand Down Expand Up @@ -517,4 +517,5 @@ def unsubscribeInterface(self, prop):

def setDataType(self, data):
OpenRTM_aist.OutPortConnector.setDataType(self, data)
self._serializer = OpenRTM_aist.SerializerFactories.instance().createSerializer(self._marshaling_type, data)
self._serializer = OpenRTM_aist.SerializerFactories.instance(
).createSerializer(self._marshaling_type, data)
Loading