Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Drone FlyMonitor2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Philippe Gaussier
Drone FlyMonitor2
Commits
3527377b
Commit
3527377b
authored
1 year ago
by
Stéphane Yang
Browse files
Options
Downloads
Patches
Plain Diff
fly_monitor update: bit of code adjustment with updated comment
parent
aa9ec068
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#6265
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Com_server/fly_monitor/src/Com_SerialWritingThread.cpp
+16
-19
16 additions, 19 deletions
Com_server/fly_monitor/src/Com_SerialWritingThread.cpp
with
16 additions
and
19 deletions
Com_server/fly_monitor/src/Com_SerialWritingThread.cpp
+
16
−
19
View file @
3527377b
...
...
@@ -156,43 +156,40 @@ int Serial_Port_WritingThread::main_loop(struct timeval *front_msg, struct timev
// Position control mode
if
(
drone1
.
flight_mode
==
FlightMode
::
Posctl
)
{
// See "drone_joyRemote" or "drone" promethe script to check if the order below is correct when you launch them
/*
motors: 0 -> vertical (forward to backward) [-1.0 to 1.0]
1 -> horizontal (left to right) [-1.0 to 1.0]
2 -> rotation (ccw to cw) [-1.0 to 1.0]
~~3 -> gas direct (no control) [1.0 to -1.0]~~ (can be used but not advised here)
4 -> altitude command (controlled throttle) [0.0 to 1.0]
blc_control_motors:
0 -> vertical (forward to backward) [-1.0 to 1.0]
1 -> horizontal (left to right) [-1.0 to 1.0]
2 -> rotation (ccw to cw) [-1.0 to 1.0]
~~3 -> gas direct (no control) [1.0 to -1.0]~~ (can be used but not advised here)
4 -> altitude command (controlled throttle) [0.0 to 1.0]
x = pitch -> forward(1000), backward(-1000)
y = roll -> right(1000), left(-1000)
z = thrust -> max gas (1000), no gas (-1000) (0 means enough gas so that there is no thrust but also means you want to land)
r = yaw -> CCW(1000), CW(-1000)
*/
float
xx
=
-
blc_control_motors
.
floats
[
0
];
float
yy
=
blc_control_motors
.
floats
[
1
];
float
zz
=
blc_control_motors
.
floats
[
4
];
// command from altitude control
float
zz_direct
=
-
0.5
f
*
blc_control_motors
.
floats
[
3
]
+
0.5
f
;
// control gas with throttle axis
float
rr
=
-
2
*
blc_control_motors
.
floats
[
2
];
if
(
drone1
.
motors
==
ARM
)
{
// Control in altitude
///*
drone1
.
command_directControl
(
-
blc_control_motors
.
floats
[
0
]
,
blc_control_motors
.
floats
[
1
]
,
blc_control_motors
.
floats
[
4
]
,
-
2
*
blc_control_motors
.
floats
[
2
]);
drone1
.
command_directControl
(
xx
,
yy
,
zz
,
rr
);
//*/
// Control directly
/*
drone1.command_directControl(-blc_control_motors.floats[0]
,blc_control_motors.floats[1]
,-0.5f * blc_control_motors.floats[3] + 0.5f
,-blc_control_motors.floats[2]);
drone1.command_directControl(xx,yy,zz_direct,rr);
//*/
}
else
{
std
::
cout
<<
"x = "
<<
-
blc_control_motors
.
floats
[
0
]
<<
", y = "
<<
blc_control_motors
.
floats
[
1
]
<<
", z = "
<<
blc_control_motors
.
floats
[
4
]
<<
", r = "
<<
-
2
*
blc_control_motors
.
floats
[
2
]
<<
std
::
endl
;
std
::
cout
<<
"Drone is not armed, can't control"
<<
std
::
endl
;
std
::
cout
<<
"x = "
<<
xx
<<
", y = "
<<
yy
<<
", z = "
<<
zz
<<
", r = "
<<
rr
<<
std
::
endl
;
std
::
cout
<<
"Drone is not armed, can't control. You can type 'reset' to stop this print."
<<
std
::
endl
;
}
}
...
...
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