Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CCF Immersive Sorting Demo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
CeTI
ROS
CeTI Cobotic Framework
CCF Immersive Sorting Demo
Commits
774291ef
Commit
774291ef
authored
2 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
minor improvements in logging
parent
7024ab4c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dummy_selection_provider.cpp
+6
-9
6 additions, 9 deletions
src/dummy_selection_provider.cpp
with
6 additions
and
9 deletions
src/dummy_selection_provider.cpp
+
6
−
9
View file @
774291ef
...
@@ -28,7 +28,7 @@ nng_socket sock;
...
@@ -28,7 +28,7 @@ nng_socket sock;
int
rv
;
int
rv
;
void
sendSelection
(
const
std
::
string
&
object
)
{
void
sendSelection
(
const
std
::
string
&
object
)
{
ROS_INFO_STREAM
(
"Se
lecting random object
: "
<<
object
);
ROS_INFO_STREAM
(
"Se
nding selection of
: "
<<
object
);
Selection
selection
;
Selection
selection
;
selection
.
set_id
(
object
);
selection
.
set_id
(
object
);
int
length
=
selection
.
ByteSize
();
int
length
=
selection
.
ByteSize
();
...
@@ -40,12 +40,6 @@ void sendSelection(const std::string &object) {
...
@@ -40,12 +40,6 @@ void sendSelection(const std::string &object) {
}
}
}
}
std
::
string
ProtoToJson
(
const
google
::
protobuf
::
Message
&
proto
)
{
std
::
string
json
;
google
::
protobuf
::
util
::
MessageToJsonString
(
proto
,
&
json
);
return
json
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
GOOGLE_PROTOBUF_VERIFY_VERSION
;
GOOGLE_PROTOBUF_VERIFY_VERSION
;
...
@@ -67,8 +61,7 @@ int main(int argc, char **argv) {
...
@@ -67,8 +61,7 @@ int main(int argc, char **argv) {
ROS_WARN_STREAM
(
"nng_dial returned: "
<<
nng_strerror
(
rv
)
<<
". Trying to connect again in one second..."
);
ROS_WARN_STREAM
(
"nng_dial returned: "
<<
nng_strerror
(
rv
)
<<
". Trying to connect again in one second..."
);
connection_retry_rate
.
sleep
();
connection_retry_rate
.
sleep
();
}
}
ROS_INFO_STREAM
(
"nng_dial returned: "
<<
nng_strerror
(
rv
)
<<
" (which is the translation of error code "
<<
rv
ROS_INFO_STREAM
(
"NNG connection established to "
<<
URL
);
<<
"). Connection established!"
);
ros
::
Rate
loop_rate
(
200
);
ros
::
Rate
loop_rate
(
200
);
ros
::
Rate
pause_rate
(
ros
::
Duration
(
2
));
// seconds
ros
::
Rate
pause_rate
(
ros
::
Duration
(
2
));
// seconds
...
@@ -159,6 +152,7 @@ int main(int argc, char **argv) {
...
@@ -159,6 +152,7 @@ int main(int argc, char **argv) {
pause_rate
.
sleep
();
pause_rate
.
sleep
();
std
::
string
object
{
objects
[
distribution
(
rng
)]};
std
::
string
object
{
objects
[
distribution
(
rng
)]};
ROS_INFO_STREAM
(
"Selecting random object: "
<<
object
);
sendSelection
(
object
);
sendSelection
(
object
);
// wait again, then send the bin object
// wait again, then send the bin object
...
@@ -171,6 +165,9 @@ int main(int argc, char **argv) {
...
@@ -171,6 +165,9 @@ int main(int argc, char **argv) {
std
::
string
bin
{
bins
[
binDistribution
(
rng
)]};
std
::
string
bin
{
bins
[
binDistribution
(
rng
)]};
ROS_INFO_STREAM
(
"Selecting random bin: "
<<
bin
);
ROS_INFO_STREAM
(
"Selecting random bin: "
<<
bin
);
sendSelection
(
bin
);
sendSelection
(
bin
);
// wait some time before starting the next selection
pause_rate
.
sleep
();
}
}
}
}
}
else
if
(
rv
==
NNG_EAGAIN
)
{
}
else
if
(
rv
==
NNG_EAGAIN
)
{
...
...
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