Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering Beaglebone Robotics

You're reading from  Mastering Beaglebone Robotics

Product type Book
Published in Dec 2014
Publisher
ISBN-13 9781783988907
Pages 234 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Richard Grimmett Richard Grimmett
Profile icon Richard Grimmett

Table of Contents (18) Chapters

Mastering BeagleBone Robotics
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Preparing the BeagleBone Black Building a Basic Tracked Vehicle Adding Sensors to Your Tracked Vehicle Vision and Image Processing Building a Robot that Can Walk A Robot that Can Sail Using GPS for Navigation Measuring Wind Speed – Integrating Analog Sensors An Underwater Remotely Operated Vehicle A Quadcopter An Autonomous Quadcopter Index

Creating a program on Linux to control your quadruped


You now know that you can talk to your servomotor controller, and move your servos. In this section, you'll create a Python program that will let you talk to your servos to move them to specific angles.

Let's start with a simple program that will make your legged mobile robot's servos go to 90 degrees (the middle of the 0 to 180 degrees you can set). This particular controller uses bytes of information, so the code will translate the input of the channel and angle to numbers that the controller can understand. For more details, see http://www.pololu.com/docs/0J40. Here is the code to move all the connected servos to the 90 degree point:

Here is an explanation of the code:

  • #! /usr/bin/python: This first line allows you to make this Python file executable from the command line.

  • import serial: This line imports the serial library. You need the serial library to talk to your unit via USB.

  • def setAngle(ser, channel, angle): This function converts...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}