本文整理汇总了Python中Encoder类的典型用法代码示例。如果您正苦于以下问题:Python Encoder类的具体用法?Python Encoder怎么用?Python Encoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Encoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tool_status
def get_tool_status(self, tool_index):
"""
Retrieve some information about the tool
@param int tool_index: The tool we would like to query for information
@return A dictionary containing status information about the tool_index
ExtruderReady : The extruder has reached target temp
ExtruderNotPluggedIn : The extruder thermocouple is not detected by the bot
ExturderOverMaxTemp : The temperature measured at the extruder is greater than max allowed
ExtruderNotHeating : In the first 40 seconds after target temp was set, the extruder is not heating up as expected
ExtruderDroppingTemp : After reaching and maintaining temperature, the extruder temp has dropped 30 degrees below target
PlatformError: an error was detected with the platform heater (if the tool supports one).
The platform heater will fail if an error is detected with the sensor (thermocouple)
or if the temperature reading appears to be unreasonable.
ExtruderError: An error was detected with the extruder heater (if the tool supports one).
The extruder heater will fail if an error is detected with the sensor (thermocouple) or
if the temperature reading appears to be unreasonable
"""
response = self.tool_query(tool_index, slave_query_command_dict['GET_TOOL_STATUS'])
[resonse_code, bitfield] = Encoder.unpack_response('<BB', response)
bitfield = Encoder.decode_bitfield(bitfield)
returnDict = {
"ExtruderReady" : bitfield[0],
"ExtruderNotPluggedIn" : bitfield[1],
"ExtruderOverMaxTemp" : bitfield[2],
"ExtruderNotHeating" : bitfield[3],
"ExtruderDroppingTemp" : bitfield[4],
"PlatformError" : bitfield[6],
"ExtruderError" : bitfield[7],
}
return returnDict
示例2: get
def get():
obj = Encoder.to_dict(request.vars)
rows = db(
(db.auth_membership.user_id == db.UsuarioUSB.id) & (db.auth_membership.group_id == db.auth_group.id)).select()
prueba=rows.as_json()
return rows.as_json()
示例3: queue_point_new_ext
def queue_point_new_ext(self, position, dda_rate, relative_axes, distance, feedrate):
"""
Queue a position with the new style! Moves to a certain position over a given duration
with either relative or absolute positioning. Relative vs. Absolute positioning
is done on an axis to axis basis.
@param list position: A 5 dimentional position in steps specifying where each axis should move to
@param int dda_rate: Steps per second along the master axis
@param list relative_axes: Array of axes whose coordinates should be considered relative
@param float distance: distance in millimeters moved in (x,y,z) space OR if distance(x,y,z) == 0, then max(distance(A),distance(B))
@param float feedrate: the actual feedrate in units of millimeters/second
"""
if len(position) != self.extendedPointLength:
raise PointLengthError(len(position))
payload = struct.pack(
'<BiiiiiIBfh',
host_action_command_dict['QUEUE_POINT_NEW_EXT'],
position[0], position[1], position[2], position[3], position[4],
dda_rate,
Encoder.encode_axes(relative_axes),
float(distance),
int(float(feedrate)*64.0)
)
self.writer.send_action_payload(payload)
示例4: etapas
def etapas():
obj = Encoder.to_dict(request.vars)
rows = Etapa.find(obj)
response.view = 'mis_pasantias/etapas.load.html'
return dict(etapas=rows.as_list(),id="id")
示例5: extended_stop
def extended_stop(self, halt_steppers, clear_buffer):
"""
Stop the stepper motor motion and/or reset the command buffer. This differs from the
reset and abort commands in that a soft reset of all functions isnt called.
@param boolean halt_steppers: A flag that if true will stop the steppers
@param boolean clear_buffer: A flag that, if true, will clear the buffer
"""
bitfield = 0
if halt_steppers:
bitfield |= 0x01
if clear_buffer:
bitfield |= 0x02
payload = struct.pack(
'<Bb',
host_query_command_dict['EXTENDED_STOP'],
bitfield,
)
response = self.writer.send_query_payload(payload)
[response_code, extended_stop_response] = Encoder.unpack_response('<BB', response)
if extended_stop_response != 0:
raise ExtendedStopError
示例6: get_next_filename
def get_next_filename(self, reset):
"""
Get the next filename from the machine
@param boolean reset: If true, reset the file index to zero and return the first
available filename.
"""
if reset == True:
flag = 1
else:
flag = 0
payload = struct.pack(
'<Bb',
host_query_command_dict['GET_NEXT_FILENAME'],
flag,
)
response = self.writer.send_query_payload(payload)
[response_code, sd_response_code, filename] = Encoder.unpack_response_with_string('<BB', response)
if sd_response_code != sd_error_dict['SUCCESS']:
raise SDCardError(sd_response_code)
return filename
示例7: get_communication_stats
def get_communication_stats(self):
"""
Get some communication statistics about traffic on the tool network from the Host.
"""
payload = struct.pack(
'<B',
host_query_command_dict['GET_COMMUNICATION_STATS'],
)
response = self.writer.send_query_payload(payload)
[response_code,
packetsReceived,
packetsSent,
nonResponsivePacketsSent,
packetRetries,
noiseBytes] = Encoder.unpack_response('<BLLLLL', response)
info = {
'PacketsReceived' : packetsReceived,
'PacketsSent' : packetsSent,
'NonResponsivePacketsSent' : nonResponsivePacketsSent,
'PacketRetries' : packetRetries,
'NoiseBytes' : noiseBytes,
}
return info
示例8: get_advanced_version
def get_advanced_version(self):
"""
Get the firmware version number of the connected machine
@return Version number
"""
payload = struct.pack(
'<BH',
host_query_command_dict['GET_ADVANCED_VERSION'],
s3g_version,
)
response = self.writer.send_query_payload(payload)
[response_code,
version,
internal_version,
reserved_a,
reserved_b] = Encoder.unpack_response('<BHHHH', response)
version_info = {
'Version' : version,
'InternalVersion' : internal_version,
'ReservedA' : reserved_a,
'ReservedB' : reserved_b,
}
return version_info
示例9: get_build_stats
def get_build_stats(self):
"""
Get some statistics about the print currently running, or the last print if no print is active
"""
payload = struct.pack(
'<B',
host_query_command_dict['GET_BUILD_STATS'],
)
response = self.writer.send_query_payload(payload)
[response_code,
build_state,
build_hours,
build_minutes,
line_number,
reserved] = Encoder.unpack_response('<BBBBLL', response)
info = {
'BuildState' : build_state,
'BuildHours' : build_hours,
'BuildMinutes' : build_minutes,
'LineNumber' : line_number,
'Reserved' : reserved
}
return info
示例10: get
def get():
obj = Encoder.to_dict(request.vars)
rows = Pasantia.JMaterias(obj)
rows = rows.as_json()
return rows
示例11: get
def get():
obj = Encoder.to_dict(request.vars)
rows = Permiso.find(obj)
rows = rows.as_json()
return rows
示例12: get
def get():
obj = Encoder.to_dict(request.vars)
rows = Accion_Usuario.find(obj)
rows = rows.as_json()
return rows
示例13: count
def count(self,options):
query = DBhandler.getQuery(options)
condition = query["condition"]
where = Encoder.enQuery(self,condition)
return self.db(where).count()
示例14: get_motor1_speed
def get_motor1_speed(self, tool_index):
"""
Gets the toohead's motor speed in Rotations per Minute (RPM)
@param int tool_index: The tool index that will be queried for Motor speed
@return int Duration of each rotation, in miliseconds
"""
response = self.tool_query(tool_index, slave_query_command_dict['GET_MOTOR_1_SPEED_RPM'])
[response_code, speed] = Encoder.unpack_response('<BI', response)
return speed
示例15: get_motor1_speed_PWM
def get_motor1_speed_PWM(self, tool_index):
"""
Gets the toohead's motor speed in as a 0 - 255 / 255 PWM duty cycle.
@param int tool_index: The tool index that will be queried for Motor speed
@return byte pwm : PWM duty cycle, 0% = 0, 100% = 255
"""
response = self.tool_query(tool_index, slave_query_command_dict['GET_MOTOR_1_SPEED_PWM'])
[response_code, pwm] = Encoder.unpack_response('<BB', response)
return pwm