Skip to content

Commit e5f890e

Browse files
skpawar1305omichel
andauthored
add remappings to robot state publisher for ur5e example (#841)
* add remappings to robot state publisher for ur5e example follow up to f3045ad * remove get_namespace() from service client topic, used to set a parameter also, include universal_robot_driver to the launch_description list before moveit, else setting robot_description fails randomly * Update webots_ros2_universal_robot/launch/robot_launch/robot_moveit_nodes_launch.py Co-authored-by: Olivier Michel <[email protected]> --------- Co-authored-by: Olivier Michel <[email protected]>
1 parent f3045ad commit e5f890e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

webots_ros2_driver/src/WebotsNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ namespace webots_ros2_driver {
306306
}
307307

308308
void WebotsNode::setAnotherNodeParameter(std::string anotherNodeName, std::string parameterName, std::string parameterValue) {
309-
mClient = create_client<rcl_interfaces::srv::SetParameters>(get_namespace() + anotherNodeName + "/set_parameters");
309+
mClient = create_client<rcl_interfaces::srv::SetParameters>(anotherNodeName + "/set_parameters");
310310
mClient->wait_for_service(std::chrono::seconds(1));
311311
rcl_interfaces::srv::SetParameters::Request::SharedPtr request =
312312
std::make_shared<rcl_interfaces::srv::SetParameters::Request>();

webots_ros2_universal_robot/launch/robot_launch/robot_moveit_nodes_launch.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ def load_yaml(filename):
4141

4242
# Check if moveit is installed
4343
if 'moveit' in get_packages_with_prefixes():
44+
# Webots simulation with robot
45+
launch_description_nodes.append(
46+
IncludeLaunchDescription(
47+
PythonLaunchDescriptionSource(os.path.join(package_dir, 'launch', 'robot_nodes_launch.py'))
48+
)
49+
)
50+
4451
# Configuration
4552
description = {'robot_description': load_file('ur5e_with_gripper.urdf')}
4653
description_semantic = {'robot_description_semantic': load_file('moveit_ur5e.srdf')}
@@ -88,13 +95,6 @@ def load_yaml(filename):
8895
remappings=[('/joint_states', '/ur5e/joint_states')]
8996
)
9097
)
91-
92-
# Webots simulation with robot
93-
launch_description_nodes.append(
94-
IncludeLaunchDescription(
95-
PythonLaunchDescriptionSource(os.path.join(package_dir, 'launch', 'robot_nodes_launch.py'))
96-
)
97-
)
9898
else:
9999
launch_description_nodes.append(LogInfo(msg='"moveit" package is not installed, \
100100
please install it in order to run this demo.'))

webots_ros2_universal_robot/launch/robot_launch/robot_nodes_launch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ def generate_launch_description():
4747
# When having multiple robot it is mandatory to specify the robot name.
4848
universal_robot_driver = WebotsController(
4949
robot_name='UR5e',
50+
namespace='ur5e',
5051
parameters=[
5152
{'robot_description': robot_description_path},
5253
{'use_sim_time': True},
5354
{'set_robot_state_publisher': True},
5455
ros2_control_params
5556
],
56-
namespace='ur5e'
5757
)
5858

5959
# Other ROS 2 nodes
@@ -77,6 +77,7 @@ def generate_launch_description():
7777

7878
robot_state_publisher = Node(
7979
package='robot_state_publisher',
80+
namespace='ur5e',
8081
executable='robot_state_publisher',
8182
output='screen',
8283
parameters=[{

0 commit comments

Comments
 (0)