Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
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
Distributed Autonomous Networked Control Lab
MicroCART
Commits
0c0dc209
Commit
0c0dc209
authored
3 years ago
by
Zach Eisele
Browse files
Options
Downloads
Patches
Plain Diff
add attitude and stop setpoint
parent
a3aa01fc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!76
lots of gui updates
,
!75
Lost of gui updates
,
!74
lots of gui updates among others
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
crazyflie_groundstation/src/ccrazyflie/CCrazyflie_commands.cpp
+32
-28
32 additions, 28 deletions
...flie_groundstation/src/ccrazyflie/CCrazyflie_commands.cpp
with
32 additions
and
28 deletions
crazyflie_groundstation/src/ccrazyflie/CCrazyflie_commands.cpp
+
32
−
28
View file @
0c0dc209
...
...
@@ -338,41 +338,45 @@ bool CCrazyflie::parseReceivedUserCommand() {
float
yaw
=
build_float
(
&
command
.
payload
[
17
]);
float
fthrust
=
build_float
(
&
command
.
payload
[
5
]);
float
ftime
=
build_float
(
&
command
.
payload
[
1
]);
int
nSize
=
4
*
sizeof
(
float
)
+
sizeof
(
char
);
char
cBuffer
[
nSize
];
if
(
command
.
payload
[
0
]
==
1
)
{
short
thrust
=
(
short
)
fthrust
;
this
->
sendSetpoint
(
roll
,
pitch
,
yaw
,
thrust
);
cBuffer
[
0
]
=
9
;
}
else
if
(
command
.
payload
[
0
]
==
2
)
{
int
nSize
=
4
*
sizeof
(
float
)
+
sizeof
(
char
);
char
cBuffer
[
nSize
];
cBuffer
[
0
]
=
8
;
memcpy
(
&
cBuffer
[
0
*
sizeof
(
float
)
+
1
],
&
roll
,
sizeof
(
float
));
memcpy
(
&
cBuffer
[
1
*
sizeof
(
float
)
+
1
],
&
pitch
,
sizeof
(
float
));
memcpy
(
&
cBuffer
[
2
*
sizeof
(
float
)
+
1
],
&
yaw
,
sizeof
(
float
));
memcpy
(
&
cBuffer
[
3
*
sizeof
(
float
)
+
1
],
&
fthrust
,
sizeof
(
float
));
CCRTPPacket
*
crtpPacket
=
new
CCRTPPacket
(
cBuffer
,
nSize
,
7
);
crtpPacket
->
setChannel
(
0x00
);
int
milliseconds
=
ftime
*
1000
;
CCRTPPacket
*
crtpReceived
=
NULL
;
if
(
ftime
==
0
)
{
}
else
{
break
;
}
memcpy
(
&
cBuffer
[
0
*
sizeof
(
float
)
+
1
],
&
roll
,
sizeof
(
float
));
memcpy
(
&
cBuffer
[
1
*
sizeof
(
float
)
+
1
],
&
pitch
,
sizeof
(
float
));
memcpy
(
&
cBuffer
[
2
*
sizeof
(
float
)
+
1
],
&
yaw
,
sizeof
(
float
));
memcpy
(
&
cBuffer
[
3
*
sizeof
(
float
)
+
1
],
&
fthrust
,
sizeof
(
float
));
CCRTPPacket
*
crtpPacket
=
new
CCRTPPacket
(
cBuffer
,
nSize
,
7
);
crtpPacket
->
setChannel
(
0x00
);
int
milliseconds
=
ftime
*
1000
;
CCRTPPacket
*
crtpReceived
=
NULL
;
if
(
ftime
==
0
)
{
crtpReceived
=
m_crRadio
->
sendPacket
(
m_nRadioChannel
,
crtpPacket
,
this
);
}
else
{
auto
start
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
timeNow
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
timeNow
-
start
);
while
(
duration
.
count
()
<
milliseconds
)
{
usleep
(
10
);
crtpReceived
=
m_crRadio
->
sendPacket
(
m_nRadioChannel
,
crtpPacket
,
this
);
timeNow
=
std
::
chrono
::
high_resolution_clock
::
now
();
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
timeNow
-
start
);
}
else
{
auto
start
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
timeNow
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
timeNow
-
start
);
while
(
duration
.
count
()
<
milliseconds
)
{
usleep
(
10
);
crtpReceived
=
m_crRadio
->
sendPacket
(
m_nRadioChannel
,
crtpPacket
,
this
);
timeNow
=
std
::
chrono
::
high_resolution_clock
::
now
();
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
timeNow
-
start
);
}
}
delete
crtpPacket
;
cBuffer
[
0
]
=
0
;
nSize
=
sizeof
(
char
);
crtpPacket
->
setData
(
cBuffer
,
nSize
);
crtpReceived
=
m_crRadio
->
sendPacket
(
m_nRadioChannel
,
crtpPacket
,
this
);
}
delete
crtpPacket
;
break
;
}
case
ACMD_GETLOGFILE
:
...
...
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