Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
184 bug reduce artifical speed limit if actual speed limit is not kno…
Browse files Browse the repository at this point in the history
…wn (#196)

# Description

Lowered the speed limit to a more reasonable value. For testing this
value is set so that it should not interfere with the `max_velocity`
(around 130 km/h).

Fixes #184 

## Time invested

~30 min @schwalga 

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Does this PR introduce a breaking change?

No

## Most important changes

Basically just reduced float("inf") to a variable and tested the
changes, therefore not a whole lot changed.

# Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works (might be obsolete with CI later on)
- [x] New and existing unit tests pass locally with my changes (might be
obsolete with CI later on)
  • Loading branch information
nylser authored Feb 22, 2023
2 parents 002b555 + c24b653 commit f9e90bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion code/acting/src/acting/velocity_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from simple_pid import PID
from std_msgs.msg import Float32

SPEED_LIMIT_DEFAULT: float = 36.0


class VelocityController(CompatibleNode):
"""
Expand Down Expand Up @@ -83,7 +85,10 @@ def loop(timer_event=None):
"publish a throttle value")
return
if self.__speed_limit is None or self.__speed_limit < 0:
self.__speed_limit = float("inf")
self.logdebug("VelocityController hasn't received a acceptable"
" speed_limit yet. speed_limit has been set to"
f"default value {SPEED_LIMIT_DEFAULT}")
self.__speed_limit = SPEED_LIMIT_DEFAULT
if self.__max_velocity < 0:
self.logerr("Velocity controller doesn't support backward "
"driving yet.")
Expand Down
4 changes: 2 additions & 2 deletions code/acting/src/acting/velocity_publisher_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __init__(self):
Float32,
f"/carla/{self.role_name}/max_velocity",
qos_profile=1)
self.velocity = 4
self.velocity = 4.0
self.delta_velocity = 0.125
self.max_velocity = 5
self.max_velocity = 5.5
self.min_velocity = 4
self.__dv = self.delta_velocity

Expand Down

0 comments on commit f9e90bc

Please sign in to comment.