Skip to content
Snippets Groups Projects
Commit dd6ca24a authored by David's avatar David
Browse files

update message definition

parent 9eb81d6d
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,11 @@ The UWB Interface package was designed to publish ranging data received from the
Field | Data Type/Size | Units
--- | --- | ---
Source Address | (16 character hex string) |
Anchor Address | (16 character hex string) |
Tag Address | (16 character hex string) |
Range | (32 bit integer) | mm
Raw Range | (32 bit integer) | mm
**_NOTE:_** //TODO explain the difference between range and raw range
## Setup
......@@ -17,7 +16,7 @@ Raw Range | (32 bit integer) | mm
//TODO say how to determine the correct serial path.
**_NOTE:_** This package requires that the EVK1000s be loaded with the firmware found in the `uwb-firmware` repository; it will not work with stock firmware.
**_NOTE:_** This package requires that the EVK1000s be loaded with the firmware found in the `uwb-firmware` repository. It will not work with stock firmware.
## Running
......@@ -28,7 +27,7 @@ The UWB Interface package can be run with the following:
rosrun uwb_interface uwb_interface_node -p /dev/ttyAMC0
```
**_NOTE:_** Roscore must be running first.
**_NOTE:_** Roscore must be running first.\
**_NOTE:_** The argument after `-p` is the path to the USB port connection and may not be the same as listed above. See the [Setup Section](##Setup) for how to find the correct path.
To test that the node is functioning correctly run the following in another terminal
......@@ -40,9 +39,9 @@ rostopic echo /uwb/range
If functioning correctly, messages similar to the following should periodically be printed to the terminal.
```
source_address: "109862205f8b5950"
tag_address: "109862205f8b5950"
anchor_address: "112767325102118c"
range: 559
range_raw: 389
---
```
\ No newline at end of file
string source_address
string tag_address
string anchor_address
int32 range
int32 range_raw
\ No newline at end of file
int32 range
\ No newline at end of file
......@@ -237,10 +237,7 @@ namespace uwb_interface{
printf("UWB address wrong length: %s \n", token);
return;
}
//TODO add source address to range_msg
//TODO remove t,a from range_msg
//TODO remove rng_raw from range_msg
range_msg.source_address = token; //cast to string?
break;
case 1: //anchor address
......@@ -283,87 +280,4 @@ namespace uwb_interface{
uwb_range_pub.publish(range_msg);
}
}
// void publish_serial_data(char data[])
// {
// //TODO modify this to catch multiple lines
// //the UWB sends a single string with the following information over USB for each range calculation:
// //the values are hexidecimal encoded and space separated.
// //source address (16 character)
// //ranging anchor address (16 characters)
// //ranging tag address (16 characters)
// //range (8 characters)
// //The values are in contained in a single string separated by
// //strip carriage return (\r) and newline (\n) from the end of the character array
// data[59] = ' ';
// data[60] = ' ';
// // Returns first token
// char *token = strtok(data, " ");
// // Keep printing tokens while one of the
// // delimiters present in str[].
// int idx = 0;
// while (token != NULL)
// {
// // printf("token: %s, idx: %i \n", token, idx);
// switch(idx)
// {
// case 0: //check if data is from anchor or tag
// if(!(strlen(token) == 4 || strlen(token) == 16)){
// printf("UWB address wrong length: %s \n", token);
// return;
// }
// //TODO add source address to range_msg
// //TODO remove t,a from range_msg
// //TODO remove rng_raw from range_msg
// break;
// case 1: //anchor address
// if(!(strlen(token) == 4 || strlen(token) == 16)){
// printf("anchor address wrong length: %s \n", token);
// return;
// }
// range_msg.anchor_address = token; //cast to string?
// break;
// case 2: //tag address
// if(!(strlen(token) == 4 || strlen(token) == 16)){
// printf("tag address wrong length: %s \n", token);
// return;
// }
// range_msg.tag_address = token; //cast to string?
// break;
// case 3: //corrected range
// if(strlen(token) != 8){
// printf("range data size incorrect: %s \n", token);
// return;
// }
// range_msg.range = (uint32_t)strtol(token, 0, 16);;
// break;
// default:
// token = NULL; //stop processing the serial data
// break;
// }
// token = strtok(NULL, " ");
// idx++;
// }
// uwb_range_pub.publish(range_msg);
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment