|
@@ -70,7 +70,7 @@ void adclog1(const char * strlog){
|
|
|
}
|
|
|
|
|
|
// gflags定义类型 描述
|
|
|
-DEFINE_bool(use_realveh, false, "set use real vehicle"); // bool位整型
|
|
|
+DEFINE_bool(use_realveh, true, "set use real vehicle"); // bool位整型
|
|
|
|
|
|
DECLARE_bool(use_realveh);
|
|
|
|
|
@@ -137,6 +137,7 @@ SimPerfectControl::SimPerfectControl(const MapService *map_service)
|
|
|
}
|
|
|
|
|
|
void SimPerfectControl::InitTimerAndIO() {
|
|
|
+ std::cout<<"init timer."<<std::endl;
|
|
|
localization_reader_ =
|
|
|
node_->CreateReader<LocalizationEstimate>(FLAGS_localization_topic);
|
|
|
localization_adc_reader_ = node_->CreateReader<LocalizationEstimate>(
|
|
@@ -416,12 +417,12 @@ void SimPerfectControl::Start() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void SimPerfectControl::Start(double x, double y) {
|
|
|
+void SimPerfectControl::Start(double x, double y,double v , double a ) {
|
|
|
std::lock_guard<std::mutex> lock(mutex_);
|
|
|
if (!enabled_) {
|
|
|
// Do not use localization info. use scenario start point to init start
|
|
|
// point.
|
|
|
- InitStartPoint(x, y, 0, 0);
|
|
|
+ InitStartPoint(x, y, v, a);
|
|
|
InternalReset();
|
|
|
sim_control_timer_->Start();
|
|
|
sim_prediction_timer_->Start();
|
|
@@ -460,13 +461,23 @@ void SimPerfectControl::RunOnce() {
|
|
|
|
|
|
TrajectoryPoint trajectory_point;
|
|
|
Chassis::GearPosition gear_position;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (!PerfectControlModel(&trajectory_point, &gear_position)) {
|
|
|
+ if(receiveadcloc == false){
|
|
|
AERROR << "Failed to calculate next point with perfect control model";
|
|
|
return;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- PublishChassis(trajectory_point.v(), gear_position);
|
|
|
+
|
|
|
+ PublishChassis(trajectory_point.v(), gear_position);
|
|
|
PublishLocalization(trajectory_point);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
bool SimPerfectControl::PerfectControlModel(
|
|
@@ -546,6 +557,7 @@ void SimPerfectControl::PublishChassis(double cur_speed,
|
|
|
chassis->set_steering_percentage(fcmdsteer_);
|
|
|
|
|
|
chassis_writer_->Write(chassis);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void SimPerfectControl::PublishLocalization(const TrajectoryPoint &point) {
|