Project

General

Profile

Revision 979

Added by Chris Mar about 15 years ago

minor changes to remote control / mapping code...wireless control works with libwireless reverted to rev. 887. code in odometry interrupt conflicts with motors, not allowing the robot to move motors in response to commands.

View differences:

test.c
4 4
#include "../../libwireless/lib/wireless.h"
5 5
#include <unistd.h>
6 6

  
7
#define CHAN 0xE
8

  
7 9
#define MAP 1   // packet group for receiving points
8 10
#define POINT_RAW 1 // packet type for map data points w/ raw encoder data
9 11
#define POINT_ODO 2 // packet type for map data points w/ odometry data
10 12

  
11 13
#define WL_CNTL_GROUP 4
12 14

  
13
#define CNTL_FORWARD 0
14
#define CNTL_BACK    1
15
#define CNTL_LEFT    2
16
#define CNTL_RIGHT   3
17
#define CNTL_LEFT_CURVE 4
18
#define CNTL_RIGHT_CURVE 5
19
#define CNTL_STOP    6
20
#define CNTL_VEL_UP  7
21
#define CNTL_VEL_DOWN 8
15
#define CNTL_FORWARD      0
16
#define CNTL_BACK         1
17
#define CNTL_LEFT         2
18
#define CNTL_RIGHT        3
19
#define CNTL_LEFT_CURVE   4
20
#define CNTL_RIGHT_CURVE  5
21
#define CNTL_STOP         6
22
#define CNTL_VEL_UP       7
23
#define CNTL_VEL_DOWN     8
22 24

  
23
void send_packet (char color, int dst_robot);
25
void send_packet (char type, int dst_robot);
24 26
void packet_receive(char type, int source, unsigned char* packet, int length);
25 27

  
26 28
PacketGroupHandler cntlHandler = {WL_CNTL_GROUP, NULL, NULL, NULL, NULL};
......
39 41
    int robot = atoi(argv[1]);
40 42

  
41 43
    printf("Beginning: robot=%d\r\n", robot);
42
	wl_init();
44
    wl_init();
43 45
	wl_set_com_port("/dev/ttyUSB1");
44
	wl_set_channel(0xE);
46
	wl_set_channel(CHAN);
45 47
	printf("Wireless initialized.\r\n");
46 48
	wl_register_packet_group(&cntlHandler);
47 49
	wl_register_packet_group(&receiveHandler);

Also available in: Unified diff