[openrtm-commit:02814] r866 - trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 9月 9日 (土) 00:28:46 JST


Author: takahashi
Date: 2017-09-09 00:28:46 +0900 (Sat, 09 Sep 2017)
New Revision: 866

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/SliderComp.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/slider.py
Log:
[compat,bugfix,->RELENG_1_2] To avoid access conflicts, access via variable object. refs #4191

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/SliderComp.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/SliderComp.py	2017-08-29 03:11:31 UTC (rev 865)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/SliderComp.py	2017-09-08 15:28:46 UTC (rev 866)
@@ -39,7 +39,6 @@
   def __init__(self, manager):
     OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
     return
-        
 
   def onInitialize(self):
     self._sl_data = RTC.TimedFloatSeq(RTC.Time(0,0), [])
@@ -49,11 +48,8 @@
     return RTC.RTC_OK
 
   def onActivated(self, ec_id):
-    print sl.get()
-    time.sleep(1)
     return RTC.RTC_OK
 
-
   def onExecute(self, ec_id):
     self._sl_data.data = sl.get()
     self._slOut.write()
@@ -60,13 +56,11 @@
     time.sleep(0.01)
     return RTC.RTC_OK
 
-
   def onShutdown(self, ec_id):
     sl.quit()
     return RTC.RTC_OK
 
 
-
 def SliderCompInit(manager):
   profile = OpenRTM_aist.Properties(defaults_str=mod_spec)
   manager.registerFactory(profile,

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/slider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/slider.py	2017-08-29 03:11:31 UTC (rev 865)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/examples/Slider_and_Motor/slider.py	2017-09-08 15:28:46 UTC (rev 866)
@@ -16,7 +16,7 @@
 
 	def init(self, channels):
 		self._channels = channels
-		self.var = [] * len(self._channels)
+		self.var = []
 		self.scales = []
 		
 		i = 0
@@ -33,8 +33,8 @@
 
 	def get(self):
 		val = []
-		for s in self.scales:
-			val.append(s.get())
+		for v in self.var:
+			val.append(v.get())
 
 		return val
 
@@ -41,13 +41,12 @@
 	def set(self, value):
 		i = 0
 		for v in value:
-			self.scales[i].set(v)
+			self.var[i].set(v)
+
 			i = i + 1
 		return
 
 
-
-
 def test ():
 	channels = (("angle", 0, 360, 0.1, 200), ("velocity", -100, 100, 0.1, 200))
 	slider = SliderMulti(channels)



More information about the openrtm-commit mailing list