Skip to content

Commit e6b186e

Browse files
Williangalvanipeterbarker
authored andcommitted
autotest: add test for AP_Motors6DOF
This test uses a normal, non-6dof frame, and validates that it is able to do a simple mission
1 parent b17c3db commit e6b186e

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Tools/autotest/arducopter.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14895,6 +14895,35 @@ def ScriptingFlyVelocity(self):
1489514895
# Test done
1489614896
self.land_and_disarm()
1489714897

14898+
def Scripting6DoFMotors(self):
14899+
'''test 6DoF scripting motor matrix'''
14900+
self.context_collect('STATUSTEXT')
14901+
14902+
self.set_parameters({
14903+
"FRAME_CLASS": 16, # MOTOR_FRAME_6DOF_SCRIPTING
14904+
"SCR_ENABLE": 1,
14905+
})
14906+
14907+
self.install_example_script_context("Copter_Motors_6DoF.lua")
14908+
self.reboot_sitl()
14909+
14910+
self.wait_statustext("6DoF Copter quad scripting", timeout=30, check_context=True)
14911+
self.wait_ready_to_arm()
14912+
14913+
self.upload_simple_relhome_mission([
14914+
(mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 20),
14915+
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 30, 0, 20),
14916+
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 30, 30, 20),
14917+
(mavutil.mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH, 0, 0, 0),
14918+
])
14919+
14920+
num_wp = self.get_mission_count()
14921+
self.set_parameter("AUTO_OPTIONS", 3)
14922+
self.change_mode('AUTO')
14923+
self.arm_vehicle()
14924+
self.wait_waypoint(num_wp-1, num_wp-1, timeout=120)
14925+
self.wait_disarmed(timeout=60)
14926+
1489814927
def RTLYaw(self):
1489914928
'''test that vehicle yaws to original heading on RTL'''
1490014929
# 0 is WP_YAW_BEHAVIOR_NONE
@@ -16016,6 +16045,7 @@ def tests2b(self): # this block currently around 9.5mins here
1601616045
self.TestTetherStuck,
1601716046
self.ScriptingFlipMode,
1601816047
self.ScriptingFlyVelocity,
16048+
self.Scripting6DoFMotors,
1601916049
self.EK3_EXT_NAV_vel_without_vert,
1602016050
self.CompassLearnCopyFromEKF,
1602116051
self.AHRSAutoTrim,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Replicate the standard Quad X frame via 6DoF scripting motor matrix
2+
-- Raw factors derived from angle-based Quad X definition:
3+
-- cos(angle+90) for roll, cos(angle) for pitch
4+
-- Motor # Roll Pitch Yaw Throttle Forward Lateral Reversible TestOrder
5+
6+
Motors_6DoF:add_motor(0, -0.7071, 0.7071, 1.0, 1.0, 0, 0, false, 1)
7+
Motors_6DoF:add_motor(1, 0.7071, -0.7071, 1.0, 1.0, 0, 0, false, 3)
8+
Motors_6DoF:add_motor(2, 0.7071, 0.7071, -1.0, 1.0, 0, 0, false, 4)
9+
Motors_6DoF:add_motor(3, -0.7071, -0.7071, -1.0, 1.0, 0, 0, false, 2)
10+
11+
assert(Motors_6DoF:init(4), 'unable to setup 4 motors')
12+
13+
-- no dedicated forward/lateral thrusters, use tilt like a normal copter
14+
attitude_control:set_forward_enable(false)
15+
attitude_control:set_lateral_enable(false)
16+
17+
motors:set_frame_string("6DoF Copter quad scripting")
18+
gcs:send_text(6, "6DoF Copter quad scripting")

0 commit comments

Comments
 (0)