[openrtm-commit:02630] r838 - trunk/OpenRTM-aist-Python/OpenRTM_aist
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 6月 12日 (月) 17:59:43 JST
Author: miyamoto
Date: 2017-06-12 17:59:43 +0900 (Mon, 12 Jun 2017)
New Revision: 838
Added:
trunk/OpenRTM-aist-Python/OpenRTM_aist/SimulatorExecutionContext.py
Modified:
trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
Log:
[incompat, Choreonoid] add SimulatorExecutionContext
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2017-06-12 06:33:33 UTC (rev 837)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2017-06-12 08:59:43 UTC (rev 838)
@@ -2024,6 +2024,7 @@
OpenRTM_aist.PeriodicExecutionContextInit(self)
OpenRTM_aist.ExtTrigExecutionContextInit(self)
OpenRTM_aist.OpenHRPExecutionContextInit(self)
+ OpenRTM_aist.SimulatorExecutionContextInit(self)
self.initCpuAffinity()
return True
Added: trunk/OpenRTM-aist-Python/OpenRTM_aist/SimulatorExecutionContext.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/SimulatorExecutionContext.py (rev 0)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/SimulatorExecutionContext.py 2017-06-12 08:59:43 UTC (rev 838)
@@ -0,0 +1,202 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file SimulatorExecutionContext.py
+# @brief SimulatorExecutionContext class
+# @date $Date: 2017/06/12$
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp> and Shinji Kurihara
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import threading
+import time
+
+import OpenRTM_aist
+import OpenRTM__POA, RTC
+
+
+class SimulatorExecutionContext(OpenRTM_aist.OpenHRPExecutionContext):
+ """
+ """
+
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param self
+ #
+ # @else
+ # @brief Constructor
+ #
+ # Constructor
+ #
+ # @param self
+ #
+ # @endif
+ #
+ def __init__(self):
+ OpenRTM_aist.OpenHRPExecutionContext.__init__(self)
+ return
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # @param self
+ #
+ # @else
+ # @brief Destructor
+ #
+ # Destructor
+ #
+ # @param self
+ # @endif
+ #
+ def __del__(self):
+ return
+
+
+ ##
+ # @if jp
+ # @brief ÂоݤÎRTC¤ò¥¢¥¯¥Æ¥£¥Ö²½¤¹¤ë
+ # ÆâÉô¤ÇinvokeWorkerPreDo´Ø¿ô¤ò¸Æ¤Ö¤¿¤á¡¢Â¨ºÂ¤Ë
+ # ¾õÂÖ¤òÁ«°Ü¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ # ¸½ºßtick¼Â¹ÔÃæ¤Î¾ì¹ç¤Ï¼Â¹Ô½ªÎ»¤Þ¤ÇÂÔ¤Ä
+ #
+ # @param self
+ # @param comp ¥¢¥¯¥Æ¥£¥Ö²½ÂоÝRT¥³¥ó¥Ý¡¼¥Í¥ó¥È
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ # @brief Activate an RT-component
+ #
+ #
+ # @param self
+ # @param comp The target RT-Component for activation
+ # @return The return code of ReturnCode_t type
+ #
+ # @endif
+ #
+ def activate_component(self, comp):
+ guard = OpenRTM_aist.ScopedLock(self._tickmutex)
+ rtobj = self._worker.findComponent(comp)
+ if not rtobj:
+ return RTC.BAD_PARAMETER
+ if not rtobj.isCurrentState(RTC.INACTIVE_STATE):
+ return RTC.PRECONDITION_NOT_MET
+
+ self._syncActivation = False
+ OpenRTM_aist.ExecutionContextBase.activateComponent(self, comp)
+
+ self.invokeWorkerPreDo()
+
+ if rtobj.isCurrentState(RTC.ACTIVE_STATE):
+ return RTC.RTC_OK
+
+ return RTC.RTC_ERROR
+
+
+ ##
+ # @if jp
+ # @brief ÂоݤÎRTC¤òÈó¥¢¥¯¥Æ¥£¥Ö²½¤¹¤ë
+ # ÆâÉô¤ÇinvokeWorkerPreDo´Ø¿ô¤ò¸Æ¤Ö¤¿¤á¡¢Â¨ºÂ¤Ë
+ # ¾õÂÖ¤òÁ«°Ü¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ # ¸½ºßtick¼Â¹ÔÃæ¤Î¾ì¹ç¤Ï¼Â¹Ô½ªÎ»¤Þ¤ÇÂÔ¤Ä
+ #
+ # @param self
+ # @param comp Èó¥¢¥¯¥Æ¥£¥Ö²½ÂоÝRT¥³¥ó¥Ý¡¼¥Í¥ó¥È
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ # @brief Deactivate an RT-component
+ #
+ #
+ # @param self
+ # @param comp The target RT-Component for deactivation
+ # @return The return code of ReturnCode_t type
+ #
+ # @endif
+ #
+ def deactivate_component(self, comp):
+ guard = OpenRTM_aist.ScopedLock(self._tickmutex)
+ rtobj = self._worker.findComponent(comp)
+ if not rtobj:
+ return RTC.BAD_PARAMETER
+ if not rtobj.isCurrentState(RTC.ACTIVE_STATE):
+ return RTC.PRECONDITION_NOT_MET
+
+ self._syncActivation = False
+ OpenRTM_aist.ExecutionContextBase.deactivateComponent(self, comp)
+
+ self.invokeWorkerPreDo()
+ self.invokeWorkerDo()
+ self.invokeWorkerPostDo()
+
+ if rtobj.isCurrentState(RTC.INACTIVE_STATE):
+ return RTC.RTC_OK
+
+ return RTC.RTC_ERROR
+
+ ##
+ # @if jp
+ # @brief ÂоݤÎRTC¤ò¥ê¥»¥Ã¥È²½¤¹¤ë
+ # ÆâÉô¤ÇinvokeWorkerPreDo´Ø¿ô¤ò¸Æ¤Ö¤¿¤á¡¢Â¨ºÂ¤Ë
+ # ¾õÂÖ¤òÁ«°Ü¤µ¤»¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ # ¸½ºßtick¼Â¹ÔÃæ¤Î¾ì¹ç¤Ï¼Â¹Ô½ªÎ»¤Þ¤ÇÂÔ¤Ä
+ #
+ # @param self
+ # @param comp ¥ê¥»¥Ã¥ÈÂоÝRT¥³¥ó¥Ý¡¼¥Í¥ó¥È
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ # @brief Reset an RT-component
+ #
+ #
+ # @param self
+ # @param comp The target RT-Component for reset
+ # @return The return code of ReturnCode_t type
+ #
+ # @endif
+ #
+ def reset_component(self, comp):
+ guard = OpenRTM_aist.ScopedLock(self._tickmutex)
+ rtobj = self._worker.findComponent(comp)
+ if not rtobj:
+ return RTC.BAD_PARAMETER
+ if not rtobj.isCurrentState(RTC.ERROR_STATE):
+ return RTC.PRECONDITION_NOT_MET
+
+ self._syncActivation = False
+ OpenRTM_aist.ExecutionContextBase.activateComponent(self, comp)
+
+ self.invokeWorkerPreDo()
+ self.invokeWorkerDo()
+ self.invokeWorkerPostDo()
+
+ if rtobj.isCurrentState(RTC.INACTIVE_STATE):
+ return RTC.RTC_OK
+
+ return RTC.RTC_ERROR
+
+
+##
+# @if jp
+# @brief ECFactory¤Ø¤ÎÅÐÏ¿¤Î¤¿¤á¤Î½é´ü²½´Ø¿ô
+# @else
+# @brief Initialization function to register to ECFactory
+# @endif
+#
+def SimulatorExecutionContextInit(manager):
+ OpenRTM_aist.ExecutionContextFactory.instance().addFactory("SimulatorExecutionContext",
+ OpenRTM_aist.SimulatorExecutionContext,
+ OpenRTM_aist.ECDelete)
+ return
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2017-06-12 06:33:33 UTC (rev 837)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2017-06-12 08:59:43 UTC (rev 838)
@@ -116,5 +116,5 @@
from CPUAffinity import *
from LogstreamBase import *
from LogstreamFile import *
+from SimulatorExecutionContext import *
-
More information about the openrtm-commit
mailing list