Coming from omniORBpy¶
rustorb's Python binding follows the standard IDL to Python mapping in the
layout of omniidl -bpython, so code written for omniORBpy mostly runs
as it is. The package rustorb-omniorb-compat adds the omniORB module
and the omniORBpy extensions that applications use, enough to run
OpenRTM-aist-Python and rtshell unchanged.
Switching¶
- Regenerate the stubs with
rustorb-idl -bpythoninstead ofomniidl -bpython. The generated modules have the same names and the same API, but omniidl's output calls omniORBpy's internals and does not work with rustorb.-Wbpackage=works as with omniidl. - Keep the imports:
from omniORB import CORBA, PortableServer,import CosNamingand the top-levelCORBAandPortableServermodules now give rustorb's. - Keep the command lines: the
-ORB...options have omniORB's names (ORB options).
Without the compatibility package, write from rustorb import CORBA,
PortableServer instead.
What the compatibility package has¶
| omniORBpy API | Notes |
|---|---|
omniORB.CORBA, omniORB.PortableServer, CORBA, PortableServer, CosNaming |
rustorb's modules |
omniORB.cdrMarshal, cdrUnmarshal |
same encoding as omniORB (strings in ISO 8859-1), so the bytes match |
omniORB.any.to_any, from_any |
same choice of TypeCodes as omniORBpy |
omniORB.findType, omniORB.tcInternal |
the type descriptors OpenRTM-aist reads |
resolve_initial_references("omniINSPOA") |
object ids as corbaloc keys (corbaloc::host:2810/manager) |
omniORB.setClientCallTimeout and the other timeout functions |
Timeouts |
omniORB.URI: stringToName, nameToString, addrAndNameToURI |
omniORBpy 4.3.4's rules, measured |
Minor codes such as TRANSIENT_ConnectFailed |
set to the codes rustorb raises |
compat_example.py
import sys
from omniORB import CORBA, URI
import omniORB
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
name = URI.stringToName("apps/calc.service")
print([(c.id, c.kind) for c in name]) # [('apps', ''), ('calc', 'service')]
print(URI.nameToString(name)) # apps/calc.service
print(URI.addrAndNameToURI("localhost:2809", "apps/calc.service"))
# corbaname:localhost:2809#apps/calc.service
omniORB.setClientCallTimeout(2000) # 2 s for every call of this ORB
orb.destroy()
Differences to know¶
- Minor codes of system exceptions are rustorb's, not omniORB's; the constants of the compatibility package follow rustorb.
omniORB.setClientThreadCallDeadline,installTimeoutExceptionHandlerand thesslTP/httpTPmodules are not there. TLS is set with the ORB options instead (Transports).- omniNames works with rustorb, and
rustorb-names(a replacement, with persistence) works with omniORBpy: see Naming service.
More: omniorb-compat.md, python-binding.md.