![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
2011
Diff: function_utilities/function_utilities.cpp
- Revision:
- 48:889798ff9329
- Parent:
- 46:2694daea349b
- Child:
- 49:e7bcfc244d40
diff -r fdcb8bd86fd6 -r 889798ff9329 function_utilities/function_utilities.cpp --- a/function_utilities/function_utilities.cpp Tue Jan 21 13:39:27 2020 +0000 +++ b/function_utilities/function_utilities.cpp Wed Jan 29 13:50:24 2020 +0000 @@ -82,8 +82,8 @@ int16_t VALVE_LIMIT_PLUS; int16_t VALVE_LIMIT_MINUS; -int16_t ENC_PULSE_PER_POSITION; -int16_t TORQUE_SENSOR_PULSE_PER_TORQUE; +float ENC_PULSE_PER_POSITION; +float TORQUE_SENSOR_PULSE_PER_TORQUE; float PRES_SENSOR_A_PULSE_PER_BAR = 4096.0f / 200.0f; float PRES_SENSOR_B_PULSE_PER_BAR = 4096.0f / 200.0f; @@ -328,7 +328,7 @@ int i = 0; float output = 0; - int vn = (int) ((float) input / 10.); + int vn = (int) ((float) input / 10.0f); int en = input % 10; float temp = 1.; @@ -393,8 +393,8 @@ writer.write(RID_STROKE,(int) STROKE); writer.write(RID_VALVE_LIMIT_MINUS,(int) VALVE_LIMIT_MINUS); writer.write(RID_VALVE_LIMIT_PLUS,(int) VALVE_LIMIT_PLUS); - writer.write(RID_ENC_PULSE_PER_POSITION,(int) ENC_PULSE_PER_POSITION); - writer.write(RID_TORQUE_SENSOR_PULSE_PER_TORQUE,(int) TORQUE_SENSOR_PULSE_PER_TORQUE); + writer.write(RID_ENC_PULSE_PER_POSITION,(int) (ENC_PULSE_PER_POSITION*10.0f)); + writer.write(RID_TORQUE_SENSOR_PULSE_PER_TORQUE,(int) (TORQUE_SENSOR_PULSE_PER_TORQUE * 100.0f)); writer.write(RID_PRES_SENSOR_A_PULSE_PER_BAR,(int) (PRES_SENSOR_A_PULSE_PER_BAR * 100.0f)); writer.write(RID_PRES_SENSOR_B_PULSE_PER_BAR,(int) (PRES_SENSOR_B_PULSE_PER_BAR * 100.0f)); writer.write(RID_FRICTION,(int) (FRICTION * 10.0f)); @@ -435,16 +435,15 @@ void ROM_CALL_DATA(void) { BNO = flashReadInt(Rom_Sector, RID_BNO); - BNO = 11; OPERATING_MODE = flashReadInt(Rom_Sector, RID_OPERATING_MODE); CAN_FREQ = flashReadInt(Rom_Sector, RID_CAN_FREQ); DIR_JOINT_ENC = flashReadInt(Rom_Sector, RID_JOINT_ENC_DIR); DIR_VALVE = flashReadInt(Rom_Sector, RID_VALVE_DIR); DIR_VALVE_ENC = flashReadInt(Rom_Sector, RID_VALVE_ENC_DIR); SUPPLY_VOLTAGE = (float) (flashReadInt(Rom_Sector, RID_VOLATGE_SUPPLY)) *0.1f; - SUPPLY_VOLTAGE = 12000.0f; +// SUPPLY_VOLTAGE = 12000.0f; VALVE_VOLTAGE_LIMIT = (float) (flashReadInt(Rom_Sector, RID_VOLTAGE_VALVE)) * 0.1f; - VALVE_VOLTAGE_LIMIT = 12000.0f; +// VALVE_VOLTAGE_LIMIT = 12000.0f; P_GAIN_VALVE_POSITION = flashReadInt(Rom_Sector, RID_P_GAIN_VALVE_POSITION); I_GAIN_VALVE_POSITION = flashReadInt(Rom_Sector, RID_I_GAIN_VALVE_POSITION); D_GAIN_VALVE_POSITION = flashReadInt(Rom_Sector, RID_D_GAIN_VALVE_POSITION); @@ -473,14 +472,15 @@ STROKE = flashReadInt(Rom_Sector, RID_STROKE); VALVE_LIMIT_MINUS = flashReadInt(Rom_Sector, RID_VALVE_LIMIT_MINUS); VALVE_LIMIT_PLUS = flashReadInt(Rom_Sector, RID_VALVE_LIMIT_PLUS); - ENC_PULSE_PER_POSITION = flashReadInt(Rom_Sector, RID_ENC_PULSE_PER_POSITION); - ENC_PULSE_PER_POSITION = (float) 1024.0f; - TORQUE_SENSOR_PULSE_PER_TORQUE = flashReadInt(Rom_Sector, RID_TORQUE_SENSOR_PULSE_PER_TORQUE); - TORQUE_SENSOR_PULSE_PER_TORQUE = (float) 2048.0f/5000.0f; + ENC_PULSE_PER_POSITION = (float) (flashReadInt(Rom_Sector, RID_ENC_PULSE_PER_POSITION)) * 0.1f; +// ENC_PULSE_PER_POSITION = (float) 1024.0f; + TORQUE_SENSOR_PULSE_PER_TORQUE = (float) (flashReadInt(Rom_Sector, RID_TORQUE_SENSOR_PULSE_PER_TORQUE)) * 0.01f; + //TORQUE_SENSOR_PULSE_PER_TORQUE = (float) 0.41928f; //for ankle +// TORQUE_SENSOR_PULSE_PER_TORQUE = (float) 10000.0f/2048.0f; //for knee PRES_SENSOR_A_PULSE_PER_BAR = (float) (flashReadInt(Rom_Sector, RID_PRES_SENSOR_A_PULSE_PER_BAR)) * 0.01f; - PRES_SENSOR_A_PULSE_PER_BAR = 4096.0f / 200.0f; +// PRES_SENSOR_A_PULSE_PER_BAR = 4096.0f / 200.0f; PRES_SENSOR_B_PULSE_PER_BAR = (float) (flashReadInt(Rom_Sector, RID_PRES_SENSOR_B_PULSE_PER_BAR)) * 0.01f; - PRES_SENSOR_B_PULSE_PER_BAR = 4096.0f / 200.0f; +// PRES_SENSOR_B_PULSE_PER_BAR = 4096.0f / 200.0f; FRICTION = (float) (flashReadInt(Rom_Sector, RID_FRICTION)) * 0.1f; HOMEPOS_OFFSET = flashReadInt(Rom_Sector, RID_HOMEPOS_OFFSET); HOMEPOS_VALVE_OPENING = flashReadInt(Rom_Sector, RID_HOMEPOS_VALVE_OPENING); @@ -510,7 +510,7 @@ K_SPRING = flashReadInt(Rom_Sector, RID_K_SPRING); D_DAMPER = flashReadInt(Rom_Sector, RID_D_DAMPER); - + } /*******************************************************************************