Is used on the control computer respectively operating computer to control the RobotCar. At first you have to make sure that the roscore is running and the robotcar-pkg is publishing informations.
As recommended in the ROS Tutorials the control computer respectively operating computer should run the roscore. So at first open a terminal window and execute roscore. After that open a second terminal window and run rosrun robotcar_controller controller.py.
The String variable robot_host uses the hostname of one RobotCar. As example it could be robotcar.
The following table shows the needed key's for controlling the RobotCar:
| Key | Function |
|---|---|
| W | forward acceleration or break if driving backwards |
| A | left steering or turning back to neutral if steering right |
| S | backward acceleration or break if driving forwards |
| D | right steering or turning back to neutral if steering left |
| Q | stops the motor / engine |
| E | turn the steering to neutral |
| CTRL + C | Quits the program |
The Controller is publishing to the Control Node of the RobotCar. It uses the pynput library for key down and key up. So if a key is pressed the RobotCar will active change its behavious as the driver wants. If not key is pressed the Controller will slow down the speed and the steer turns slowly back to neutral. Means it will permanently published to Control Node.
| Topic Address | Message Type |
|---|---|
| robot_host + /control/speed | std_msgs/Float64 |
| robot_host + /control/steer | std_msgs/Float64 |
An ADAS would intervene similarly in the driving process.