Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
panda_mqtt_connector
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
ROS Packages
panda_mqtt_connector
Commits
2f27460b
Commit
2f27460b
authored
Apr 14, 2020
by
Sebastian Ebert
Browse files
Options
Downloads
Patches
Plain Diff
configuration of looped trajectory via mqtt
parent
88e7a806
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/MqttRosConnectionTestNode.cpp
+72
-37
72 additions, 37 deletions
src/MqttRosConnectionTestNode.cpp
src/robot_state_initializer.cpp
+1
-0
1 addition, 0 deletions
src/robot_state_initializer.cpp
src/util/TrajectoryUtil.h
+0
-3
0 additions, 3 deletions
src/util/TrajectoryUtil.h
with
73 additions
and
40 deletions
src/MqttRosConnectionTestNode.cpp
+
72
−
37
View file @
2f27460b
...
@@ -17,9 +17,9 @@ using namespace std::chrono;
...
@@ -17,9 +17,9 @@ using namespace std::chrono;
* mqtt-topics for all links
* mqtt-topics for all links
* ground, link0, link1, link2, link3, link4, link5, link6, link7 (end-effector), left finger, right finder
* ground, link0, link1, link2, link3, link4, link5, link6, link7 (end-effector), left finger, right finder
*/
*/
std
::
string
topics
[
11
]
=
{
"panda_link_0"
,
"panda_link_1"
,
"panda_link_2"
,
"panda_link_3"
,
std
::
string
topics
[
11
]
=
{
"panda_ground"
,
"panda_link_0"
,
"panda_link_1"
,
"panda_link_2"
,
"panda_link_4"
,
"panda_link_5"
,
"panda_link_6"
,
"panda_link_7"
,
"panda_link_3"
,
"panda_link_4"
,
"panda_link_5"
,
"panda_link_6"
,
"panda_link_8"
,
"panda_link_9"
,
"panda_link_10"
};
"panda_link_7"
,
"panda_link_8"
,
"panda_link_9"
};
const
string
SERVER_ADDRESS
{
"tcp://localhost:1883"
};
const
string
SERVER_ADDRESS
{
"tcp://localhost:1883"
};
const
string
CLIENT_ID
{
"ros_mqtt_tester"
};
const
string
CLIENT_ID
{
"ros_mqtt_tester"
};
...
@@ -65,27 +65,57 @@ bool try_reconnect(mqtt::client& cli)
...
@@ -65,27 +65,57 @@ bool try_reconnect(mqtt::client& cli)
return
false
;
return
false
;
}
}
void
testTrajectoryUpdate
(
ros
::
NodeHandle
n
){
void
testConfig
(
ros
::
NodeHandle
n
)
{
std
::
cout
<<
">>>>>>>>>>>> STARTING TRAJECTORY UPDATE TEST <<<<<<<<<<<<<"
<<
std
::
endl
;
std
::
cout
<<
">>>>>>>>>>>> STARTING TEST <<<<<<<<<<<<<"
<<
std
::
endl
;
setupMqtt
();
setupMqtt
();
/*config::DataConfig dc
;
plan
::
Trajectory
traj
;
dc.set_enableposition(true);
plan
::
Trajectory_Position
pos1
;
dc.set_enableorientation(true);
pos1
.
set_x
(
0.6
);
dc.set_enabletwistangular(true);
pos1
.
set_y
(
0.0
);
dc.set_enabletwistlinear(true);
pos1
.
set_z
(
0.6
);
dc.set_publishrate(1000);
traj
.
add_pos
()
->
CopyFrom
(
pos1
);
plan
::
Trajectory_Position
pos2
;
pos2
.
set_x
(
-
0.6
);
pos2
.
set_y
(
0.0
);
pos2
.
set_z
(
0.6
);
traj
.
add_pos
()
->
CopyFrom
(
pos2
);
std
::
string
mqtt_msg
;
std
::
string
mqtt_msg
;
dc
.SerializeToString(&mqtt_msg);
traj
.
SerializeToString
(
&
mqtt_msg
);
auto pubmsg = mqtt::make_message("
data
config", mqtt_msg);
auto
pubmsg
=
mqtt
::
make_message
(
"
trajectory
config"
,
mqtt_msg
);
pubmsg
->
set_qos
(
QOS
);
pubmsg
->
set_qos
(
QOS
);
client.publish(pubmsg);
*/
client
.
publish
(
pubmsg
);
std
::
cout
<<
">>>>>>>>>>>> CHECKING SERVER <<<<<<<<<<<<<"
<<
std
::
endl
;
std
::
vector
<
double
>
x_pos
;
std
::
vector
<
double
>
y_pos
;
std
::
vector
<
double
>
z_pos
;
ros
::
Duration
(
5.0
).
sleep
();
std
::
cout
<<
"x configured: "
<<
n
.
getParam
(
"trajectory_pos_x"
,
x_pos
)
<<
std
::
endl
;
std
::
cout
<<
"y configured: "
<<
n
.
getParam
(
"trajectory_pos_y"
,
y_pos
)
<<
std
::
endl
;
std
::
cout
<<
"z configured: "
<<
n
.
getParam
(
"trajectory_pos_z"
,
z_pos
)
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
x_pos
.
size
();
i
++
)
{
std
::
cout
<<
"X POS: "
<<
x_pos
.
at
(
i
)
<<
std
::
endl
;
std
::
cout
<<
"Y POS: "
<<
y_pos
.
at
(
i
)
<<
std
::
endl
;
std
::
cout
<<
"Z POS: "
<<
z_pos
.
at
(
i
)
<<
std
::
endl
;
}
}
void
testPlanningModeChange
(
ros
::
NodeHandle
n
){
std
::
cout
<<
">>>>>>>>>>>> STARTING PLANNING TEST <<<<<<<<<<<<<"
<<
std
::
endl
;
setupMqtt
();
setupMqtt
();
config
::
RobotConfig
rc
;
config
::
RobotConfig
rc
;
...
@@ -99,34 +129,27 @@ void testConfig(ros::NodeHandle n) {
...
@@ -99,34 +129,27 @@ void testConfig(ros::NodeHandle n) {
auto
pubmsg
=
mqtt
::
make_message
(
"robotconfig"
,
mqtt_msg
);
auto
pubmsg
=
mqtt
::
make_message
(
"robotconfig"
,
mqtt_msg
);
pubmsg
->
set_qos
(
QOS
);
pubmsg
->
set_qos
(
QOS
);
client
.
publish
(
pubmsg
);
client
.
publish
(
pubmsg
);
}
/*plan::Trajectory traj;
void
testConfig
(
ros
::
NodeHandle
n
)
{
std
::
cout
<<
">>>>>>>>>>>> STARTING CONFIG TEST <<<<<<<<<<<<<"
<<
std
::
endl
;
setupMqtt
();
plan::Trajectory_Position pos;
config
::
DataConfig
dc
;
pos.set_x(0.6);
pos.set_y(0.0);
pos.set_z(0.6);
traj.add_pos()->CopyFrom(pos);
dc
.
set_enableposition
(
true
);
dc
.
set_enableorientation
(
true
);
dc
.
set_enabletwistangular
(
true
);
dc
.
set_enabletwistlinear
(
true
);
dc
.
set_publishrate
(
1000
);
std
::
string
mqtt_msg
;
std
::
string
mqtt_msg
;
traj
.SerializeToString(&mqtt_msg);
dc
.
SerializeToString
(
&
mqtt_msg
);
auto pubmsg = mqtt::make_message("
trajectory
config", mqtt_msg);
auto
pubmsg
=
mqtt
::
make_message
(
"
data
config"
,
mqtt_msg
);
pubmsg
->
set_qos
(
QOS
);
pubmsg
->
set_qos
(
QOS
);
client
.
publish
(
pubmsg
);
client
.
publish
(
pubmsg
);
std::cout << ">>>>>>>>>>>> CHECKING SERVER <<<<<<<<<<<<<" << std::endl;
std::vector<double> x_pos;
ros::Duration(5.0).sleep();
std:cout << n.getParam("trajectory_pos_x", x_pos) << std::endl;
for(int i = 0; i < x_pos.size(); i++)
{
std::cout << "X POS: " << x_pos.at(i) << std::endl;
}*/
}
}
void
receiveMqttMessages
(
ros
::
NodeHandle
n
)
void
receiveMqttMessages
(
ros
::
NodeHandle
n
)
...
@@ -143,7 +166,9 @@ void receiveMqttMessages(ros::NodeHandle n)
...
@@ -143,7 +166,9 @@ void receiveMqttMessages(ros::NodeHandle n)
if
(
!
rsp
.
is_session_present
())
{
if
(
!
rsp
.
is_session_present
())
{
ROS_INFO_STREAM
(
"TEST Subscribing to topics."
);
ROS_INFO_STREAM
(
"TEST Subscribing to topics."
);
cli
.
subscribe
(
"nodetest"
,
1
);
cli
.
subscribe
(
"configtest"
,
1
);
cli
.
subscribe
(
"modetest"
,
1
);
cli
.
subscribe
(
"trajectorytest"
,
1
);
ROS_INFO_STREAM
(
"TEST Subscribed to topics."
);
ROS_INFO_STREAM
(
"TEST Subscribed to topics."
);
}
else
{
}
else
{
ROS_WARN_STREAM
(
"TEST Session already present. Skipping subscribe."
);
ROS_WARN_STREAM
(
"TEST Session already present. Skipping subscribe."
);
...
@@ -172,10 +197,20 @@ void receiveMqttMessages(ros::NodeHandle n)
...
@@ -172,10 +197,20 @@ void receiveMqttMessages(ros::NodeHandle n)
break
;
break
;
}
}
if
(
msg
->
get_topic
()
==
"
node
test"
)
if
(
msg
->
get_topic
()
==
"
config
test"
)
{
{
testConfig
(
n
);
testConfig
(
n
);
}
}
if
(
msg
->
get_topic
()
==
"modetest"
)
{
testPlanningModeChange
(
n
);
}
if
(
msg
->
get_topic
()
==
"trajectorytest"
)
{
testTrajectoryUpdate
(
n
);
}
}
}
}
}
catch
(
const
mqtt
::
exception
&
exc
)
{
catch
(
const
mqtt
::
exception
&
exc
)
{
...
...
This diff is collapsed.
Click to expand it.
src/robot_state_initializer.cpp
+
1
−
0
View file @
2f27460b
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
void
initSystemVariables
(
ros
::
NodeHandle
node_handle
)
void
initSystemVariables
(
ros
::
NodeHandle
node_handle
)
{
{
node_handle
.
setParam
(
"new_trajectory_available"
,
false
);
node_handle
.
setParam
(
"new_trajectory_available"
,
false
);
node_handle
.
setParam
(
"loop_trajectory"
,
true
);
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
...
This diff is collapsed.
Click to expand it.
src/util/TrajectoryUtil.h
+
0
−
3
View file @
2f27460b
...
@@ -21,9 +21,6 @@ public:
...
@@ -21,9 +21,6 @@ public:
static
const
std
::
string
CARTESIAN_PATH
;
static
const
std
::
string
CARTESIAN_PATH
;
static
const
std
::
string
FLUID_PATH
;
static
const
std
::
string
FLUID_PATH
;
//const std::string LIMITED_EXECUTION = "limited_execution";
//const std::string UNLIMITED_EXECUTION = "unlimited_execution";
bool
computePathToPose
(
moveit
::
planning_interface
::
MoveGroupInterface
&
group
,
bool
computePathToPose
(
moveit
::
planning_interface
::
MoveGroupInterface
&
group
,
moveit
::
planning_interface
::
MoveGroupInterface
::
Plan
&
plan
,
geometry_msgs
::
Pose
targetPose
,
moveit
::
planning_interface
::
MoveGroupInterface
::
Plan
&
plan
,
geometry_msgs
::
Pose
targetPose
,
std
::
string
pathType
,
double
velocity
);
std
::
string
pathType
,
double
velocity
);
...
...
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