erratic/motorpacket.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000
4  * Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
5  *
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  */
22 
23 /*
24  * $Id: motorpacket.h 9126 2013-10-06 17:19:18Z jpgr87 $
25  *
26  * part of the P2OS parser. methods for filling and parsing server
27  * information packets (ErraticMotorPackets)
28  */
29 #ifndef _ErraticMotorPacket_H
30 #define _ErraticMotorPacket_H
31 
32 #include <limits.h>
33 
34 #include "erratic.h"
35 
36 
38 {
39  private:
40  int PositionChange( unsigned short, unsigned short );
41  int param_idx; // index of our robot's data in the parameter table
42 
43  public:
44  // these values are returned in every standard ErraticMotorPacket
45  bool lwstall, rwstall;
46  unsigned char status, battery;
47  unsigned short ptu, timer, rawxpos;
48  unsigned short rawypos;
49  short angle, lvel, rvel, control;
50  int xpos, ypos;
51  int x_offset,y_offset,angle_offset;
52 
53  bool Parse( unsigned char *buffer, int length );
54  void Print();
55  void Fill(player_erratic_data_t* data);
56 
57  ErraticMotorPacket(int idx)
58  {
59  param_idx = idx;
60 
61  xpos = INT_MAX;
62  ypos = INT_MAX;
63  }
64 };
65 
66 #endif
Definition: erratic/motorpacket.h:37