Search This Blog

Friday, September 30, 2016

Ros Tutorials: Failsafe and Control

I'm back!

Today, we are going to look at how to add a failsafe and make a program that communicates with the computer.

First a schematic.

This is the schematic for the failsafe controller. I put this inside a small box with a battery so I could carry it in my hand without cords. The XBee radio inside is paired to a Xbee on the robot, connected to the Serial2 port on the Mega. That step should be fairly simple. Now here is the code for the failsafe controller:

And here is the code for the Mega on-board the robot:

This sets the failsafe such that, when the failsafe is activated, the led on the controller goes on. The failsafe can be activated one of two ways:
1. The Mega doesn't hasn't received a command in the past 500ms.
2. The button on the controller was pushed.
When the failsafe deactivates, the robot stops, and the LED will go off.

That's all for now!