本文整理汇总了Python中pyelixys.logs.hwsimlog.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: linacts_start
def linacts_start(self, devid, value=None):
log.debug("Axis %d start" % devid)
def fxn():
self.status.linact_stats[devid].clearInPosition()
self.status.linact_stats[devid].setMoving()
while not (self.status.LinearActuators[devid]['position'] == self.status.LinearActuators[devid]['requested_position']):
print 'linacts_start() running: pos = ' + str(self.status.LinearActuators[devid]['position']) #debug
# If our error less than 5mm set them equal
if abs(self.status.LinearActuators[devid]['position'] - self.status.LinearActuators[devid]['requested_position']) < 500 :
self.status.LinearActuators[devid]['position'] = self.status.LinearActuators[devid]['requested_position']
break;
# If position is greater than req position deincrement
if (self.status.LinearActuators[devid]['position'] > self.status.LinearActuators[devid]['requested_position']):
step = -100
# Else increment
else:
step = 100
self.status.LinearActuators[devid]['position'] += step
time.sleep(0.01)
self.status.linact_stats[devid].clearMoving()
self.status.linact_stats[devid].setInPosition()
#Timer(0.5, fxn).start()
time.sleep(0.5) #added
fxn()#added
示例2: run_callback
def run_callback(self, cmdpkt):
"""
When a command comes in from the user/host
this fxn is used to properly parse
the packet and execute the proper callback
"""
log.debug("Execute PKT: %s",repr(cmdpkt))
# Determine callback to exectue
cmdfxn, dev_id, param = self.parse_cmd(cmdpkt)
# Execute the callback
cmdfxn(dev_id, *param)
示例3: __init__
def __init__(self, *args, **kwargs):
log.debug("Creating a controlbox simulator")
self.hwsim = hwsim
self.out_buffer = StringIO("CBOX")
self.dacval0 = 0
self.dacval1 = 0
self.adcval0 = 0
self.adcval1 = 0
self.cbs = dict()
self.cbs['DAC'] = self.cb_dac
self.cbs['ADC'] = self.cb_adc
self.cbs['SSR'] = self.cb_ssr
示例4: write
def write(self, msg):
""" Write message to the control box simulator """
log.debug("CBOXSIM Command: %s" % msg)
params = msg.split('/')
cmd = params[1]
param = params[2]
param = param.split(" ")
if len(param) == 3:
param0 = param[1]
param1 = param[2]
params = (param0, param1)
elif len(param) == 2:
params = param[1]
else:
params = None
self.cbs[cmd](params)
示例5: linacts_home_axis
def linacts_home_axis(self, devid, value=None):
""" Linear Actuator home axis """
log.debug("Home the linear actuator %d", devid)
self.status.LinearActuators[devid]['requested_position'] = 0 #Added 5/7/2014 by [email protected]
def fxn():
self.status.linact_stats[devid].clearHome()
self.status.linact_stats[devid].setMoving()
time.sleep(1.0)
while not self.status.LinearActuators[devid]['position'] <= 0:
self.status.LinearActuators[devid]['position'] -= 10
if self.status.LinearActuators[devid]['position'] < 0:
self.status.LinearActuators[devid]['position'] = 0
time.sleep(0.1)
self.status.linact_stats[devid].clear()
#Timer(0.5, fxn).start() #taken out 5/8/2014 by [email protected]
time.sleep(0.5) #added
fxn()#added
示例6: parse_cmd
def parse_cmd(self, cmd_pkt):
"""
Parse the cmd sent from the host
Expect little endian
-first integer is the cmd_id
-second integer is the device_id
You can think of this as a 2 integer
long register we are writing too
- the parameter type is variable,
so we look it up and get the callback fxn that will change
the proper state variable (or start a thread that will simulate
some HW change)
"""
# Create struct for unpacking the cmd_id and dev_id
cmd_id_struct = struct.Struct("<ii")
# Length of the packet
len_cmd_id = cmd_id_struct.size
# Extract cmd_id and dev_id
cmd_id, dev_id = cmd_id_struct.unpack(cmd_pkt[:len_cmd_id])
log.debug("CMDID:#%d|DEVID:#%d", cmd_id, dev_id)
# Look up callback and parameter type
cb, param_fmt_str = self.cb_map[cmd_id]
# Create struct to unpack the parameter
param_struct = struct.Struct(param_fmt_str)
# Unpack paramter depending on expected type
param = param_struct.unpack(cmd_pkt[len_cmd_id:])
log.debug("PARAM:%s", param)
# Return the cb fxn, the dev_id and the param
# Something else can pass the dev_id and param in to callback
# This simulates some HW action as a result of a user/host command
return (cb, dev_id, param)
示例7: valves_set_state2
def valves_set_state2(self, devid, state):
""" Set valve state2 """
log.debug("Set valve state2 = %s", bin(state))
self.stat.Valves['state2'] = state
示例8: mixers_set_duty_cycle
def mixers_set_duty_cycle(self, devid, duty):
""" Mixer set the duty cycle """
log.debug("Set mixer %d duty cycle = %f", devid, duty)
示例9: valves_set_state1
def valves_set_state1(self, devid, state):
""" Set valve state1 """
log.debug("Set valve state1 = %s", bin(state))
self.stat.Valves['state1'] = state
self.update_digital_inputs()
示例10: linacts_home_axis
def linacts_home_axis(self, devid, value=None):
""" Linear Actuator home axis """
log.debug("Home the linear actuator %d", devid)
示例11: tempctrl_turn_on
def tempctrl_turn_on(self, devid, value=None):
""" Turn temperature controller on """
log.debug("Turn on temperture controller %d", devid)
self.status.TemperatureControllers[devid]['error_code'] = '\x01'
示例12: smcinterfaces_set_analog_out
def smcinterfaces_set_analog_out(self, devid, value):
""" SMC Interface set analog out """
log.debug(" SMC Interface %d set analog out = %f", devid, value)
示例13: fans_turn_off
def fans_turn_off(self, devid, value=None):
""" Fans turn off """
log.debug("Turn off Fan %d", devid)
示例14: flushInput
def flushInput(self):
""" Flush in input buffer """
log.debug("Flush the controlbox simulator input buffer")
示例15: __init__
def __init__(self):
""" The ElixysSimulator initializes its
status and then registers the callbacks to be executed
when the commands come in from the host/user
"""
self.stat = StatusSimulator()
self.cb_map = {}
log.debug("Initialize the ElixysSimulator, register callbacks")
# Setup Callbacks for Mixer commands
self.register_callback('Mixers',
'set_period',
self.mixers_set_period)
self.register_callback('Mixers',
'set_duty_cycle',
self.mixers_set_duty_cycle)
# Setup Callbacks for Valve commands
self.register_callback('Valves',
'set_state0',
self.valves_set_state0)
self.register_callback('Valves',
'set_state1',
self.valves_set_state1)
self.register_callback('Valves',
'set_state2',
self.valves_set_state2)
# Setup Callbacks for Temperature controllers
self.register_callback('TemperatureControllers',
'set_setpoint',
self.tempctrl_set_setpoint)
self.register_callback('TemperatureControllers',
'turn_on',
self.tempctrl_turn_on)
self.register_callback('TemperatureControllers',
'turn_off',
self.tempctrl_turn_off)
# Setup Callbacks for SMC Intrefaces
self.register_callback('SMCInterfaces',
'set_analog_out',
self.smcinterfaces_set_analog_out)
# Setup Callbacks for Fans
self.register_callback('Fans',
'turn_on',
self.fans_turn_on)
self.register_callback('Fans',
'turn_off',
self.fans_turn_off)
# Setup Callback for Linear Actuators
self.register_callback('LinearActuators',
'set_requested_position',
self.linacts_set_requested_position)
self.register_callback('LinearActuators',
'home_axis',
self.linacts_home_axis)
self.tempctrl_thread = thread.start_new_thread(self.run_tempctrls,())