Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART_17-18
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bbartels
MicroCART_17-18
Commits
ba89b949
Commit
ba89b949
authored
8 years ago
by
burneykb
Browse files
Options
Downloads
Patches
Plain Diff
Fixed VRPN packet to 100%
parent
9b682530
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
groundStation/src/backend/backend.c
+9
-17
9 additions, 17 deletions
groundStation/src/backend/backend.c
with
9 additions
and
17 deletions
groundStation/src/backend/backend.c
+
9
−
17
View file @
ba89b949
...
...
@@ -115,6 +115,7 @@ modular_structs_t structs;
// in the future.
static
void
cb
(
struct
ucart_vrpn_TrackerData
*
td
)
{
static
int
count
=
0
;
if
(
!
(
count
%
10
))
{
sendVrpnPacket
(
td
);
//updateLogFile(td);
...
...
@@ -324,12 +325,12 @@ void sendVrpnPacket(struct ucart_vrpn_TrackerData *info) {
//memcpy(&packet[7], &info, sizeof(struct ucart_vrpn_TrackerData));
memset
(
&
packet
[
7
],
0
,
4
);
memcpy
(
&
packet
[
11
],
&
info
[
4
]
,
4
);
memcpy
(
&
packet
[
15
],
&
info
[
0
]
,
4
);
memcpy
(
&
packet
[
19
],
&
info
[
8
]
,
4
);
memcpy
(
&
packet
[
23
],
&
info
[
16
]
,
4
);
memcpy
(
&
packet
[
27
],
&
info
[
12
]
,
4
);
memcpy
(
&
packet
[
31
],
&
info
[
20
]
,
4
);
memcpy
(
&
packet
[
11
],
&
(
info
->
y
)
,
4
);
memcpy
(
&
packet
[
15
],
&
(
info
->
x
)
,
4
);
memcpy
(
&
packet
[
19
],
&
(
info
->
z
)
,
4
);
memcpy
(
&
packet
[
23
],
&
(
info
->
pitch
)
,
4
);
memcpy
(
&
packet
[
27
],
&
(
info
->
roll
)
,
4
);
memcpy
(
&
packet
[
31
],
&
(
info
->
yaw
)
,
4
);
char
checksum
=
0
;
int
i
;
...
...
@@ -344,12 +345,6 @@ void sendVrpnPacket(struct ucart_vrpn_TrackerData *info) {
keepRunning
=
0
;
}
printf
(
"vrpn packet : '"
);
for
(
int
i
=
0
;
i
<
pSize
;
++
i
)
{
printf
(
" %0x "
);
}
printf
(
"'
\n
"
);
struct
timeval
tstart
;
gettimeofday
(
&
tstart
,
NULL
);
timeArr
[
currMessageID
%
MAX_HASH_SIZE
]
=
tstart
;
...
...
@@ -477,7 +472,6 @@ static ssize_t writeQuad(const char * buf, size_t count) {
if
(
pthread_mutex_lock
(
&
quadSocketMutex
))
{
err
(
-
2
,
"pthrtead_mutex_lock (%s:%d):"
,
__FILE__
,
__LINE__
);
}
//setsockopt(zyboSocket, IPPROTO_TCP, TCP_QUICKACK, (int[]){1}, sizeof(int));
retval
=
write
(
zyboSocket
,
buf
,
count
);
if
(
pthread_mutex_unlock
(
&
quadSocketMutex
))
{
err
(
-
2
,
"pthrtead_mutex_unlock (%s:%d):"
,
__FILE__
,
__LINE__
);
...
...
@@ -492,9 +486,6 @@ static ssize_t readQuad(char * buf, size_t count) {
err
(
-
2
,
"pthrtead_mutex_lock (%s:%d):"
,
__FILE__
,
__LINE__
);
}
retval
=
read
(
zyboSocket
,
buf
,
count
);
//int result = setsockopt(zyboSocket, IPPROTO_TCP, TCP_QUICKACK, (int[]){1}, sizeof(int));
//printf("result = %d\n", result);
if
(
pthread_mutex_unlock
(
&
quadSocketMutex
))
{
err
(
-
2
,
"pthrtead_mutex_unlock (%s:%d):"
,
__FILE__
,
__LINE__
);
}
...
...
@@ -704,6 +695,7 @@ static void quad_recv() {
if
(
respBufLen
<
8
)
{
/* not long enough yet */
printf
(
"too short!!
\n
"
);
return
;
}
...
...
@@ -733,7 +725,7 @@ static void quad_recv() {
/* At least enough data read to check checksum, and it was good!*/
char
*
cmdText
=
MessageTypes
[(
int
)
metadata
.
msg_type
].
subtypes
[(
int
)
metadata
.
msg_subtype
].
cmdText
;
float
value
=
getFloat
((
unsigned
char
*
)
respBuf
,
7
);
printf
(
"Quad : %s, %lf
\n
"
,
cmdText
,
value
);
//
printf("Quad : %s, %lf\n", cmdText, value);
/*
Assuming the quad sends the correct info.. This hasn't been tested yet due to a lack of
quad software. We can check how to format by the cmdText and pass to every client.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment