Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
ros2rag
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
JastAdd
ros2rag
Commits
06a3ec6c
Commit
06a3ec6c
authored
4 years ago
by
René Schöne
Browse files
Options
Downloads
Patches
Plain Diff
Streamline receiver.
parent
47b8af00
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ros2rag.receiverstub/src/main/java/de/tudresden/inf/st/ros2rag/receiverstub/Main.java
+9
-2
9 additions, 2 deletions
...n/java/de/tudresden/inf/st/ros2rag/receiverstub/Main.java
ros2rag.receiverstub/src/main/resources/log4j2.xml
+1
-1
1 addition, 1 deletion
ros2rag.receiverstub/src/main/resources/log4j2.xml
with
10 additions
and
3 deletions
ros2rag.receiverstub/src/main/java/de/tudresden/inf/st/ros2rag/receiverstub/Main.java
+
9
−
2
View file @
06a3ec6c
...
@@ -7,6 +7,7 @@ import config.Robotconfig.RobotConfig;
...
@@ -7,6 +7,7 @@ import config.Robotconfig.RobotConfig;
import
de.tudresden.inf.st.ros2rag.starter.ast.MqttUpdater
;
import
de.tudresden.inf.st.ros2rag.starter.ast.MqttUpdater
;
import
de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration
;
import
de.tudresden.inf.st.ros2rag.starter.data.DataConfiguration
;
import
de.tudresden.inf.st.ros2rag.starter.data.DataJoint
;
import
de.tudresden.inf.st.ros2rag.starter.data.DataJoint
;
import
org.apache.logging.log4j.Level
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
panda.Linkstate.PandaLinkState
;
import
panda.Linkstate.PandaLinkState
;
...
@@ -19,6 +20,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -19,6 +20,7 @@ import java.util.concurrent.TimeUnit;
public
class
Main
{
public
class
Main
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Main
.
class
);
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Main
.
class
);
private
String
topicPattern
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Main
main
=
new
Main
();
Main
main
=
new
Main
();
...
@@ -32,6 +34,7 @@ public class Main {
...
@@ -32,6 +34,7 @@ public class Main {
private
void
run
(
DataConfiguration
config
)
throws
IOException
,
InterruptedException
{
private
void
run
(
DataConfiguration
config
)
throws
IOException
,
InterruptedException
{
final
CountDownLatch
finish
=
new
CountDownLatch
(
1
);
final
CountDownLatch
finish
=
new
CountDownLatch
(
1
);
int
topicMaxLength
=
0
;
MqttUpdater
receiver
=
new
MqttUpdater
(
"receiver stub"
);
MqttUpdater
receiver
=
new
MqttUpdater
(
"receiver stub"
);
receiver
.
setHost
(
config
.
mqttHost
);
receiver
.
setHost
(
config
.
mqttHost
);
receiver
.
waitUntilReady
(
2
,
TimeUnit
.
SECONDS
);
receiver
.
waitUntilReady
(
2
,
TimeUnit
.
SECONDS
);
...
@@ -39,7 +42,9 @@ public class Main {
...
@@ -39,7 +42,9 @@ public class Main {
receiver
.
newConnection
(
config
.
dataConfigTopic
,
this
::
printDataConfig
);
receiver
.
newConnection
(
config
.
dataConfigTopic
,
this
::
printDataConfig
);
for
(
DataJoint
joint
:
config
.
joints
)
{
for
(
DataJoint
joint
:
config
.
joints
)
{
receiver
.
newConnection
(
joint
.
topic
,
this
::
printPandaLinkState
);
receiver
.
newConnection
(
joint
.
topic
,
this
::
printPandaLinkState
);
topicMaxLength
=
Math
.
max
(
topicMaxLength
,
joint
.
topic
.
length
());
}
}
this
.
topicPattern
=
"%"
+
topicMaxLength
+
"s"
;
receiver
.
newConnection
(
"components"
,
bytes
->
{
receiver
.
newConnection
(
"components"
,
bytes
->
{
String
message
=
new
String
(
bytes
);
String
message
=
new
String
(
bytes
);
...
@@ -70,8 +75,10 @@ public class Main {
...
@@ -70,8 +75,10 @@ public class Main {
PandaLinkState
.
Orientation
tmpOrientation
=
pls
.
getOrient
();
PandaLinkState
.
Orientation
tmpOrientation
=
pls
.
getOrient
();
PandaLinkState
.
TwistLinear
tmpTwistLinear
=
pls
.
getTl
();
PandaLinkState
.
TwistLinear
tmpTwistLinear
=
pls
.
getTl
();
PandaLinkState
.
TwistAngular
tmpTwistAngular
=
pls
.
getTa
();
PandaLinkState
.
TwistAngular
tmpTwistAngular
=
pls
.
getTa
();
logger
.
info
(
"{}: pos({},{},{}), orient({},{},{},{}),"
+
// panda::panda_link0: pos(-3.0621333E-8,-1.5197388E-8,3.3411725E-5), orient(0.0,0.0,0.0,0.0), twist-linear(0.0,0.0,0.0), twist-angular(0.0,0.0,0.0)
" twist-linear({},{},{}), twist-angular({},{},{})"
,
logger
.
printf
(
Level
.
INFO
,
topicPattern
+
": pos(% .5f,% .5f,% .5f), ori(%.1f,%.1f,%.1f,%.1f),"
+
" twL(%.1f,%.1f,%.1f), twA(%.1f,%.1f,%.1f)"
,
pls
.
getName
(),
pls
.
getName
(),
tmpPosition
.
getPositionX
(),
tmpPosition
.
getPositionX
(),
tmpPosition
.
getPositionY
(),
tmpPosition
.
getPositionY
(),
...
...
This diff is collapsed.
Click to expand it.
ros2rag.receiverstub/src/main/resources/log4j2.xml
+
1
−
1
View file @
06a3ec6c
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
</Console>
</Console>
</Appenders>
</Appenders>
<Loggers>
<Loggers>
<Root
level=
"
debug
"
>
<Root
level=
"
info
"
>
<AppenderRef
ref=
"Console"
/>
<AppenderRef
ref=
"Console"
/>
</Root>
</Root>
</Loggers>
</Loggers>
...
...
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