#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <asm/io.h>
#include <time.h>
#include <sys/wait.h>
Defines | |
#define | interface_ymax_time 20000 |
Time it rakes to drive to robot form y_min to y_max. More... | |
#define | interface_xmax_time 20000 |
Time it rakes to drive to robot form x_min to x_max. More... | |
#define | interface_ymax 100 |
Maximal Y value (cosidered as 100 percent). More... | |
#define | interface_xmax 100 |
Maximal X value (cosidered as 100 percent). More... | |
#define | interface_ioport 0x378 |
IO Port to which lowest nible to robot is connected. More... | |
Functions | |
unsigned char | input (int addr) |
Read a byte from an IO port. More... | |
unsigned char | output (int addr, unsigned char out) |
Write a byte to an IO port. More... | |
void | msleep (int msec) |
Wait a specified number of milliseconds. More... | |
int | getmax (int a, int b) |
Get to highest number out of two input numbers. More... | |
int | getmin (int a, int b) |
Get to lowest number out of two input numbers. More... | |
void | interface_drive (int h, int v) |
Drive the robot in a specified direction. More... | |
void | interface_init (int mode) |
Initialze the interface and drive the robot to the start position. More... | |
void | interface_driveto (int x, int y) |
Drive to robot to absolute coordinates. More... | |
void | interface_stop () |
Stop the interface, switch all off. More... | |
Variables | |
int | interface_x |
current X possition of robot (global). More... | |
int | interface_y |
current X possition of robot (global). More... | |
int | interface_mode |
mode of interface: 0: normal, 1: simulation (do all except to drive the robot), 2: simulation with position-output 3: Blocked: Do nothing. More... |
The robot has four inputs whish are connected to the lower nible on IO port "interface_ioport". The bits are connected in this way (the signals a high-active):
Bit 0: Drive Up wires: switch to GND: yellow-green; +24V: gray-black
Bit 1: Dirve down wires: switch to GND: red-green; +24V: orange-black
Bit 2: Dirve right wires: switch to GND: green-red; +24V: yellow-black
Bit 3: Dirve left wires: switch to GND: white-red; +24V: red-blue
power wires: GND: blue; +24V: red
This interface assumes a linear dependency betwenn the coverence of distance and moving time. The 0,0 coordinates is left,bottom.
User functions are:
interface_init() - Initialze the interface and drive the robot to the start position (X=undefined; Y=0).
interface_driveto(int x, int y) - Drive the robot to the absolute coordinates x,y.
|
IO Port to which lowest nible to robot is connected.
|
|
Maximal X value (cosidered as 100 percent).
|
|
Time it rakes to drive to robot form x_min to x_max.
|
|
Maximal Y value (cosidered as 100 percent).
|
|
Time it rakes to drive to robot form y_min to y_max.
|
|
Get to highest number out of two input numbers.
|
|
Get to lowest number out of two input numbers.
|
|
Read a byte from an IO port.
|
|
Drive the robot in a specified direction. Any axies can be zero, greater than zero or less than zero, in this cases the robot will not driven, driven to increase to position (up[v,y] or right[h,x]) and decrease the position (down[-v,-y] or left[-h,-x]).
|
|
Drive to robot to absolute coordinates.
|
|
Initialze the interface and drive the robot to the start position.
|
|
Stop the interface, switch all off.
|
|
Wait a specified number of milliseconds.
|
|
Write a byte to an IO port.
|
|
mode of interface: 0: normal, 1: simulation (do all except to drive the robot), 2: simulation with position-output 3: Blocked: Do nothing.
|
|
current X possition of robot (global).
|
|
current X possition of robot (global).
|