Revision 5d0687a9
ID | 5d0687a9991d806c94fc7c21405334e6717e3611 |
Small changes to wireless, and starting turning with line following.
scout/libscout/src/WirelessSender.h | ||
---|---|---|
31 | 31 |
* Contains functions and definitions for the use of |
32 | 32 |
* XBee wireless |
33 | 33 |
* |
34 |
* Uses the dest field of the wireless packet to specify which |
|
35 |
* scout the message is intended for, or SCOUT_ALL to send to |
|
36 |
* all scouts |
|
37 |
* |
|
34 | 38 |
* @author Colony Project, CMU Robotics Club |
35 | 39 |
* @author Tom Mullins |
36 | 40 |
**/ |
... | ... | |
43 | 47 |
#include "messages/WirelessPacket.h" |
44 | 48 |
#include "constants.h" |
45 | 49 |
|
50 |
/// A macro to allow sending to all the scouts. |
|
51 |
#define SCOUT_ALL (messages::WirelessPacket::DEST_BROADCAST) |
|
52 |
|
|
46 | 53 |
class WirelessSender |
47 | 54 |
{ |
48 | 55 |
public: |
49 |
WirelessSender(uint16_t type = 0,
|
|
50 |
uint16_t dest = messages::WirelessPacket::DEST_BROADCAST,
|
|
56 |
WirelessSender(const ros::NodeHandle& libscout_node,
|
|
57 |
uint16_t type = 0,
|
|
51 | 58 |
uint16_t pan = messages::WirelessPacket::PAN_DEFAULT, |
52 | 59 |
uint16_t channel = messages::WirelessPacket::CHANNEL_DEFAULT); |
53 | 60 |
|
54 | 61 |
void setType(uint16_t type); |
55 |
void setDest(uint16_t dest); |
|
56 | 62 |
void setPan(uint16_t pan); |
57 | 63 |
void setChannel(uint16_t channel); |
58 | 64 |
|
59 |
void send(uint8_t data[], int length); |
|
60 |
void send(std::vector<uint8_t>& data); |
|
65 |
void send(uint8_t data[], int length, uint16_t dest = SCOUT_ALL);
|
|
66 |
void send(std::vector<uint8_t>& data, uint16_t dest = SCOUT_ALL);
|
|
61 | 67 |
|
62 | 68 |
private: |
63 |
ros::NodeHandle nh;
|
|
69 |
ros::NodeHandle node;
|
|
64 | 70 |
ros::Publisher pub; |
65 | 71 |
messages::WirelessPacket packet; |
66 |
|
|
67 |
void publish(); |
|
68 | 72 |
}; |
69 | 73 |
|
70 | 74 |
#endif |
Also available in: Unified diff