Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OLD CCF - The CeTI Cobotic Framework
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
CeTI
ROS
CeTI Cobotic Framework
OLD CCF - The CeTI Cobotic Framework
Commits
a65ceae4
Commit
a65ceae4
authored
4 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
fix execution bug, simplyfy parameter handling
parent
b1c3c740
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dummy_cgv_controller.cpp
+7
-14
7 additions, 14 deletions
src/dummy_cgv_controller.cpp
src/moveit_cgv_controller.cpp
+16
-19
16 additions, 19 deletions
src/moveit_cgv_controller.cpp
with
23 additions
and
33 deletions
src/dummy_cgv_controller.cpp
+
7
−
14
View file @
a65ceae4
...
@@ -19,12 +19,15 @@
...
@@ -19,12 +19,15 @@
#include
"ccf/controller/DummyRobotArmController.h"
#include
"ccf/controller/DummyRobotArmController.h"
#include
"ccf/connection/NngConnection.h"
#include
"ccf/connection/NngConnection.h"
#include
"ccf/util/NodeUtil.h"
#include
<google/protobuf/text_format.h>
#include
<google/protobuf/text_format.h>
#include
<google/protobuf/util/json_util.h>
#include
<google/protobuf/util/json_util.h>
const
std
::
string
NODE_NAME
=
"ros2cgv_dummy"
;
const
std
::
string
NODE_NAME
=
"ros2cgv_dummy"
;
using
CetiRosToolbox
::
getParameter
;
void
loadScene
(
DummyRobotArmController
&
connector
)
{
void
loadScene
(
DummyRobotArmController
&
connector
)
{
// read file into string: https://stackoverflow.com/questions/2602013/read-whole-ascii-file-into-c-stdstring
// read file into string: https://stackoverflow.com/questions/2602013/read-whole-ascii-file-into-c-stdstring
std
::
string
path
=
ros
::
package
::
getPath
(
"ccf"
)
+
"/config/config_scene.yaml"
;
std
::
string
path
=
ros
::
package
::
getPath
(
"ccf"
)
+
"/config/config_scene.yaml"
;
...
@@ -74,22 +77,12 @@ int main(int argc, char **argv) {
...
@@ -74,22 +77,12 @@ int main(int argc, char **argv) {
<<
"/cgv_address from param server, using default "
<<
cgv_address
);
<<
"/cgv_address from param server, using default "
<<
cgv_address
);
}
}
DummyRobotArmController
connector
{
n
,
"place-a"
};
DummyRobotArmController
connector
{
n
,
NODE_NAME
};
// add an NNG connection
// add an NNG connection
std
::
unique_ptr
<
NngConnection
>
connection
=
std
::
make_unique
<
NngConnection
>
(
cgv_address
);
std
::
unique_ptr
<
NngConnection
>
connection
=
std
::
make_unique
<
NngConnection
>
(
cgv_address
);
std
::
string
selectionTopic
=
"selection"
;
connection
->
setReceiveTopic
(
getParameter
(
n
,
"topics/selection"
,
"selection"
));
if
(
!
n
.
getParam
(
"topics/selection"
,
selectionTopic
))
{
connection
->
setSendTopic
(
getParameter
(
n
,
"topics/scene"
,
NODE_NAME
+
"/scene/update"
));
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Could not get string value for "
<<
n
.
getNamespace
()
<<
"/topics/selection from param server, using default "
<<
selectionTopic
);
}
connection
->
setReceiveTopic
(
selectionTopic
);
std
::
string
sceneTopic
=
"scene"
;
if
(
!
n
.
getParam
(
"topics/scene"
,
sceneTopic
))
{
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Could not get string value for "
<<
n
.
getNamespace
()
<<
"/topics/scene from param server, using default "
<<
sceneTopic
);
}
connection
->
setSendTopic
(
sceneTopic
);
connector
.
addConnection
(
std
::
move
(
connection
));
connector
.
addConnection
(
std
::
move
(
connection
));
loadScene
(
connector
);
loadScene
(
connector
);
...
@@ -126,7 +119,7 @@ int main(int argc, char **argv) {
...
@@ -126,7 +119,7 @@ int main(int argc, char **argv) {
if
(
selectedBin
&&
selectedBox
)
{
if
(
selectedBin
&&
selectedBox
)
{
auto
boxId
=
selectedBox
->
id
();
auto
boxId
=
selectedBox
->
id
();
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Got task: Put "
<<
boxId
<<
" into "
<<
selectedBin
->
id
());
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Got task: Put "
<<
boxId
<<
" into "
<<
selectedBin
->
id
());
if
(
!
connector
.
RobotArmController
::
pickAndDrop
(
*
robot
,
*
selectedBox
,
*
selectedBin
,
false
))
{
if
(
!
connector
.
pickAndDrop
(
*
robot
,
*
selectedBox
,
*
selectedBin
,
false
))
{
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Unable to remove box '"
<<
boxId
<<
"'!"
);
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Unable to remove box '"
<<
boxId
<<
"'!"
);
selectedBox
=
nullptr
;
selectedBox
=
nullptr
;
selectedBin
=
nullptr
;
selectedBin
=
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
src/moveit_cgv_controller.cpp
+
16
−
19
View file @
a65ceae4
...
@@ -20,9 +20,12 @@
...
@@ -20,9 +20,12 @@
#include
"ccf/controller/MoveItRobotArmController.h"
#include
"ccf/controller/MoveItRobotArmController.h"
#include
"ccf/connection/NngConnection.h"
#include
"ccf/connection/NngConnection.h"
#include
"ccf/util/NodeUtil.h"
const
std
::
string
NODE_NAME
=
"ros2cgv_moveit"
;
const
std
::
string
NODE_NAME
=
"ros2cgv_moveit"
;
using
CetiRosToolbox
::
getParameter
;
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
GOOGLE_PROTOBUF_VERIFY_VERSION
;
GOOGLE_PROTOBUF_VERIFY_VERSION
;
...
@@ -37,25 +40,17 @@ int main(int argc, char **argv) {
...
@@ -37,25 +40,17 @@ int main(int argc, char **argv) {
<<
"/cgv_address from param server, using default "
<<
cgv_address
);
<<
"/cgv_address from param server, using default "
<<
cgv_address
);
}
}
MoveItRobotArmController
connector
{
n
,
"place-a"
};
MoveItRobotArmController
connector
{
n
,
NODE_NAME
};
// add an NNG connection
// add an NNG connection
std
::
unique_ptr
<
NngConnection
>
connection
=
std
::
make_unique
<
NngConnection
>
(
cgv_address
);
std
::
unique_ptr
<
NngConnection
>
connection
=
std
::
make_unique
<
NngConnection
>
(
cgv_address
);
std
::
string
selectionTopic
=
"selection"
;
connection
->
setReceiveTopic
(
getParameter
(
n
,
"topics/selection"
,
"selection"
));
if
(
!
n
.
getParam
(
"topics/selection"
,
selectionTopic
))
{
connection
->
setSendTopic
(
getParameter
(
n
,
"topics/scene"
,
NODE_NAME
+
"/scene/update"
));
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Could not get string value for "
<<
n
.
getNamespace
()
<<
"/topics/selection from param server, using default "
<<
selectionTopic
);
}
connection
->
setReceiveTopic
(
selectionTopic
);
std
::
string
sceneTopic
=
"scene"
;
if
(
!
n
.
getParam
(
"topics/scene"
,
sceneTopic
))
{
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Could not get string value for "
<<
n
.
getNamespace
()
<<
"/topics/scene from param server, using default "
<<
sceneTopic
);
}
connection
->
setSendTopic
(
sceneTopic
);
connector
.
addConnection
(
std
::
move
(
connection
));
connector
.
addConnection
(
std
::
move
(
connection
));
std
::
shared_ptr
<
Object
>
robot
{};
// scene loading is not required, the scene is updated by moveit
Object
*
robot
=
nullptr
;
Object
*
selectedBox
=
nullptr
;
Object
*
selectedBox
=
nullptr
;
Object
*
selectedBin
=
nullptr
;
Object
*
selectedBin
=
nullptr
;
std
::
optional
<
std
::
string
>
currentlyPickedBox
{};
std
::
optional
<
std
::
string
>
currentlyPickedBox
{};
...
@@ -87,14 +82,16 @@ int main(int argc, char **argv) {
...
@@ -87,14 +82,16 @@ int main(int argc, char **argv) {
if
(
selectedBin
&&
selectedBox
)
{
if
(
selectedBin
&&
selectedBox
)
{
auto
boxId
=
selectedBox
->
id
();
auto
boxId
=
selectedBox
->
id
();
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Got task: Put "
<<
boxId
<<
" into "
<<
selectedBin
->
id
());
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Got task: Put "
<<
boxId
<<
" into "
<<
selectedBin
->
id
());
if
(
!
connector
.
RobotArmController
::
pickAndDrop
(
*
robot
,
*
selectedBox
,
*
selectedBin
,
false
))
{
if
(
!
connector
.
pickAndDrop
(
*
robot
,
*
selectedBox
,
*
selectedBin
,
false
))
{
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Unable to remove box '"
<<
boxId
<<
"'!"
);
ROS_WARN_STREAM
(
"["
<<
NODE_NAME
<<
"] Unable to remove box '"
<<
boxId
<<
"'!"
);
selectedBox
=
nullptr
;
selectedBin
=
nullptr
;
}
else
{
}
else
{
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Job is done! '"
<<
boxId
<<
"' is no more."
);
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Job is done! '"
<<
boxId
<<
"' is no more."
);
connector
.
sendScene
();
}
selectedBox
=
nullptr
;
selectedBox
=
nullptr
;
selectedBin
=
nullptr
;
selectedBin
=
nullptr
;
connector
.
sendScene
();
}
}
}
};
};
...
@@ -102,7 +99,7 @@ int main(int argc, char **argv) {
...
@@ -102,7 +99,7 @@ int main(int argc, char **argv) {
ros
::
ServiceClient
bin_check_client
=
n
.
serviceClient
<
ccf
::
BinCheck
>
(
"/check_bin_service"
);
ros
::
ServiceClient
bin_check_client
=
n
.
serviceClient
<
ccf
::
BinCheck
>
(
"/check_bin_service"
);
ros
::
ServiceServer
get_scene_service
=
n
.
advertiseService
<
ccf
::
SceneUpdateRequest
,
ccf
::
SceneUpdateResponse
>
(
ros
::
ServiceServer
get_scene_service
=
n
.
advertiseService
<
ccf
::
SceneUpdateRequest
,
ccf
::
SceneUpdateResponse
>
(
"
/connector_node_ros_cgv/
updateCgvScene"
,
"updateCgvScene"
,
[
&
currentlyPickedBox
,
&
connector
,
&
bin_check_client
](
auto
&
req
,
auto
&
res
)
{
[
&
currentlyPickedBox
,
&
connector
,
&
bin_check_client
](
auto
&
req
,
auto
&
res
)
{
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Received a scene update from the controller."
);
ROS_INFO_STREAM
(
"["
<<
NODE_NAME
<<
"] Received a scene update from the controller."
);
connector
.
updateScene
(
req
,
bin_check_client
);
connector
.
updateScene
(
req
,
bin_check_client
);
...
...
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