[工控机监控]验证各车型档位对自动驾驶的影响
This commit is contained in:
@@ -1129,6 +1129,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
}
|
||||
}, "1234567");*/
|
||||
}
|
||||
options.setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI);
|
||||
AdasManager.getInstance().create(options, this);
|
||||
AdasManager.getInstance().setOnAdasListener(this);
|
||||
/*两端数据转发 注释掉
|
||||
|
||||
@@ -13,6 +13,8 @@ import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@@ -41,6 +43,7 @@ import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityMan
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -64,11 +67,16 @@ public class VersionFragment extends BaseFragment {
|
||||
private CheckBox unregistered_check_all;
|
||||
private TextView hint_registered;
|
||||
private TextView hint_unregistered;
|
||||
private TextView can;
|
||||
private TextView gear_influence;
|
||||
private TextView gear;
|
||||
private TextView title_gear;
|
||||
private RadioButton rb_taxi;
|
||||
private RadioGroup rg;
|
||||
|
||||
private ConfigAdapter adapter;
|
||||
private InterfaceAdapter unregisteredAdapter;
|
||||
private InterfaceAdapter registeredAdapter;
|
||||
private Set[] unableGears;
|
||||
|
||||
private int role = Constants.TERMINAL_ROLE.DEBUG;//角色 默认调试屏
|
||||
|
||||
@@ -134,6 +142,12 @@ public class VersionFragment extends BaseFragment {
|
||||
Button btn2 = view.findViewById(R.id.btn2);
|
||||
ipsView = view.findViewById(R.id.ips_view);
|
||||
recyclerView = view.findViewById(R.id.config_list);
|
||||
rb_taxi = view.findViewById(R.id.rb_taxi);
|
||||
can = view.findViewById(R.id.can);
|
||||
gear_influence = view.findViewById(R.id.gear_influence);
|
||||
gear = view.findViewById(R.id.gear);
|
||||
title_gear = view.findViewById(R.id.title_gear);
|
||||
rg = view.findViewById(R.id.rg);
|
||||
initFragmentRecyclerView();
|
||||
CupidLogUtils.w("InfoFragment===>" + title);
|
||||
tvTitle.setText(title);
|
||||
@@ -176,7 +190,36 @@ public class VersionFragment extends BaseFragment {
|
||||
view.findViewById(R.id.line1).setVisibility(View.GONE);
|
||||
tvTitle.setText("版本");
|
||||
}
|
||||
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId == R.id.rb_taxi) {
|
||||
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI);
|
||||
gear("TAXI", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI.toArray()));
|
||||
} else if (checkedId == R.id.rb_bus) {
|
||||
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_BUS);
|
||||
gear("BUS", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_BUS.toArray()));
|
||||
} else if (checkedId == R.id.rb_sweeper) {
|
||||
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_SWEEPER);
|
||||
gear("SWEEPER", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_SWEEPER.toArray()));
|
||||
} else if (checkedId == R.id.rb_m1) {
|
||||
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M1);
|
||||
gear("M1", "无限制");
|
||||
} else if (checkedId == R.id.rb_m2) {
|
||||
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M2);
|
||||
gear("M1", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M2.toArray()));
|
||||
} else if (checkedId == R.id.rb_van) {
|
||||
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_VAN);
|
||||
gear("VAN", "无限制");
|
||||
}
|
||||
}
|
||||
});
|
||||
gear("TAXI", Arrays.toString(BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI.toArray()));
|
||||
}
|
||||
|
||||
private void gear(String car, String gear) {
|
||||
title_gear.setText(car + "不能启动自动驾驶的档位:");
|
||||
this.gear.setText(gear);
|
||||
}
|
||||
|
||||
//根据连接状态更新数据
|
||||
@@ -218,59 +261,37 @@ public class VersionFragment extends BaseFragment {
|
||||
|
||||
list.add(new Config("ADAS LIB版本:", AdasManager.getInstance().getAdasVersion()));
|
||||
list.add(new Config("APP构建时间:", BuildConfig.BUILD_TIME));
|
||||
list.add(getAutopilotAbilityConfig(""));
|
||||
list.add(gear());
|
||||
adapter.setData(list);
|
||||
}
|
||||
|
||||
private Config gear() {
|
||||
private String gear() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Chassis.GearPosition gear = App.INSTANCE.gear;
|
||||
if (gear != null) {
|
||||
if (unableGears == null) {
|
||||
unableGears = new Set[6];
|
||||
unableGears[0] = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_BUS;
|
||||
unableGears[1] = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M1;
|
||||
unableGears[2] = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_M2;
|
||||
unableGears[3] = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_SWEEPER;
|
||||
unableGears[4] = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_TAXI;
|
||||
unableGears[5] = BuildConfig.UNABLE_LAUNCH_AUTOPILOT_GEAR_VAN;
|
||||
}
|
||||
for (int j = 0; j < unableGears.length; j++) {
|
||||
String type = "";
|
||||
if (j == 0) {
|
||||
type = "BUS";
|
||||
} else if (j == 1) {
|
||||
type = "M1";
|
||||
} else if (j == 2) {
|
||||
type = "M2";
|
||||
} else if (j == 3) {
|
||||
type = "SWEEPER";
|
||||
} else if (j == 4) {
|
||||
type = "TAXI";
|
||||
} else if (j == 5) {
|
||||
type = "VAN";
|
||||
}
|
||||
AutopilotAbilityManager.getInstance().setUnableLaunchAutopilotGear(unableGears[j]);
|
||||
boolean b = AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear);
|
||||
builder.append("车型:").append(type);
|
||||
builder.append(" 当前档位:").append(gear.name());
|
||||
builder.append(" 是否可以启动自驾:").append(b).append('\n');
|
||||
}
|
||||
boolean b = AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear);
|
||||
builder.append(" 当前档位:").append(gear.name());
|
||||
builder.append(" 是否可以启动自驾:").append(b);
|
||||
}
|
||||
return new Config("档位影响:", builder.toString());
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private Config getAutopilotAbilityConfig(String value) {
|
||||
return new Config("能否启动自动驾驶:", value);
|
||||
private String getAutopilotAbilityConfig(String value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void autopilotAbility(boolean isAutopilotAbility, String unableAutopilotReason) {
|
||||
List<Config> list = adapter.getData();
|
||||
if (list != null) {
|
||||
updateRefreshConfig(list, getAutopilotAbilityConfig(isAutopilotAbility + ",原因:" + unableAutopilotReason));
|
||||
updateRefreshConfig(list, gear());
|
||||
}
|
||||
if (getActivity() != null)
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
can.setTextColor(getResources().getColor(RandomColor.randomColor()));
|
||||
can.setText(getAutopilotAbilityConfig(isAutopilotAbility + ",原因:" + unableAutopilotReason));
|
||||
gear_influence.setTextColor(getResources().getColor(RandomColor.randomColor()));
|
||||
gear_influence.setText(gear());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void updateRefreshConfig(List<Config> list, Config temp) {
|
||||
|
||||
@@ -33,12 +33,155 @@
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/config_list"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_gear_influence"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="档位影响:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gear_influence"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_gear"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@id/layout_gear_influence"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_gear"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="车型档位:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gear"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_can"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@id/layout_gear"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="能否启动自动驾驶:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/can"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_car"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@id/layout_can"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/car_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前车型:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/rg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@id/car_type"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_taxi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="TAXI" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_bus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="BUS" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_sweeper"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="SWEEPER" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_m1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="M1" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_m2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="M2" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_van"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="VAN" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/config_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/layout_car"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
@@ -88,7 +87,7 @@ public class AutopilotAbilityManager {
|
||||
if (version != -1) {
|
||||
stopTimer();
|
||||
dockerVersion = version;
|
||||
Log.i("dddd", "工控机版本=" + dockerVersion);
|
||||
CupidLogUtils.i(TAG, "工控机版本=" + dockerVersion);
|
||||
initAutopilotAbility();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user