Creating a Linux program to control your mobile platform
So you know that you can set your servos. In this section, you'll create a program that will let you talk to your servos a bit more intuitively. You'll issue commands that tell the set of servos to go to specific angles, and they will go to those angles. You can then add a set of such commands to allow your legged mobile robot to lean left, lean right, or even take a step forward.
Let's start with a simple program that will make your legged mobile robot's servos go to 90 degrees (which should be somewhere close to the middle of the 180 degrees we can set. You'll start with the rc_test_servos
code and modify it. To do this, copy the code to its own directory, along with the Makefile
for these types of programs. Here is the code:
#include "/usr/include/rc_usefulincludes.h" #include "/usr/include/roboticscape.h" int main(int argc, char *argv[]){ double servo_pos; int frequency_hz = 50; // default 50hz frequency to send...