20 nxtrtc_spec = [
"implementation_id",
"NXTRTC",
21 "type_name",
"NXTRTC",
22 "description",
"NXT sample component",
25 "category",
"example",
26 "activity_type",
"DataFlowComponent",
29 "lang_type",
"SCRIPT",
30 "conf.default.map",
"A,B",
37 OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
48 self.
_d_vel = RTC.TimedFloatSeq(RTC.Time(0,0),[])
51 self.
_d_pos = RTC.TimedFloatSeq(RTC.Time(0,0),[])
54 self.
_d_sens = RTC.TimedFloatSeq(RTC.Time(0,0),[])
64 print "Connecting to NXT brick ...." 66 print "Connection established." 68 print "NXTBrick connection failed." 74 self._nxtbrick.close()
77 self._nxtbrick.setMotors([0,0,0])
79 self._nxtbrick.resetPosition()
83 self._nxtbrick.setMotors([0,0,0])
85 self._nxtbrick.resetPosition()
92 if self._velIn.isNew():
94 self.
_d_vel = self._velIn.read()
97 vel_[self.
_mapping[self.
_map[0][0]]] = self._d_vel.data[0]
98 vel_[self.
_mapping[self.
_map[0][1]]] = self._d_vel.data[1]
100 self._nxtbrick.setMotors(vel_)
105 sensor_ = self._nxtbrick.getSensors()
107 self._d_sens.data = sensor_
109 self._sensOut.write()
112 position_ = self._nxtbrick.getMotors()
120 print sys.exc_info()[1]
128 manager.registerFactory(profile,
137 comp = manager.createComponent(
"NXTRTC")
142 mgr = OpenRTM_aist.Manager.init(sys.argv)
143 mgr.setModuleInitProc(MyModuleInit)
144 mgr.activateManager()
147 if __name__ ==
"__main__":
def onExecute(self, ec_id)
def bindParameter(self, param_name, var, def_val, trans=None)
template <typename vartype>=""> bool bindParameter(const char* param_name, VarType& var...
The Properties class represents a persistent set of properties.
def MyModuleInit(manager)
def __init__(self, manager)
def addOutPort(self, name, outport)
def onDeactivated(self, ec_id)
def addInPort(self, name, inport)
def onActivated(self, ec_id)
DataFlowComponentBase class.