-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add several accelerations to custom output #939
Conversation
…) to custom output
…) to custom output
…ct/flow into jl-more-accel-outputs
* added function to kernel/vehicle to get number of not departed vehiles * fixed over indentation of the docstring * indentation edit * pep8 Co-authored-by: AboudyKreidieh <[email protected]>
* added function to kernel/vehicle to get number of not departed vehiles * fixed over indentation of the docstring * indentation edit * pep8 Co-authored-by: AboudyKreidieh <[email protected]>
…) to custom output
…) to custom output
flow/core/kernel/vehicle/traci.py
Outdated
self.__vehicles[veh_id]["accel_no_noise_no_failsafe"] = None | ||
self.__vehicles[veh_id]["accel_no_noise_with_failsafe"] = None | ||
self.__vehicles[veh_id]["accel_with_noise_no_failsafe"] = None | ||
self.__vehicles[veh_id]["accel_with_noise_with_failsafe"] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is a key existence check in all the get methods below. There is no need to initialize them here.
flow/core/kernel/vehicle/traci.py
Outdated
@@ -964,6 +967,20 @@ def apply_acceleration(self, veh_ids, acc): | |||
next_vel = max([this_vel + acc[i] * self.sim_step, 0]) | |||
self.kernel_api.vehicle.slowDown(vid, next_vel, 1e-3) | |||
|
|||
def apply_acceleration_not_smooth(self, veh_ids, acc): | |||
"""See parent class.""" | |||
# to hand the case of a single vehicle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: to handle
for i, vid in enumerate(veh_ids): | ||
if acc[i] is not None and vid in self.get_ids(): | ||
self.__vehicles[vid]["accel"] = acc[i] | ||
this_vel = self.get_speed(vid) | ||
next_vel = max([this_vel + acc[i] * self.sim_step, 0]) | ||
self.kernel_api.vehicle.setSpeed(vid, next_vel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this different than the normal method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the normal method uses slowDown() method which applies some sort of smoothing. here setSpeed() method is used which doesn't apply smoothing.
Pull request information
Description
Adding more accelerations to the custom data pipeline output.
target_accel_no_noise_no_failsafe
, new)target_accel_no_noise_with_failsafe
, formerlyaccel_without_noise
)target_accel_with_noise_no_failsafe
, new)target_accel_with_noise_with_failsafe
, formerlyacceleration
)