Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
multi_cell_builder
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
Show more breadcrumbs
Matteo Anedda
multi_cell_builder
Commits
fe0fb0a2
Commit
fe0fb0a2
authored
2 years ago
by
KingMaZito
Browse files
Options
Downloads
Patches
Plain Diff
publish (and receive in javamg) workcells
parent
f8398302
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
launch/mg_routine.launch
+25
-0
25 additions, 0 deletions
launch/mg_routine.launch
src/mediator/mg_mediator.cpp
+35
-17
35 additions, 17 deletions
src/mediator/mg_mediator.cpp
with
60 additions
and
17 deletions
launch/mg_routine.launch
0 → 100644
+
25
−
0
View file @
fe0fb0a2
<launch>
<arg name="result" default="dummy/-2045918175/-2045918175.yaml" />
<!--<include file="$(find panda_moveit_config)/launch/demo.launch"></include> -->
<!-- this is to change-->
<rosparam command="load" file="$(find multi_cell_builder)/results/$(arg result)"/>
<rosparam ns="planning_pipelines" param="pipeline_names">["ompl"]</rosparam>
<include file="$(find ceti_double)/launch/demo.launch">
<arg name="use_rviz" value="false"/>
<arg name="scene" value="$(arg result)" />
</include>
<include ns="cell_routine" file="$(find ceti_double)/launch/fake_moveit_controller_manager.launch.xml" />
<param name="move_group/capabilities" value="move_group/ExecuteTaskSolutionCapability" />
<include file="$(find ceti_double)/launch/moveit_rviz.launch">
<arg name="rviz_config" value="$(find multi_cell_builder)/launch/rviz/cell_routine.rviz" />
</include>
<node pkg="multi_cell_builder" type="mg_routine" name="mg_routine" output="screen" required="true">
</node>
</launch>
This diff is collapsed.
Click to expand it.
src/mediator/mg_mediator.cpp
+
35
−
17
View file @
fe0fb0a2
...
@@ -4,7 +4,7 @@ MGMediator::MGMediator(std::shared_ptr<ros::NodeHandle> const& nh)
...
@@ -4,7 +4,7 @@ MGMediator::MGMediator(std::shared_ptr<ros::NodeHandle> const& nh)
:
AbstractMediator
(
nh
)
:
AbstractMediator
(
nh
)
,
Controller
(
*
nh
.
get
())
,
Controller
(
*
nh
.
get
())
{
{
addConnection
(
std
::
make_shared
<
MqttConnection
>
(
"
"
,
"super
"
));
addConnection
(
std
::
make_shared
<
MqttConnection
>
(
"
localhost:1883"
,
"asdfadf
"
));
}
}
void
MGMediator
::
mediate
(){
void
MGMediator
::
mediate
(){
...
@@ -38,31 +38,49 @@ void MGMediator::connectRobots(std::unique_ptr<AbstractRobotDecorator> robot){
...
@@ -38,31 +38,49 @@ void MGMediator::connectRobots(std::unique_ptr<AbstractRobotDecorator> robot){
void
MGMediator
::
publishTables
(){
void
MGMediator
::
publishTables
(){
ros
::
WallDuration
sleep_time
(
1.0
);
ros
::
WallDuration
sleep_time
(
1.0
);
// for (const auto& s_r : robots_){
for
(
const
auto
&
s_r
:
robots_
){
// auto ceti_bot = dynamic_cast<CetiRobot*>(s_r.second->next());
auto
ceti_bot
=
dynamic_cast
<
CetiRobot
*>
(
s_r
.
second
->
next
());
// for (std::size_t k = 0; k < ceti_bot->observerMask().size(); k++){
for
(
std
::
size_t
k
=
0
;
k
<
ceti_bot
->
observerMask
().
size
();
k
++
){
// if(ceti_bot->observerMask()[k]){
if
(
ceti_bot
->
observerMask
()[
k
]){
// auto wmd = dynamic_cast<MoveitPanel*>(ceti_bot->observers()[k]->next());
auto
wmd
=
dynamic_cast
<
MoveitPanel
*>
(
ceti_bot
->
observers
()[
k
]
->
next
());
// psi_->applyCollisionObject(wmd->marker());
psi_
->
applyCollisionObject
(
wmd
->
marker
());
// acm_.insert(std::pair<std::string, std::vector<uint8_t>>(wmd->marker().id.c_str(), std::vector<uint8_t>()));
acm_
.
insert
(
std
::
pair
<
std
::
string
,
std
::
vector
<
uint8_t
>>
(
wmd
->
marker
().
id
.
c_str
(),
std
::
vector
<
uint8_t
>
()));
// sleep_time.sleep();
sleep_time
.
sleep
();
// }
}
// }
}
// }
}
std
::
string
str
;
std
::
string
str
;
std
::
map
<
const
std
::
string
,
std
::
vector
<
Cuboid
>>
robot_to_cuboid
;
std
::
map
<
const
std
::
string
,
std
::
vector
<
Cuboid
>>
robot_to_cuboid
;
std
::
bitset
<
3
>
panel_mask
;
std
::
bitset
<
3
>
panel_mask
(
7
)
;
for
(
const
auto
&
pair
:
robots_
)
{
for
(
const
auto
&
pair
:
robots_
)
{
robot_to_cuboid
.
insert_or_assign
(
pair
.
first
,
std
::
vector
<
Cuboid
>
());
robot_to_cuboid
.
insert_or_assign
(
pair
.
first
,
std
::
vector
<
Cuboid
>
());
std
::
stringstream
ss
;
ss
<<
"{
\"
objects
\"
: [{
\"
id
\"
:
\"
"
<<
pair
.
first
<<
"
\"
,
\"
type
\"
:
\"
ARM
\"
}"
;
for
(
auto
&
c
:
cuboid_reader_
->
cuboidBox
()){
for
(
auto
&
c
:
cuboid_reader_
->
cuboidBox
()){
tf2
::
Transform
trans
(
tf2
::
Quaternion
(
0
,
0
,
0
,
1
),
tf2
::
Vector3
(
c
.
Pose
.
position
.
x
,
c
.
Pose
.
position
.
y
,
c
.
Pose
.
position
.
z
));
tf2
::
Transform
trans
(
tf2
::
Quaternion
(
0
,
0
,
0
,
1
),
tf2
::
Vector3
(
c
.
Pose
.
position
.
x
,
c
.
Pose
.
position
.
y
,
c
.
Pose
.
position
.
z
));
if
(
pair
.
second
->
checkSingleObjectCollision
(
trans
,
str
,
panel_mask
))
robot_to_cuboid
[
pair
.
first
].
push_back
(
c
);
if
(
pair
.
second
->
checkSingleObjectCollision
(
trans
,
str
,
panel_mask
))
{
ss
<<
",{
\"
id
\"
:
\"
"
<<
c
.
Name
<<
"
\"
,
\"
type
\"
:
\"
BOX
\"
,
\"
pos
\"
: {
\"
x
\"
: "
<<
c
.
Pose
.
position
.
x
<<
",
\"
y
\"
: "
<<
c
.
Pose
.
position
.
y
<<
",
\"
z
\"
: "
<<
c
.
Pose
.
position
.
x
<<
"},
\"
size
\"
: {
\"
length
\"
: "
<<
c
.
x_depth
<<
",
\"
width
\"
: "
<<
c
.
y_width
<<
",
\"
height
\"
: "
<<
c
.
z_heigth
<<
"},
\"
orientation
\"
: {
\"
x
\"
: "
<<
c
.
Pose
.
orientation
.
x
<<
",
\"
y
\"
: "
<<
c
.
Pose
.
orientation
.
y
<<
" ,
\"
z
\"
: "
<<
c
.
Pose
.
orientation
.
z
<<
",
\"
w
\"
: "
<<
c
.
Pose
.
orientation
.
w
<<
"},"
;
ss
<<
"
\"
color
\"
: {
\"
r
\"
: 0.2,
\"
g
\"
: 0.2,
\"
b
\"
: 0.2}}"
;
}
}
}
}
for
(
auto
&
c
:
cuboid_reader_
->
cuboidObstacle
()){
tf2
::
Transform
trans
(
tf2
::
Quaternion
(
0
,
0
,
0
,
1
),
tf2
::
Vector3
(
c
.
Pose
.
position
.
x
,
c
.
Pose
.
position
.
y
,
c
.
Pose
.
position
.
z
));
if
(
pair
.
second
->
checkSingleObjectCollision
(
trans
,
str
,
panel_mask
))
{
ss
<<
",{
\"
id
\"
:
\"
"
<<
c
.
Name
<<
"
\"
,
\"
type
\"
:
\"
BIN
\"
,
\"
pos
\"
: {
\"
x
\"
: "
<<
c
.
Pose
.
position
.
x
<<
",
\"
y
\"
: "
<<
c
.
Pose
.
position
.
y
<<
",
\"
z
\"
: "
<<
c
.
Pose
.
position
.
x
<<
"},
\"
size
\"
: {
\"
length
\"
: "
<<
c
.
x_depth
<<
",
\"
width
\"
: "
<<
c
.
y_width
<<
",
\"
height
\"
: "
<<
c
.
z_heigth
<<
"},
\"
orientation
\"
: {
\"
x
\"
: "
<<
c
.
Pose
.
orientation
.
x
<<
",
\"
y
\"
: "
<<
c
.
Pose
.
orientation
.
y
<<
" ,
\"
z
\"
: "
<<
c
.
Pose
.
orientation
.
z
<<
",
\"
w
\"
: "
<<
c
.
Pose
.
orientation
.
w
<<
"},"
;
ss
<<
"
\"
color
\"
: {
\"
r
\"
: 0.2,
\"
g
\"
: 0.2,
\"
b
\"
: 0.2}}"
;
}
}
ss
<<
"]}"
;
// publish
sendToAll
(
"World/robotarm1robotarm2"
,
ss
.
str
());
}
}
}
void
MGMediator
::
setPanel
(){
void
MGMediator
::
setPanel
(){
...
...
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