Using our 32 bit linux VM, we will SSH into the Jetson which is the computer on board the vehicle. On the jetson, we will write code which provides instructions to the teensy microcontroller. The microcontroller generates pulse width modulation signals that the receiver on the car uses to move. The duty cyle input to the servo and ESC are what determine how much to throttle and what direction to reverse. We did the calculations to convert duty cycle input to PWM in our code.
We began by pulling the template code from Professor Behl's github and making adjustments to the files so it would compile and run on our Jetson. We wrote two nodes - keyboard.py and talker.py. Keyboard takes note off the keys pressed and publishes to a topic called drive_parameters. Talker subscribes to the topic drive_parameters and maps the duty cycle input to PWM as mentioned above and publishes to drive_pwm to give the car instructions.
We ran into some problems, beginning with difficulty connecting to the microcontroller. This was fixed by disconecting the lidar. Then after our code was written and we confirmed the write information was being published, we realized that there is a problem with the teensy firmware itself that prevented the car from receiving its commands. However, after our TA soldered two pins onto our teensy power board, the code worked. We are now able to control our car by moving the four arrow keys on a laptop. Below is a video of us controlling the car with the keyboard: