forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request RobotLocomotion#8745 from soonho-tri/fix-typo-in-a…
…utomotive Fix typo in automotive/steering_command_driver.py
- Loading branch information
Showing
3 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import lcm | ||
import unittest | ||
|
||
from drake.lcmt_driving_command_t import lcmt_driving_command_t as lcm_msg | ||
from drake.automotive.steering_command_driver import make_driving_command | ||
|
||
|
||
class SteeringCommandDriverTest(unittest.TestCase): | ||
def __init__(self, *args, **kwargs): | ||
super(SteeringCommandDriverTest, self).__init__(*args, **kwargs) | ||
self.lcm_tag = "EXAMPLE" | ||
self.acceleration = 0.5 | ||
self.steering_angle = 0.2 | ||
|
||
def handler(self, channel, data): | ||
msg = lcm_msg.decode(data) | ||
self.assertEqual(msg.acceleration, self.acceleration) | ||
self.assertEqual(msg.steering_angle, self.steering_angle) | ||
|
||
def test_make_driving_command(self): | ||
receiver = lcm.LCM() | ||
subscription = receiver.subscribe(self.lcm_tag, self.handler) | ||
sender = lcm.LCM() | ||
sender.publish(self.lcm_tag, | ||
make_driving_command(self.acceleration, | ||
self.steering_angle).encode()) | ||
receiver.handle() | ||
receiver.unsubscribe(subscription) |