This is a README file to explain the DBW Node(drive-by-wire node) that I´m working on the Running-Out-Of-Fuel Team for Self Driving Car Nanodegree Capstone.
This node subscribe the topics:
- /current_velocity
- /twist_cmd
- /vehicle/dbw_enabled
Publish steering, throttle, and brake commands to:
- /vehicle/steering_cmd
- /vehicle/throttle_cmd
- /vehicle/brake_cmd
DBWNode receives subscribed messages and pass the messages to Controller instance and receive result, finally publishes to vehicle command nodes.
- Define capacities and min/max values .
- Create publisher nodes for steering, throttle, and brake.
- Create Controller instance.
- Set subscriber and callbacks.
- Start loop for publishing messages.
- Check wheather dbw is enabled.
- Pass the current values to controller instance.
- Publish the messages
- Create ThrottleCmd instance.
- Set throttle value.
- Publish the message to /vehicle/throttle_cmd topic.
- Create SteeringCmd instance.
- Set steering angle value.
- Publish the message to /vehicle/steering_cmd topic.
- Create BrakeCmd instance.
- Set brake value.
- Publish the message to /vehicle/brake_cmd topic.
- Receive the message from /current_velocity topic.
- Set current value to self.current_velocity for next publish.
- Receive the message from /twist_cmd topic.
- Set current value to self.twist_cmd for next publish.
- Receive the message from /vehicle/dbw_enabled topic.
- Set current value to self.dbw_enabled for next publish.
Controller has PID and YawController instances for calculate next movement.
Receive maximum values for controling the vehicle. Create PID and YawController instances with received values.
- Calculate delta time since last call.
- Check if dbw is enabled.
- Calculate next throttle, brake values using PID with received values.
- Calculate next steering angle using YawController with received values.
DBWNode will calculate next actions for throttle, brake, and steering angle and publish the values for vehicle control system.