Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
2dc44666
Unverified
Commit
2dc44666
authored
Aug 21, 2020
by
Don Gagne
Committed by
GitHub
Aug 21, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9016 from DonLakeFlyer/MultiBatterySetup
PX4: Multi battery setup
parents
979e9922
9ca7bbe7
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
399 additions
and
352 deletions
+399
-352
BatteryParams.qml
src/AutoPilotPlugins/PX4/BatteryParams.qml
+58
-0
PowerComponent.qml
src/AutoPilotPlugins/PX4/PowerComponent.qml
+309
-289
PowerComponentController.cc
src/AutoPilotPlugins/PX4/PowerComponentController.cc
+9
-12
PowerComponentController.h
src/AutoPilotPlugins/PX4/PowerComponentController.h
+2
-2
PX4Resources.qrc
src/FirmwarePlugin/PX4/PX4Resources.qrc
+1
-0
qmldir
src/QmlControls/QGroundControl/PX4/qmldir
+1
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+16
-0
Vehicle.h
src/Vehicle/Vehicle.h
+3
-0
UAS.cc
src/uas/UAS.cc
+0
-35
UAS.h
src/uas/UAS.h
+0
-3
UASInterface.h
src/uas/UASInterface.h
+0
-11
No files found.
src/AutoPilotPlugins/PX4/BatteryParams.qml
0 → 100644
View file @
2dc44666
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Dialogs
1.2
import
QtQuick
.
Layouts
1.2
import
QGroundControl
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controllers
1.0
// Exposes the set of battery parameters for new and old firmwares
// Older firmware: BAT_* naming
// Newer firmware: BAT#_* naming, with indices starting at 1
QtObject
{
property
var
controller
///< FactPanelController
property
int
batteryIndex
///< 1-based battery index
property
bool
battVoltageDividerAvailable
:
controller
.
parameterExists
(
-
1
,
"
BAT#_V_DIV
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
))
property
bool
battAmpsPerVoltAvailable
:
controller
.
parameterExists
(
-
1
,
"
BAT#_A_PER_V
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
))
property
Fact
battNumCells
:
controller
.
getParameterFact
(
-
1
,
"
BAT#_N_CELLS
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
))
property
Fact
battHighVolt
:
controller
.
getParameterFact
(
-
1
,
"
BAT#_V_CHARGED
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
))
property
Fact
battLowVolt
:
controller
.
getParameterFact
(
-
1
,
"
BAT#_V_EMPTY
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
))
property
Fact
battVoltLoadDrop
:
controller
.
getParameterFact
(
-
1
,
"
BAT#_V_LOAD_DROP
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
))
property
Fact
battVoltageDivider
:
controller
.
getParameterFact
(
-
1
,
"
BAT#_V_DIV
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
),
false
)
property
Fact
battAmpsPerVolt
:
controller
.
getParameterFact
(
-
1
,
"
BAT#_A_PER_V
"
.
replace
(
"
#
"
,
_indexedBatteryParamsAvailable
?
batteryIndex
:
""
),
false
)
property
string
_batNCellsIndexedParamName
:
"
BAT#_N_CELLS
"
property
bool
_indexedBatteryParamsAvailable
:
controller
.
parameterExists
(
-
1
,
_batNCellsIndexedParamName
.
replace
(
"
#
"
,
1
))
property
int
_indexedBatteryParamCount
:
getIndexedBatteryParamCount
()
Component.onCompleted
:
{
if
(
batteryIndex
>
1
&&
!
_indexedBatteryParamsAvailable
)
{
console
.
warn
(
"
Internal Error: BatteryParams.qml batteryIndex > 1 while indexed params are not available
"
,
batteryIndex
)
}
}
function
getIndexedBatteryParamCount
()
{
var
batteryIndex
=
1
do
{
if
(
!
controller
.
parameterExists
(
-
1
,
_batNCellsIndexedParamName
.
replace
(
"
#
"
,
batteryIndex
)))
{
return
batteryIndex
-
1
}
batteryIndex
++
}
while
(
true
)
}
}
src/AutoPilotPlugins/PX4/PowerComponent.qml
View file @
2dc44666
This diff is collapsed.
Click to expand it.
src/AutoPilotPlugins/PX4/PowerComponentController.cc
View file @
2dc44666
...
...
@@ -22,26 +22,26 @@ PowerComponentController::PowerComponentController(void)
void
PowerComponentController
::
calibrateEsc
(
void
)
{
_warningMessages
.
clear
();
connect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
UAS
TextMessage
);
connect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
Vehicle
TextMessage
);
_vehicle
->
startCalibration
(
Vehicle
::
CalibrationEsc
);
}
void
PowerComponentController
::
b
usConfigureActuators
(
void
)
void
PowerComponentController
::
startB
usConfigureActuators
(
void
)
{
_warningMessages
.
clear
();
connect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
UAS
TextMessage
);
_
uas
->
startBusConfig
(
UASInterface
::
StartBusConfigActuators
);
connect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
Vehicle
TextMessage
);
_
vehicle
->
startUAVCANBusConfig
(
);
}
void
PowerComponentController
::
stopBusConfigureActuators
(
void
)
{
disconnect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
UAS
TextMessage
);
_
uas
->
startBusConfig
(
UASInterface
::
EndBusConfigActuators
);
disconnect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
Vehicle
TextMessage
);
_
vehicle
->
stopUAVCANBusConfig
(
);
}
void
PowerComponentController
::
_stopCalibration
(
void
)
{
disconnect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
UAS
TextMessage
);
disconnect
(
_vehicle
,
&
Vehicle
::
textMessageReceived
,
this
,
&
PowerComponentController
::
_handle
Vehicle
TextMessage
);
}
void
PowerComponentController
::
_stopBusConfig
(
void
)
...
...
@@ -49,12 +49,9 @@ void PowerComponentController::_stopBusConfig(void)
_stopCalibration
();
}
void
PowerComponentController
::
_handle
UASTextMessage
(
int
uasId
,
int
compId
,
int
severity
,
QString
text
)
void
PowerComponentController
::
_handle
VehicleTextMessage
(
int
vehicleId
,
int
/* compId */
,
int
/* severity */
,
QString
text
)
{
Q_UNUSED
(
compId
);
Q_UNUSED
(
severity
);
if
(
uasId
!=
_vehicle
->
id
())
{
if
(
vehicleId
!=
_vehicle
->
id
())
{
return
;
}
...
...
src/AutoPilotPlugins/PX4/PowerComponentController.h
View file @
2dc44666
...
...
@@ -29,7 +29,7 @@ public:
PowerComponentController
(
void
);
Q_INVOKABLE
void
calibrateEsc
(
void
);
Q_INVOKABLE
void
b
usConfigureActuators
(
void
);
Q_INVOKABLE
void
startB
usConfigureActuators
(
void
);
Q_INVOKABLE
void
stopBusConfigureActuators
(
void
);
signals:
...
...
@@ -43,7 +43,7 @@ signals:
void
calibrationSuccess
(
const
QStringList
&
warningMessages
);
private
slots
:
void
_handle
UASTextMessage
(
int
uas
Id
,
int
compId
,
int
severity
,
QString
text
);
void
_handle
VehicleTextMessage
(
int
vehicle
Id
,
int
compId
,
int
severity
,
QString
text
);
private:
void
_stopCalibration
(
void
);
...
...
src/FirmwarePlugin/PX4/PX4Resources.qrc
View file @
2dc44666
...
...
@@ -21,6 +21,7 @@
<file alias="SensorsComponentSummaryFixedWing.qml">../../AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml</file>
<file alias="SensorsSetup.qml">../../AutoPilotPlugins/PX4/SensorsSetup.qml</file>
<file alias="QGroundControl/PX4/qmldir">../../QmlControls/QGroundControl/PX4/qmldir</file>
<file alias="QGroundControl/PX4/BatteryParams.qml">../../AutoPilotPlugins/PX4/BatteryParams.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="PX4-MavCmdInfoCommon.json">PX4-MavCmdInfoCommon.json</file>
...
...
src/QmlControls/QGroundControl/PX4/qmldir
View file @
2dc44666
Module QGroundControl.PX4
BatteryParams 1.0 BatteryParams.qml
SensorSetupPage 1.0 SensorSetupPage.qml
src/Vehicle/Vehicle.cc
View file @
2dc44666
...
...
@@ -3665,6 +3665,22 @@ void Vehicle::stopCalibration(void)
0
);
// unused
}
void
Vehicle
::
startUAVCANBusConfig
(
void
)
{
sendMavCommand
(
defaultComponentId
(),
// target component
MAV_CMD_PREFLIGHT_UAVCAN
,
// command id
true
,
// showError
1
);
// start config
}
void
Vehicle
::
stopUAVCANBusConfig
(
void
)
{
sendMavCommand
(
defaultComponentId
(),
// target component
MAV_CMD_PREFLIGHT_UAVCAN
,
// command id
true
,
// showError
0
);
// stop config
}
void
Vehicle
::
setSoloFirmware
(
bool
soloFirmware
)
{
if
(
soloFirmware
!=
_soloFirmware
)
{
...
...
src/Vehicle/Vehicle.h
View file @
2dc44666
...
...
@@ -1003,6 +1003,9 @@ public:
void
startCalibration
(
CalibrationType
calType
);
void
stopCalibration
(
void
);
void
startUAVCANBusConfig
(
void
);
void
stopUAVCANBusConfig
(
void
);
Fact
*
roll
()
{
return
&
_rollFact
;
}
Fact
*
pitch
()
{
return
&
_pitchFact
;
}
Fact
*
heading
()
{
return
&
_headingFact
;
}
...
...
src/uas/UAS.cc
View file @
2dc44666
...
...
@@ -348,41 +348,6 @@ void UAS::receiveMessage(mavlink_message_t message)
#pragma warning(pop, 0)
#endif
void
UAS
::
startBusConfig
(
UASInterface
::
StartBusConfigType
calType
)
{
if
(
!
_vehicle
)
{
return
;
}
int
actuatorCal
=
0
;
switch
(
calType
)
{
case
StartBusConfigActuators
:
actuatorCal
=
1
;
break
;
case
EndBusConfigActuators
:
actuatorCal
=
0
;
break
;
}
_vehicle
->
sendMavCommand
(
_vehicle
->
defaultComponentId
(),
// target component
MAV_CMD_PREFLIGHT_UAVCAN
,
// command id
true
,
// showError
actuatorCal
);
// actuators
}
void
UAS
::
stopBusConfig
(
void
)
{
if
(
!
_vehicle
)
{
return
;
}
_vehicle
->
sendMavCommand
(
_vehicle
->
defaultComponentId
(),
// target component
MAV_CMD_PREFLIGHT_UAVCAN
,
// command id
true
,
// showError
0
);
// cancel
}
/**
* Check if time is smaller than 40 years, assuming no system without Unix
* timestamp runs longer than 40 years continuously without reboot. In worst case
...
...
src/uas/UAS.h
View file @
2dc44666
...
...
@@ -180,9 +180,6 @@ public slots:
/** @brief Receive a message from one of the communication links. */
virtual
void
receiveMessage
(
mavlink_message_t
message
);
void
startBusConfig
(
StartBusConfigType
calType
);
void
stopBusConfig
(
void
);
signals:
void
imageStarted
(
quint64
timestamp
);
/** @brief A new camera image has arrived */
...
...
src/uas/UASInterface.h
View file @
2dc44666
...
...
@@ -39,17 +39,6 @@ public:
/** @brief The time interval the robot is switched on **/
virtual
quint64
getUptime
()
const
=
0
;
enum
StartBusConfigType
{
StartBusConfigActuators
,
EndBusConfigActuators
,
};
/// Starts the specified bus configuration
virtual
void
startBusConfig
(
StartBusConfigType
calType
)
=
0
;
/// Ends any current bus configuration
virtual
void
stopBusConfig
(
void
)
=
0
;
public
slots
:
/** @brief Order the robot to pair its receiver **/
virtual
void
pairRX
(
int
rxType
,
int
rxSubType
)
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment