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
5eebb423
Commit
5eebb423
authored
Jul 17, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
456
parent
018bb2c2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
128 additions
and
80 deletions
+128
-80
qgroundcontrol.pro
qgroundcontrol.pro
+2
-2
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
FlightDisplayWimaMenu.qml
src/FlightDisplay/FlightDisplayWimaMenu.qml
+52
-50
SmallValue.qml
src/FlightDisplay/SmallValue.qml
+41
-0
WimaController.cc
src/Wima/WimaController.cc
+1
-3
JsonFactory.h
src/comm/ros_bridge/include/JsonFactory.h
+1
-0
JsonMethodes.h
src/comm/ros_bridge/include/JsonMethodes.h
+3
-2
ROSBridge.h
src/comm/ros_bridge/include/ROSBridge.h
+4
-4
TopicPublisher.cpp
src/comm/ros_bridge/include/TopicPublisher.cpp
+10
-7
TopicPublisher.h
src/comm/ros_bridge/include/TopicPublisher.h
+9
-9
TypeFactory.h
src/comm/ros_bridge/include/TypeFactory.h
+1
-0
ROSBridge.cpp
src/comm/ros_bridge/src/ROSBridge.cpp
+3
-3
No files found.
qgroundcontrol.pro
View file @
5eebb423
...
@@ -482,7 +482,7 @@ HEADERS += \
...
@@ -482,7 +482,7 @@ HEADERS += \
src
/
comm
/
ros_bridge
/
include
/
Receiver
.
h
\
src
/
comm
/
ros_bridge
/
include
/
Receiver
.
h
\
src
/
comm
/
ros_bridge
/
include
/
RosBridgeClient
.
h
\
src
/
comm
/
ros_bridge
/
include
/
RosBridgeClient
.
h
\
src
/
comm
/
ros_bridge
/
include
/
ThreadSafeQueue
.
h
\
src
/
comm
/
ros_bridge
/
include
/
ThreadSafeQueue
.
h
\
src
/
comm
/
ros_bridge
/
include
/
T
ransmitt
er
.
h
\
src
/
comm
/
ros_bridge
/
include
/
T
opicPublish
er
.
h
\
src
/
comm
/
ros_bridge
/
include
/
TypeFactory
.
h
\
src
/
comm
/
ros_bridge
/
include
/
TypeFactory
.
h
\
src
/
comm
/
ros_bridge
/
src
/
PackageBuffer
.
h
\
src
/
comm
/
ros_bridge
/
src
/
PackageBuffer
.
h
\
src
/
comm
/
utilities
.
h
src
/
comm
/
utilities
.
h
...
@@ -495,7 +495,7 @@ SOURCES += \
...
@@ -495,7 +495,7 @@ SOURCES += \
src
/
comm
/
ros_bridge
/
include
/
ComPrivateInclude
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
ComPrivateInclude
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
MessageTag
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
MessageTag
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
Receiver
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
Receiver
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
T
ransmitt
er
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
T
opicPublish
er
.
cpp
\
src
/
comm
/
ros_bridge
/
src
/
CasePacker
.
cpp
\
src
/
comm
/
ros_bridge
/
src
/
CasePacker
.
cpp
\
src
/
Wima
/
WimaControllerDetail
.
cc
\
src
/
Wima
/
WimaControllerDetail
.
cc
\
src
/
Wima
/
snaketile
.
cpp
\
src
/
Wima
/
snaketile
.
cpp
\
...
...
qgroundcontrol.qrc
View file @
5eebb423
...
@@ -230,6 +230,7 @@
...
@@ -230,6 +230,7 @@
<file alias="QGroundControl/FlightMap/WimaMissionItemMapVisual.qml">src/PlanView/WimaMissionItemMapVisual.qml</file>
<file alias="QGroundControl/FlightMap/WimaMissionItemMapVisual.qml">src/PlanView/WimaMissionItemMapVisual.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayWimaMenu.qml">src/FlightDisplay/FlightDisplayWimaMenu.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayWimaMenu.qml">src/FlightDisplay/FlightDisplayWimaMenu.qml</file>
<file alias="QGroundControl/Controls/CircularSurveyMapVisual.qml">src/WimaView/CircularSurveyMapVisual.qml</file>
<file alias="QGroundControl/Controls/CircularSurveyMapVisual.qml">src/WimaView/CircularSurveyMapVisual.qml</file>
<file alias="QGroundControl/FlightDisplay/SmallValue.qml">src/FlightDisplay/SmallValue.qml</file>
</qresource>
</qresource>
<qresource prefix="/json">
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/FlightDisplay/FlightDisplayWimaMenu.qml
View file @
5eebb423
...
@@ -12,11 +12,15 @@ import QGroundControl.Controls 1.0
...
@@ -12,11 +12,15 @@ import QGroundControl.Controls 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
FlightDisplay
1.0
import
QGroundControl
.
Airspace
1.0
import
QGroundControl
.
Airspace
1.0
import
QGroundControl
.
Airmap
1.0
import
QGroundControl
.
Airmap
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
FactControls
1.0
import
Qt
.
labs
.
settings
1.0
Item
{
Item
{
id
:
_root
id
:
_root
height
:
mainFrame
.
height
height
:
mainFrame
.
height
...
@@ -35,10 +39,20 @@ Item {
...
@@ -35,10 +39,20 @@ Item {
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
/
2
// Disabels map scrolling when cursor on this menu.
DeadMouseArea
{
DeadMouseArea
{
anchors.fill
:
parent
anchors.fill
:
parent
}
}
// Use Settings to store menu appearance through different sessions.
Settings
{
property
alias
snakeHeaderChecker
:
snakeHeader
.
checked
property
alias
missionHeaderChecker
:
missionHeader
.
checked
property
alias
navigateHeaderChecker
:
navigateHeader
.
checked
property
alias
vehicleHeaderChecker
:
vehicleHeader
.
checked
property
alias
statsHeaderChecker
:
statsHeader
.
checked
}
// Progress bar visibility
// Progress bar visibility
on_ControllerProgressPctChanged
:
{
on_ControllerProgressPctChanged
:
{
if
(
_controllerProgressPct
===
1
)
{
if
(
_controllerProgressPct
===
1
)
{
...
@@ -404,88 +418,76 @@ Item {
...
@@ -404,88 +418,76 @@ Item {
text
:
qsTr
(
"
Statistics
"
)
text
:
qsTr
(
"
Statistics
"
)
}
}
GridLayout
{
GridLayout
{
columns
:
2
columns
:
3
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
visible
:
statsHeader
.
checked
visible
:
statsHeader
.
checked
QGCLabel
{
Item
{
text
:
qsTr
(
"
Phase Length:
"
)
id
:
widthItem
wrapMode
:
Text
.
WordWrap
Layout.fillWidth
:
true
Layout.fillWidth
:
true
Layout.columnSpan
:
parent
.
columns
height
:
0
}
}
QGCLabel
{
SmallValue
{
property
var
phaseDistance
:
wimaController
.
phaseDistance
property
var
phaseDistance
:
wimaController
.
phaseDistance
text
:
phaseDistance
>=
0
?
phaseDistance
.
toFixed
(
2
)
+
"
m
"
:
"
-.-
"
shortDescription
:
qsTr
(
"
Phase Length
"
)
wrapMode
:
Text
.
WordWrap
value
:
phaseDistance
>=
0
?
phaseDistance
.
toFixed
(
2
):
"
-.-
"
Layout.fillWidth
:
true
unit
:
"
m
"
//width: widthItem.width*0.49
}
}
QGCLabel
{
SmallValue
{
text
:
qsTr
(
"
Phase Duration:
"
)
wrapMode
:
Text
.
WordWrap
Layout.fillWidth
:
true
}
QGCLabel
{
property
var
phaseDuration
:
wimaController
.
phaseDuration
property
var
phaseDuration
:
wimaController
.
phaseDuration
text
:
phaseDuration
>=
0
?
getTime
(
phaseDuration
)
:
"
-.-
"
shortDescription
:
qsTr
(
"
Phase Duration
"
)
wrapMode
:
Text
.
WordWrap
value
:
phaseDuration
>=
0
?
getTime
(
phaseDuration
)
:
"
-.-
"
Layout.fillWidth
:
true
//unit: "m"
//width: widthItem.width*0.49
}
}
QGCLabel
{
SmallValue
{
text
:
qsTr
(
"
Current Waypoint:
"
)
wrapMode
:
Text
.
WordWrap
Layout.fillWidth
:
true
}
QGCLabel
{
property
var
currentMissionIndex
:
missionController
.
currentMissionIndex
property
var
currentMissionIndex
:
missionController
.
currentMissionIndex
text
:
currentMissionIndex
>
0
?
currentMissionIndex
:
"
-.-
"
shortDescription
:
qsTr
(
"
Current Waypoint
"
)
wrapMode
:
Text
.
WordWrap
value
:
currentMissionIndex
>
0
?
currentMissionIndex
:
"
-.-
"
Layout.fillWidth
:
true
//unit: "m"
//width: widthItem.width*0.49
}
}
QGCLabel
{
SmallValue
{
text
:
qsTr
(
"
Remaining Distance:
"
)
wrapMode
:
Text
.
WordWrap
Layout.fillWidth
:
true
}
QGCLabel
{
property
var
remainingDistance
:
missionController
.
remainingDistance
property
var
remainingDistance
:
missionController
.
remainingDistance
text
:
remainingDistance
>=
0
?
remainingDistance
.
toFixed
(
2
)
+
"
m
"
:
"
-.-
"
shortDescription
:
qsTr
(
"
Remaining Distance
"
)
wrapMode
:
Text
.
WordWrap
value
:
remainingDistance
>=
0
?
remainingDistance
.
toFixed
(
2
)
:
"
-.-
"
Layout.fillWidth
:
true
unit
:
"
m
"
//width: widthItem.width*0.49
}
}
QGCLabel
{
SmallValue
{
text
:
qsTr
(
"
Remaining Time:
"
)
wrapMode
:
Text
.
WordWrap
Layout.fillWidth
:
true
}
QGCLabel
{
property
var
remainingTime
:
missionController
.
remainingTime
property
var
remainingTime
:
missionController
.
remainingTime
text
:
remainingTime
>=
0
?
getTime
(
remainingTime
)
:
"
-.-
"
shortDescription
:
qsTr
(
"
Remaining Time
"
)
wrapMode
:
Text
.
WordWrap
value
:
remainingTime
>=
0
?
getTime
(
remainingTime
)
:
"
-.-
"
Layout.fillWidth
:
true
//unit: "m"
//width: widthItem.width*0.49
}
}
QGCLabel
{
// space
text
:
""
Item
{
// spacer
Layout.columnSpan
:
2
height
:
5
Layout.columnSpan
:
parent
.
columns
}
}
}
}
// GridLayout
}
// settingsColumn
}
// settingsColumn
Item
{
// spacer
Item
{
// spacer
width
:
6
width
:
6
height
:
5
height
:
5
}
}
}
}
// Row
}
// QGCFlickable
}
// QGCFlickable
...
...
src/FlightDisplay/SmallValue.qml
0 → 100644
View file @
5eebb423
import
QtQuick
2.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QtQuick
.
Layouts
1.2
GridLayout
{
id
:
main
clip
:
true
columns
:
1
property
string
shortDescription
:
"
Description
"
property
string
value
:
"
-,-
"
property
string
unit
:
""
QGCLabel
{
Layout.fillWidth
:
true
Layout.columnSpan
:
parent
.
columns
wrapMode
:
Text
.
WordWrap
horizontalAlignment
:
Text
.
AlignHCenter
font.pointSize
:
ScreenTools
.
isTinyScreen
?
ScreenTools
.
smallFontPointSize
*
0.75
:
ScreenTools
.
smallFontPointSize
text
:
main
.
shortDescription
}
QGCLabel
{
Layout.fillWidth
:
true
horizontalAlignment
:
Text
.
AlignHCenter
fontSizeMode
:
Text
.
HorizontalFit
text
:
main
.
value
+
"
"
+
main
.
unit
}
// QGCLabel {
// Layout.fillWidth: true
// //width: parent.width
// horizontalAlignment: Text.AlignHCenter
// font.pointSize: ScreenTools.isTinyScreen ?
// ScreenTools.smallFontPointSize * 0.75
// : ScreenTools.smallFontPointSize
// fontSizeMode: Text.HorizontalFit
// text: main.unit
// }
}
// Column
src/Wima/WimaController.cc
View file @
5eebb423
...
@@ -1122,7 +1122,7 @@ void WimaController::_eventTimerHandler()
...
@@ -1122,7 +1122,7 @@ void WimaController::_eventTimerHandler()
if
(
rosBridgeTicker
.
ready
())
{
if
(
rosBridgeTicker
.
ready
())
{
// using namespace ros_bridge;
// using namespace ros_bridge;
_pRosBridge
->
send
(
_snakeTilesLocal
,
"/snake/snake_tiles"
);
_pRosBridge
->
publish
(
_snakeTilesLocal
,
"/snake/snake_tiles"
);
// // Time
// // Time
// class Time time(1, 2);
// class Time time(1, 2);
// rapidjson::Document doc(rapidjson::kObjectType);
// rapidjson::Document doc(rapidjson::kObjectType);
...
@@ -1444,8 +1444,6 @@ void WimaController::_initSmartRTL()
...
@@ -1444,8 +1444,6 @@ void WimaController::_initSmartRTL()
case
UserRequest
:
case
UserRequest
:
emit
returnUserRequestConfirmRequired
();
emit
returnUserRequestConfirmRequired
();
break
;
break
;
default:
qWarning
(
"
\n
WimaController::_initSmartRTL: default case reached!"
);
}
}
return
;
return
;
...
...
src/comm/ros_bridge/include/JsonFactory.h
View file @
5eebb423
...
@@ -56,6 +56,7 @@ private:
...
@@ -56,6 +56,7 @@ private:
rapidjson
::
Document
*
_create
(
const
U
&
msg
,
Type2Type
<
V
>
){
rapidjson
::
Document
*
_create
(
const
U
&
msg
,
Type2Type
<
V
>
){
(
void
)
msg
;
(
void
)
msg
;
assert
(
false
);
// Implementation missing for group U::Group!
assert
(
false
);
// Implementation missing for group U::Group!
return
nullptr
;
}
}
// ===========================================================================
// ===========================================================================
...
...
src/comm/ros_bridge/include/JsonMethodes.h
View file @
5eebb423
...
@@ -591,7 +591,7 @@ using namespace ROSBridge::JsonMethodes::GeometryMsgs;
...
@@ -591,7 +591,7 @@ using namespace ROSBridge::JsonMethodes::GeometryMsgs;
typedef
decltype
(
p
.
polygons
()[
0
])
PolyStampedCVR
;
typedef
decltype
(
p
.
polygons
()[
0
])
PolyStampedCVR
;
typedef
typename
boost
::
remove_cv
<
typename
boost
::
remove_reference
<
PolyStampedCVR
>::
type
>::
type
typedef
typename
boost
::
remove_cv
<
typename
boost
::
remove_reference
<
PolyStampedCVR
>::
type
>::
type
PolyStamped
;
PolyStamped
;
for
(
long
i
=
0
;
i
<
polyStampedJson
.
Size
();
++
i
)
{
for
(
unsigned
int
i
=
0
;
i
<
polyStampedJson
.
Size
();
++
i
)
{
if
(
!
polyStampedJson
[
i
].
HasMember
(
"header"
)
){
if
(
!
polyStampedJson
[
i
].
HasMember
(
"header"
)
){
assert
(
false
);
assert
(
false
);
return
false
;
return
false
;
...
@@ -632,7 +632,7 @@ namespace Progress {
...
@@ -632,7 +632,7 @@ namespace Progress {
bool
toJson
(
const
ProgressType
&
p
,
rapidjson
::
Value
&
value
,
rapidjson
::
Document
::
AllocatorType
&
allocator
)
bool
toJson
(
const
ProgressType
&
p
,
rapidjson
::
Value
&
value
,
rapidjson
::
Document
::
AllocatorType
&
allocator
)
{
{
rapidjson
::
Value
progressJson
(
rapidjson
::
kArrayType
);
rapidjson
::
Value
progressJson
(
rapidjson
::
kArrayType
);
for
(
unsigned
long
i
=
0
;
i
<
p
.
progress
().
size
(
);
++
i
){
for
(
unsigned
long
i
=
0
;
i
<
std
::
uint64_t
(
p
.
progress
().
size
()
);
++
i
){
progressJson
.
PushBack
(
rapidjson
::
Value
().
SetInt
(
std
::
int8_t
(
p
.
progress
()[
i
])),
allocator
);
progressJson
.
PushBack
(
rapidjson
::
Value
().
SetInt
(
std
::
int8_t
(
p
.
progress
()[
i
])),
allocator
);
}
}
value
.
AddMember
(
"progress"
,
progressJson
,
allocator
);
value
.
AddMember
(
"progress"
,
progressJson
,
allocator
);
...
@@ -652,6 +652,7 @@ namespace Progress {
...
@@ -652,6 +652,7 @@ namespace Progress {
p
.
progress
().
reserve
(
sz
);
p
.
progress
().
reserve
(
sz
);
for
(
unsigned
long
i
=
0
;
i
<
sz
;
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
sz
;
++
i
)
p
.
progress
().
push_back
(
std
::
int8_t
(
jsonProgress
[
i
].
GetInt
()));
p
.
progress
().
push_back
(
std
::
int8_t
(
jsonProgress
[
i
].
GetInt
()));
return
true
;
}
}
}
// namespace Progress
}
// namespace Progress
}
// namespace NemoMsgs
}
// namespace NemoMsgs
...
...
src/comm/ros_bridge/include/ROSBridge.h
View file @
5eebb423
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include "ros_bridge/include/CasePacker.h"
#include "ros_bridge/include/CasePacker.h"
#include "ros_bridge/include/TypeFactory.h"
#include "ros_bridge/include/TypeFactory.h"
#include "ros_bridge/include/JsonFactory.h"
#include "ros_bridge/include/JsonFactory.h"
#include "ros_bridge/include/T
ransmitt
er.h"
#include "ros_bridge/include/T
opicPublish
er.h"
#include "ros_bridge/include/Receiver.h"
#include "ros_bridge/include/Receiver.h"
#include <memory>
#include <memory>
...
@@ -23,8 +23,8 @@ public:
...
@@ -23,8 +23,8 @@ public:
explicit
ROSBridge
();
explicit
ROSBridge
();
template
<
class
T
>
template
<
class
T
>
void
send
(
T
&
msg
,
const
std
::
string
&
topic
){
void
publish
(
T
&
msg
,
const
std
::
string
&
topic
){
_t
ransmitter
.
send
(
msg
,
topic
);
_t
opicPublisher
.
publish
(
msg
,
topic
);
}
}
void
start
();
void
start
();
...
@@ -41,7 +41,7 @@ private:
...
@@ -41,7 +41,7 @@ private:
JsonFactory
_jsonFactory
;
JsonFactory
_jsonFactory
;
CasePacker
_casePacker
;
CasePacker
_casePacker
;
RosbridgeWsClient
_rbc
;
RosbridgeWsClient
_rbc
;
ComPrivate
::
T
ransmitter
_transmitt
er
;
ComPrivate
::
T
opicPublisher
_topicPublish
er
;
ComPrivate
::
Receiver
_receiver
;
ComPrivate
::
Receiver
_receiver
;
};
};
...
...
src/comm/ros_bridge/include/T
ransmitt
er.cpp
→
src/comm/ros_bridge/include/T
opicPublish
er.cpp
View file @
5eebb423
#include "T
ransmitt
er.h"
#include "T
opicPublish
er.h"
void
ROSBridge
::
ComPrivate
::
transmittLoop
(
const
ROSBridge
::
CasePacker
&
casePacker
,
void
ROSBridge
::
ComPrivate
::
transmittLoop
(
const
ROSBridge
::
CasePacker
&
casePacker
,
...
@@ -41,18 +41,21 @@ void ROSBridge::ComPrivate::transmittLoop(const ROSBridge::CasePacker &casePacke
...
@@ -41,18 +41,21 @@ void ROSBridge::ComPrivate::transmittLoop(const ROSBridge::CasePacker &casePacke
}
}
}
}
ROSBridge
::
ComPrivate
::
Transmitter
::
Transmitter
(
CasePacker
*
casePacker
,
ROSBridge
::
ComPrivate
::
TopicPublisher
::
TopicPublisher
(
CasePacker
*
casePacker
,
RosbridgeWsClient
*
rbc
,
RosbridgeWsClient
*
rbc
)
:
JsonFactory
*
jsonFactory
)
:
_stopFlag
(
true
)
_stopFlag
(
true
)
,
_jsonFactory
(
jsonFactory
)
,
_casePacker
(
casePacker
)
,
_casePacker
(
casePacker
)
,
_rbc
(
rbc
)
,
_rbc
(
rbc
)
{
{
}
}
void
ROSBridge
::
ComPrivate
::
Transmitter
::
start
()
ROSBridge
::
ComPrivate
::
TopicPublisher
::~
TopicPublisher
()
{
this
->
stop
();
}
void
ROSBridge
::
ComPrivate
::
TopicPublisher
::
start
()
{
{
if
(
!
_stopFlag
.
load
()
)
// start called while thread running.
if
(
!
_stopFlag
.
load
()
)
// start called while thread running.
return
;
return
;
...
@@ -65,7 +68,7 @@ void ROSBridge::ComPrivate::Transmitter::start()
...
@@ -65,7 +68,7 @@ void ROSBridge::ComPrivate::Transmitter::start()
std
::
cref
(
_stopFlag
)));
std
::
cref
(
_stopFlag
)));
}
}
void
ROSBridge
::
ComPrivate
::
T
ransmitt
er
::
stop
()
void
ROSBridge
::
ComPrivate
::
T
opicPublish
er
::
stop
()
{
{
if
(
_stopFlag
.
load
()
)
// start called while thread not running.
if
(
_stopFlag
.
load
()
)
// start called while thread not running.
return
;
return
;
...
...
src/comm/ros_bridge/include/T
ransmitt
er.h
→
src/comm/ros_bridge/include/T
opicPublish
er.h
View file @
5eebb423
...
@@ -13,24 +13,25 @@
...
@@ -13,24 +13,25 @@
namespace
ROSBridge
{
namespace
ROSBridge
{
namespace
ComPrivate
{
namespace
ComPrivate
{
class
T
ransmitt
er
class
T
opicPublish
er
{
{
typedef
std
::
unique_ptr
<
std
::
thread
>
ThreadPtr
;
typedef
std
::
unique_ptr
<
std
::
thread
>
ThreadPtr
;
public:
public:
Transmitter
()
=
delete
;
TopicPublisher
()
=
delete
;
Transmitter
(
CasePacker
*
casePacker
,
TopicPublisher
(
CasePacker
*
casePacker
,
RosbridgeWsClient
*
rbc
,
RosbridgeWsClient
*
rbc
);
JsonFactory
*
jsonFactory
);
~
TopicPublisher
();
void
start
();
void
start
();
void
stop
();
void
stop
();
template
<
class
T
>
template
<
class
T
>
void
send
(
const
T
&
msg
,
const
std
::
string
&
topic
){
void
publish
(
const
T
&
msg
,
const
std
::
string
&
topic
){
JsonDocUPtr
docPtr
(
_casePacker
->
pack
(
msg
,
topic
));
JsonDocUPtr
docPtr
(
_casePacker
->
pack
(
msg
,
topic
));
send
(
std
::
move
(
docPtr
));
publish
(
std
::
move
(
docPtr
));
}
}
void
send
(
JsonDocUPtr
docPtr
){
void
publish
(
JsonDocUPtr
docPtr
){
std
::
lock_guard
<
std
::
mutex
>
lock
(
_queueMutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
_queueMutex
);
_queue
.
push_back
(
std
::
move
(
docPtr
));
_queue
.
push_back
(
std
::
move
(
docPtr
));
}
}
...
@@ -41,7 +42,6 @@ private:
...
@@ -41,7 +42,6 @@ private:
JsonQueue
_queue
;
JsonQueue
_queue
;
std
::
mutex
_queueMutex
;
std
::
mutex
_queueMutex
;
std
::
atomic
<
bool
>
_stopFlag
;
std
::
atomic
<
bool
>
_stopFlag
;
JsonFactory
*
_jsonFactory
;
CasePacker
*
_casePacker
;
CasePacker
*
_casePacker
;
ThreadPtr
_pThread
;
ThreadPtr
_pThread
;
RosbridgeWsClient
*
_rbc
;
RosbridgeWsClient
*
_rbc
;
...
...
src/comm/ros_bridge/include/TypeFactory.h
View file @
5eebb423
...
@@ -51,6 +51,7 @@ private:
...
@@ -51,6 +51,7 @@ private:
(
void
)
type
;
(
void
)
type
;
(
void
)
doc
;
(
void
)
doc
;
assert
(
false
);
// Implementation missing for group U::Group!
assert
(
false
);
// Implementation missing for group U::Group!
return
false
;
}
}
// ===========================================================================
// ===========================================================================
...
...
src/comm/ros_bridge/src/ROSBridge.cpp
View file @
5eebb423
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
ROSBridge
::
ROSBridge
::
ROSBridge
()
:
ROSBridge
::
ROSBridge
::
ROSBridge
()
:
_casePacker
(
&
_typeFactory
,
&
_jsonFactory
)
_casePacker
(
&
_typeFactory
,
&
_jsonFactory
)
,
_rbc
(
"localhost:9090"
)
,
_rbc
(
"localhost:9090"
)
,
_t
ransmitter
(
&
_casePacker
,
&
_rbc
,
&
_jsonFactory
)
,
_t
opicPublisher
(
&
_casePacker
,
&
_rbc
)
,
_receiver
(
&
_casePacker
,
&
_rbc
,
&
_typeFactory
)
,
_receiver
(
&
_casePacker
,
&
_rbc
,
&
_typeFactory
)
{
{
...
@@ -11,12 +11,12 @@ ROSBridge::ROSBridge::ROSBridge() :
...
@@ -11,12 +11,12 @@ ROSBridge::ROSBridge::ROSBridge() :
void
ROSBridge
::
ROSBridge
::
start
()
void
ROSBridge
::
ROSBridge
::
start
()
{
{
_t
ransmitt
er
.
start
();
_t
opicPublish
er
.
start
();
}
}
void
ROSBridge
::
ROSBridge
::
stop
()
void
ROSBridge
::
ROSBridge
::
stop
()
{
{
_t
ransmitt
er
.
stop
();
_t
opicPublish
er
.
stop
();
}
}
bool
ROSBridge
::
ROSBridge
::
messagesAvailable
()
bool
ROSBridge
::
ROSBridge
::
messagesAvailable
()
...
...
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