本文整理汇总了Python中FileUtils.read_file_data方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.read_file_data方法的具体用法?Python FileUtils.read_file_data怎么用?Python FileUtils.read_file_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils.read_file_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GET
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import read_file_data [as 别名]
def GET(self, name):
if len(web.input().items()) == 0:
return "No parameters"
(copter_is_on, copter_torque, is_kill, control_force, z_axe_control) = FileUtils.read_file_data()
is_on = self.check_for_key_and_return('is_on', copter_is_on)
torque = self.check_for_key_and_return('copter_torque', copter_torque)
is_kill = self.check_for_key_and_return('kill', is_kill)
control_force = self.check_for_key_and_return('control_force', control_force)
z_axe_control = self.check_for_key_and_return('z_axe', z_axe_control)
if is_on != None and torque != None and is_kill != None:
FileUtils.write_file_data(is_on, torque, is_kill, control_force,z_axe_control)
print (is_on, torque, is_kill, control_force, z_axe_control)
return "ACK"
else:
return "Failed"
示例2: int
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import read_file_data [as 别名]
"echo {2}={3} > /dev/servoblaster;"
"echo {4}={5} > /dev/servoblaster;"
"echo {6}={7} > /dev/servoblaster;".format(int(Q1_MOTOR_ADDRESS), int(q1),
int(Q2_MOTOR_ADDRESS), int(q2),
int(Q3_MOTOR_ADDRESS), int(q3),
int(Q4_MOTOR_ADDRESS), int(q4)))
bus = smbus.SMBus(i2c_raspberry_pi_bus_number())
imu_controller = imu.IMU(bus, 0x69, 0x53, 0x1e, 0x77, "IMU")
imu_controller.set_compass_offsets(72, 72, -30)
motorTorques = CopterMotorTorquesResolver()
while True:
(copter_is_on, copter_torque, is_kill, control_force,z_axe_control) = FileUtils.read_file_data()
(pitch, roll, yaw, roll_vel, pitch_vel, yaw_vel) = imu_controller.read_pitch_roll_yaw_with_speeds()
(pressure, temperature) = imu_controller.read_temperature_and_pressure()
(rollTorque, pitchTorque, yawTorque) = motorTorques.calculateTorques(roll, pitch, yaw, roll_vel, pitch_vel,
yaw_vel, control_force)
motorSpeeds = motorTorques.calculateMotorSpeeds(rollTorque, pitchTorque, yawTorque, copter_torque,z_axe_control)
(q1, q2, q3, q4) = motorTorques.calculate_motor_adjusted_speeds(motorSpeeds)
# print "{0} {1} {2} {3} {4} {5} {6} {7} {8} {9}".format(q1, q2, q3, q4, rollTorque, pitchTorque, yawTorque,roll,pitch,yaw)
if is_kill:
FileUtils.write_file_data(True, 650, False,30,1000)
runMotors(MOTOR_STOPPED, MOTOR_STOPPED, MOTOR_STOPPED, MOTOR_STOPPED)
exit()
if copter_is_on:
print "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}".format(time.time(), pressure,
temperature, q1, q2, q3,
q4,