Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-dev] I want to set a vehicle to parking mode when its battery is depleted.

Hi,
when actualBatteryCapacity is <0.1 I want it to stop on the street and go to parking mode, so that other cars can pass it. So in the notifyMove function I did:

std::vector<std::pair<SUMOTime, double> > speedTimeLine;
if (getActualBatteryCapacity() < 0.1) {
holder = libsumo::Helper::getVehicle(this->getHolder().getID());
speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), 0));
speedTimeLine.push_back(std::make_pair(SUMOTime_MAX - DELTA_T, 0));
holder->getInfluencer().setSpeedTimeLine(speedTimeLine);
if (holder->isParking()) {
WRITE_WARNING ("Vehicle '" + veh.getID() + "' is parking.");
}
else{ WRITE_WARNING ("Vehicle '" + veh.getID() + "' is not parking."); }


It is not in parking mode and other cars cant pass, what is the recommended way to set that? (IsParking is a const function,so I cant just do IsParking=true)
2. When I increase the actualBatteryCapacity again manually, it doesn't start up again which I would want. I think its because this code snippet is in the notifyMove function, so where would I put my code in instead?
Best,
Valentin

Back to the top