Download PAI Programmer`s Manual

Transcript
Contents
Page
1. Introduction to PAI _______________________________________________________ 1
1.1 Where to get PAI_____________________________________________________________ 1
1.2 Related Resources ____________________________________________________________ 1
1.2.1
1.2.2
1.2.3
1.2.4
Manuals ________________________________________________________________________ 1
Development Platforms ____________________________________________________________ 1
Newgroups ______________________________________________________________________ 1
Support_________________________________________________________________________ 1
2. Programming with PAI____________________________________________________ 2
2.1 Installing PAI________________________________________________________________ 2
2.1.1 Windows95/NT __________________________________________________________________ 2
2.1.2 Unix ___________________________________________________________________________ 2
2.1.3 Linux __________________________________________________________________________ 2
2.2 PAI Directory Structure _______________________________________________________ 2
2.3 Creating PAI Programs _______________________________________________________ 2
2.3.1
2.3.2
2.3.3
2.3.4
2.3.5
PAI Source and Header ____________________________________________________________ 2
Environment Variables ____________________________________________________________ 2
Unix/Linux PAI Applications _______________________________________________________ 3
Makefile (Windows95/NT) _________________________________________________________ 3
Window and Non-Window Modes ___________________________________________________ 3
2.4 Sample PAI Application _______________________________________________________ 4
2.5 Possible Problems ____________________________________________________________ 4
3. The PAI Standard Library _________________________________________________ 5
3.1 Client-Server Connection ______________________________________________________ 5
3.1.1
3.1.2
3.1.3
3.1.4
Connecting a PAI Client with a Robot or the Simulator___________________________________ 5
Connection Examples _____________________________________________________________ 5
Disconnecting from the Robot Server _________________________________________________ 5
Connect/Disconnect Example _______________________________________________________ 5
3.2 Multiprocessing ______________________________________________________________ 6
3.2.1
3.2.2
3.2.3
3.2.4
3.2.5
Process Type ____________________________________________________________________ 6
Making Processes ________________________________________________________________ 6
Initializing Processes ______________________________________________________________ 6
Managing Processes_______________________________________________________________ 7
Multiprocessing Example __________________________________________________________ 7
3.3 Position and Motion___________________________________________________________ 8
3.3.1 Translation______________________________________________________________________ 8
3.3.2 Rotation ________________________________________________________________________ 9
3.3.3 Stopping the Robot _______________________________________________________________ 9
3.4 Status ______________________________________________________________________ 9
3.5 Sonars_____________________________________________________________________ 10
3.6 I/O________________________________________________________________________ 10
3.6.1
3.6.2
3.6.3
3.6.4
Digital Ports____________________________________________________________________ 10
A/D Port_______________________________________________________________________ 11
Timers ________________________________________________________________________ 11
Servo Port _____________________________________________________________________ 12
3.7 Miscellaneous _______________________________________________________________ 12
4. PAI Fast-Track Vision ___________________________________________________ 13
iii