Skip to content

Commit

Permalink
Merge pull request #163 from yoh-there/master
Browse files Browse the repository at this point in the history
Vastly improved braking. Some doubts about factors used, but ready for release.
  • Loading branch information
yoh-there committed Nov 1, 2015
2 parents 1f3c581 + 0ed1b9c commit 69b97df
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
25 changes: 17 additions & 8 deletions app/src/main/java/lu/fisch/canze/activities/DrivingActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ public class DrivingActivity extends CanzeActivity implements FieldListener {
// free data
public static final String SID_Pedal = "186.40";
public static final String SID_MeanEffectiveTorque = "18a.16";
public static final String SID_BrakePressure = "352.24";
public static final String SID_RealSpeed = "5d7.0";
public static final String SID_SoC = "654.24";
public static final String SID_RangeEstimate = "654.42";
public static final String SID_DriverBrakeWheel_Torque_Request = "130.44"; // braking wheel torque the driver wants
public static final String SID_ElecBrakeWheelsTorqueApplied = "1f8.28"; //10ms

// ISO-TP data
// public static final String SID_EVC_SoC = "7ec.622002.24"; // (EVC)
Expand All @@ -43,10 +44,12 @@ public class DrivingActivity extends CanzeActivity implements FieldListener {
public static final String SID_EVC_TractionBatteryVoltage = "7ec.623203.24"; // (EVC)
public static final String SID_EVC_TractionBatteryCurrent = "7ec.623204.24"; // (EVC)

private double dcVolt = 0; // holds the DC voltage, so we can calculate the power when the amps come in
private int odo = 0;
private int destOdo = 0; // have to init from save file
private double realSpeed = 0;
private double dcVolt = 0; // holds the DC voltage, so we can calculate the power when the amps come in
private int odo = 0;
private int destOdo = 0; // have to init from save file
private double realSpeed = 0;
private double driverBrakeWheel_Torque_Request = 0;

private ArrayList<Field> subscribedFields;

@Override
Expand Down Expand Up @@ -210,7 +213,8 @@ private void initListeners() {

addListener(SID_Pedal);
addListener(SID_MeanEffectiveTorque);
addListener(SID_BrakePressure);
addListener(SID_DriverBrakeWheel_Torque_Request);
addListener(SID_ElecBrakeWheelsTorqueApplied);
addListener(SID_RealSpeed);
addListener(SID_SoC);
addListener(SID_RangeEstimate);
Expand Down Expand Up @@ -298,9 +302,14 @@ public void run() {
}
tv = null;
break;
case SID_BrakePressure:
case SID_DriverBrakeWheel_Torque_Request:
driverBrakeWheel_Torque_Request = field.getValue();
tv = null;
break;
case SID_ElecBrakeWheelsTorqueApplied:
double frictionBrakeTorque = driverBrakeWheel_Torque_Request - field.getValue();
pb = (ProgressBar) findViewById(R.id.FrictionBreaking);
pb.setProgress((int) (field.getValue() * realSpeed));
pb.setProgress((int) (frictionBrakeTorque * realSpeed));
break;
}
// set regular new content, all exeptions handled above
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/lu/fisch/canze/actors/Fields.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,11 @@ private void fillStatic()
+"0x130, 11, 12, 1, 1, 0, 0, HBB_Malfunction %1ld, , , , HBB_Malfunction, 0, 0, 10\n"
+"0x130, 16, 17, 1, 1, 0, 0, EB_Malfunction %ld, , , , EB_Malfunction, 0, 0, 10\n"
+"0x130, 18, 19, 1, 1, 0, 0, EB_inProgress %1ld, , , , EB_inProgress, 0, 0, 10\n"
+"0x130, 20, 31, 1, -1, 4049, 0, ElBrkWhTqReq %4d , Nm, , , ElecBrakeWheelsTorqueRequest, 0, 0, 10\n"
+"0x130, 20, 31, 1, -1, 4094, 0, ElBrkWhTqReq %4d , Nm, , , ElecBrakeWheelsTorqueRequest, 0, 0, 10\n"
+"0x130, 32, 38, 1, 1, 0, 0, BrakePedalDriverWill %3ld, %, , , BrakePedalDriverWill, 0, 0, 10\n"
+"0x130, 40, 41, 1, 1, 0, 0, HBA_ActivationRequest %1ld, , , , HBA_ActivationRequest, 0, 0, 10\n"
+"0x130, 42, 43, 1, 1, 0, 0, PressureBuildUp %1ld, , , , PressureBuildUp, 0, 0, 10\n"
+"0x130, 44, 55, 1, -3, 4049, 0, DriverBrakeWheelTq_Req %4ld, Nm, , , DriverBrakeWheelTq_Req , 0, 0, 10\n"
+"0x130, 44, 55, 1, -3, 4094, 0, DriverBrakeWheelTq_Req %4ld, Nm, , , DriverBrakeWheelTq_Req , 0, 0, 10\n"
+"0x130, 56, 63, 1, 1, 0, 0, CheckSum_UBP %3ld, , , , CheckSum_UBP, 0, 0, 10\n"
+"0x130, 8, 10, 1, 1, 0, 0, UBP_Clock %1ld, , , , UBP_Clock, 0, 0, 10\n"
+"0x17e, 40, 41, 1, 1, 0, 0, , , , , CrankingAuthorisation_AT, 0, 0, 10\n"
Expand All @@ -363,7 +363,7 @@ private void fillStatic()
+"0x18a, 27, 38, 1, 5, 800, 10, FrictionTorque: %4ld, Nm, , , , 0, 0, 10\n"
+"0x1f6, 20, 20, 1, 5, 0, 10, Break pedal: %4ld, , , , Break Pedal, 0, 0, 10\n"

+"0x1f8, 16, 27, 1, -1, 4096, 0, TotalPotentialResistiveWheelsTorque: %4ld, Nm, , , TotalPotentialResistiveWheelsTorque, 0, 0, 10\n"
+"0x1f8, 16, 27, 1, 1, 2048, 0, TotalPotentialResistiveWheelsTorque: %4ld, Nm, , , TotalPotentialResistiveWheelsTorque, 0, 0, 10\n"
+"0x1f8, 28, 39, 1, -1, 4096, 0, ElecBrakeWheelsTorqueApplied: %4ld, Nm, , , ElecBrakeWheelsTorqueApplied, 0, 0, 10\n"

+"0x1fd, 0, 7, 1, 5, 0, 10, Amp 12V: %2ld.%01ld, A, , , 12V Battery Current, 0, 0, 100\n"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_braking.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
android:layout_height="wrap_content"
android:minHeight="25dp"
android:max="4096"
android:progressDrawable="@drawable/progressbar_canze"
android:progressDrawable="@drawable/progressbar_canze_red"
/>
<!--
<TextView
Expand Down

0 comments on commit 69b97df

Please sign in to comment.