-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more logging, integrated xbee receive, verified xbee receive wo…
…rking properly
- Loading branch information
Showing
17 changed files
with
947 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* <serial_com.h> | ||
* | ||
* @brief Simplified serial utilities | ||
* | ||
* @author [email protected] (2004) | ||
* | ||
* @addtogroup SerialCom | ||
* @{ | ||
*/ | ||
|
||
#ifndef SERIAL_COM_H | ||
#define SERIAL_COM_H | ||
|
||
// clang-format off | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
/** | ||
* @brief Creates a basic fd, setting baud to 9600, raw data i/o | ||
* (no flow control, no fancy character handling. Configures | ||
* it for blocking reads. 8 data bits, 1 stop bit, no parity. | ||
* | ||
* @return the fd or -1 on error | ||
*/ | ||
int serial_open(const char *port, int baud, int blocking); | ||
|
||
/** @brief Set the baud rate, where the baudrate is just the integer value | ||
* desired. | ||
* | ||
* @return non-zero on error. | ||
*/ | ||
int serial_setbaud(int fd, int baudrate); | ||
|
||
/** | ||
* @brief Enable cts/rts flow control. | ||
* | ||
* @return non-zero on error. | ||
*/ | ||
int serial_enablectsrts(int fd); | ||
|
||
/** | ||
* @brief Enable xon/xoff flow control. | ||
* | ||
* @returns non-zero on error. | ||
*/ | ||
int serial_enablexon(int fd); | ||
|
||
/** | ||
* @brief Set the port to 8 data bits, 2 stop bits, no parity. | ||
* | ||
* @return non-zero on error. | ||
*/ | ||
int serial_set_N82(int fd); | ||
|
||
/** | ||
* @brief Closes the serial interface | ||
* | ||
* @return non-zero on error | ||
*/ | ||
int serial_close(int fd); | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
// clang-format on | ||
|
||
#endif /*__SERIAL_COM__ */ | ||
|
||
/* @} end group SerialCom */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* <xbee_receive.h> | ||
* | ||
* @brief Functions for connecting to and recieving xbee messages | ||
* | ||
* @addtogroup XbeeReceive | ||
* @{ | ||
*/ | ||
|
||
#ifndef XBEE_RECEIVE_H | ||
#define XBEE_RECEIVE_H | ||
|
||
#include <stdint.h> | ||
|
||
/** | ||
* @brief Possition and orientation data sent/received from xbee | ||
* | ||
* This message definition must be identical to the sending message. This depends on the ground | ||
* station and should be checked prior to using. There are many different xbee_packet_t's floating | ||
* around | ||
*/ | ||
typedef struct __attribute__((packed)) xbee_packet_t | ||
{ | ||
uint32_t time; ///< Unique id for the rigid body being described | ||
float x; ///< x-position in the Optitrack frame | ||
float y; ///< y-position in the Optitrack frame | ||
float z; ///< z-position in the Optitrack frame | ||
float qx; ///< qx of quaternion | ||
float qy; ///< qy of quaternion | ||
float qz; ///< qz of quaternion | ||
float qw; ///< qw of quaternion | ||
uint32_t trackingValid; ///< (bool) of whether or not tracking was valid (0 or 1) | ||
} xbee_packet_t; | ||
|
||
#define NUM_FRAMING_BYTES 4 ///< 2 START bytes + 2 Fletcher-16 checksum bytes | ||
#define OPTI_DATA_LENGTH sizeof(xbee_packet_t) ///< Actual Packet Being Sent | ||
#define OPTI_PACKET_LENGTH OPTI_DATA_LENGTH + NUM_FRAMING_BYTES | ||
|
||
extern xbee_packet_t xbeeMsg; | ||
extern int xbee_portID; | ||
|
||
/** | ||
* @brief Xbee initialization function | ||
* | ||
* @return 0 on success, -1 on failure | ||
*/ | ||
int XBEE_init(); | ||
|
||
/** | ||
* @brief Read message recieved from XBee | ||
* | ||
* @return 0 on success, -1 on failure | ||
*/ | ||
int XBEE_getData(); | ||
|
||
/** | ||
* @brief Print current XBee message to stdout | ||
*/ | ||
void XBEE_printData(); | ||
|
||
#endif /*__XBEE_RECEIVE__ */ | ||
|
||
/* @} end group XbeeReceive */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.