Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Baitboat
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
OpenSource
Baitboat
Commits
07766e55
Commit
07766e55
authored
11 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
SingleCopter: output_test for individual motors
Based on original work by Nils Hogberg
parent
3610cfe2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/AP_Motors/AP_MotorsSingle.cpp
+34
-44
34 additions, 44 deletions
libraries/AP_Motors/AP_MotorsSingle.cpp
libraries/AP_Motors/AP_MotorsSingle.h
+4
-2
4 additions, 2 deletions
libraries/AP_Motors/AP_MotorsSingle.h
with
38 additions
and
46 deletions
libraries/AP_Motors/AP_MotorsSingle.cpp
+
34
−
44
View file @
07766e55
...
@@ -216,50 +216,40 @@ void AP_MotorsSingle::output_disarmed()
...
@@ -216,50 +216,40 @@ void AP_MotorsSingle::output_disarmed()
output_min
();
output_min
();
}
}
// output_test - spin each motor for a moment to allow the user to confirm the motor order and spin direction
// output_test - spin a motor at the pwm value specified
void
AP_MotorsSingle
::
output_test
()
// motor_seq is the motor's sequence number from 1 to the number of motors on the frame
// pwm value is an actual pwm value that will be output, normally in the range of 1000 ~ 2000
void
AP_MotorsSingle
::
output_test
(
uint8_t
motor_seq
,
int16_t
pwm
)
{
{
// Send minimum values to all motors
// exit immediately if not armed
output_min
();
if
(
!
_flags
.
armed
)
{
return
;
// spin main motor
}
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_7
]),
_rc_throttle
.
radio_min
+
_min_throttle
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_7
]),
_rc_throttle
.
radio_min
);
hal
.
scheduler
->
delay
(
2000
);
// flap servo 1
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_1
]),
_servo1
.
radio_min
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_1
]),
_servo1
.
radio_max
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_1
]),
_servo1
.
radio_trim
);
hal
.
scheduler
->
delay
(
2000
);
// flap servo 2
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_2
]),
_servo2
.
radio_min
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_2
]),
_servo2
.
radio_max
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_2
]),
_servo2
.
radio_trim
);
hal
.
scheduler
->
delay
(
2000
);
// flap servo 3
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_3
]),
_servo3
.
radio_min
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_3
]),
_servo3
.
radio_max
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_3
]),
_servo3
.
radio_trim
);
hal
.
scheduler
->
delay
(
2000
);
// flap servo 4
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_4
]),
_servo4
.
radio_min
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_4
]),
_servo4
.
radio_max
);
hal
.
scheduler
->
delay
(
1000
);
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_4
]),
_servo4
.
radio_trim
);
// Send minimum values to all motors
// output to motors and servos
output_min
();
switch
(
motor_seq
)
{
case
1
:
// flap servo 1
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_1
]),
pwm
);
break
;
case
2
:
// flap servo 2
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_2
]),
pwm
);
break
;
case
3
:
// flap servo 3
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_3
]),
pwm
);
break
;
case
4
:
// flap servo 4
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_4
]),
pwm
);
break
;
case
5
:
// spin main motor
hal
.
rcout
->
write
(
pgm_read_byte
(
&
_motor_to_channel_map
[
AP_MOTORS_MOT_7
]),
pwm
);
break
;
default:
// do nothing
break
;
}
}
}
This diff is collapsed.
Click to expand it.
libraries/AP_Motors/AP_MotorsSingle.h
+
4
−
2
View file @
07766e55
...
@@ -44,8 +44,10 @@ public:
...
@@ -44,8 +44,10 @@ public:
// enable - starts allowing signals to be sent to motors
// enable - starts allowing signals to be sent to motors
virtual
void
enable
();
virtual
void
enable
();
// output_test - spin each motor for a moment to allow the user to confirm the motor order and spin direction
// output_test - spin a motor at the pwm value specified
virtual
void
output_test
();
// motor_seq is the motor's sequence number from 1 to the number of motors on the frame
// pwm value is an actual pwm value that will be output, normally in the range of 1000 ~ 2000
virtual
void
output_test
(
uint8_t
motor_seq
,
int16_t
pwm
);
// output_min - sends minimum values out to the motors
// output_min - sends minimum values out to the motors
virtual
void
output_min
();
virtual
void
output_min
();
...
...
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