Skip to content

Commit 7d0d8d9

Browse files
author
Ubuntu
committed
Resolve conflicts
1 parent f0879d8 commit 7d0d8d9

File tree

8 files changed

+73
-357
lines changed

8 files changed

+73
-357
lines changed

ur_bringup/config/ur_controllers.yaml

Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,45 @@ controller_manager:
2424
forward_position_controller:
2525
type: position_controllers/JointGroupPositionController
2626

27+
passthrough_trajectory_controller:
28+
type: ur_controllers/PassthroughTrajectoryController
29+
30+
tcp_pose_broadcaster:
31+
type: pose_broadcaster/PoseBroadcaster
32+
2733

2834
speed_scaling_state_broadcaster:
2935
ros__parameters:
3036
state_publish_rate: 100.0
37+
tf_prefix: "$(var tf_prefix)"
3138

39+
io_and_status_controller:
40+
ros__parameters:
41+
tf_prefix: "$(var tf_prefix)"
3242

3343
force_torque_sensor_broadcaster:
3444
ros__parameters:
35-
sensor_name: tcp_fts_sensor
45+
sensor_name: $(var tf_prefix)tcp_fts_sensor
3646
state_interface_names:
3747
- force.x
3848
- force.y
3949
- force.z
4050
- torque.x
4151
- torque.y
4252
- torque.z
43-
frame_id: tool0
53+
frame_id: $(var tf_prefix)tool0
4454
topic_name: ft_data
4555

4656

4757
joint_trajectory_controller:
4858
ros__parameters:
4959
joints:
50-
- shoulder_pan_joint
51-
- shoulder_lift_joint
52-
- elbow_joint
53-
- wrist_1_joint
54-
- wrist_2_joint
55-
- wrist_3_joint
60+
- $(var tf_prefix)shoulder_pan_joint
61+
- $(var tf_prefix)shoulder_lift_joint
62+
- $(var tf_prefix)elbow_joint
63+
- $(var tf_prefix)wrist_1_joint
64+
- $(var tf_prefix)wrist_2_joint
65+
- $(var tf_prefix)wrist_3_joint
5666
command_interfaces:
5767
- position
5868
state_interfaces:
@@ -64,23 +74,23 @@ joint_trajectory_controller:
6474
constraints:
6575
stopped_velocity_tolerance: 0.2
6676
goal_time: 0.0
67-
shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 }
68-
shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 }
69-
elbow_joint: { trajectory: 0.2, goal: 0.1 }
70-
wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
71-
wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
72-
wrist_3_joint: { trajectory: 0.2, goal: 0.1 }
77+
$(var tf_prefix)shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 }
78+
$(var tf_prefix)shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 }
79+
$(var tf_prefix)elbow_joint: { trajectory: 0.2, goal: 0.1 }
80+
$(var tf_prefix)wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
81+
$(var tf_prefix)wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
82+
$(var tf_prefix)wrist_3_joint: { trajectory: 0.2, goal: 0.1 }
7383

7484

7585
scaled_joint_trajectory_controller:
7686
ros__parameters:
7787
joints:
78-
- shoulder_pan_joint
79-
- shoulder_lift_joint
80-
- elbow_joint
81-
- wrist_1_joint
82-
- wrist_2_joint
83-
- wrist_3_joint
88+
- $(var tf_prefix)shoulder_pan_joint
89+
- $(var tf_prefix)shoulder_lift_joint
90+
- $(var tf_prefix)elbow_joint
91+
- $(var tf_prefix)wrist_1_joint
92+
- $(var tf_prefix)wrist_2_joint
93+
- $(var tf_prefix)wrist_3_joint
8494
command_interfaces:
8595
- position
8696
state_interfaces:
@@ -92,30 +102,46 @@ scaled_joint_trajectory_controller:
92102
constraints:
93103
stopped_velocity_tolerance: 0.2
94104
goal_time: 0.0
95-
shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 }
96-
shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 }
97-
elbow_joint: { trajectory: 0.2, goal: 0.1 }
98-
wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
99-
wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
100-
wrist_3_joint: { trajectory: 0.2, goal: 0.1 }
105+
$(var tf_prefix)shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 }
106+
$(var tf_prefix)shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 }
107+
$(var tf_prefix)elbow_joint: { trajectory: 0.2, goal: 0.1 }
108+
$(var tf_prefix)wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
109+
$(var tf_prefix)wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
110+
$(var tf_prefix)wrist_3_joint: { trajectory: 0.2, goal: 0.1 }
111+
speed_scaling_interface_name: $(var tf_prefix)speed_scaling/speed_scaling_factor
112+
113+
passthrough_trajectory_controller:
114+
ros__parameters:
115+
tf_prefix: "$(var tf_prefix)"
116+
joints:
117+
- $(var tf_prefix)shoulder_pan_joint
118+
- $(var tf_prefix)shoulder_lift_joint
119+
- $(var tf_prefix)elbow_joint
120+
- $(var tf_prefix)wrist_1_joint
121+
- $(var tf_prefix)wrist_2_joint
122+
- $(var tf_prefix)wrist_3_joint
123+
state_interfaces:
124+
- position
125+
- velocity
126+
speed_scaling_interface_name: $(var tf_prefix)speed_scaling/speed_scaling_factor
101127

102128
forward_velocity_controller:
103129
ros__parameters:
104130
joints:
105-
- shoulder_pan_joint
106-
- shoulder_lift_joint
107-
- elbow_joint
108-
- wrist_1_joint
109-
- wrist_2_joint
110-
- wrist_3_joint
131+
- $(var tf_prefix)shoulder_pan_joint
132+
- $(var tf_prefix)shoulder_lift_joint
133+
- $(var tf_prefix)elbow_joint
134+
- $(var tf_prefix)wrist_1_joint
135+
- $(var tf_prefix)wrist_2_joint
136+
- $(var tf_prefix)wrist_3_joint
111137
interface_name: velocity
112138

113139
forward_position_controller:
114140
ros__parameters:
115141
joints:
116-
- shoulder_pan_joint
117-
- shoulder_lift_joint
118-
- elbow_joint
119-
- wrist_1_joint
120-
- wrist_2_joint
121-
- wrist_3_joint
142+
- $(var tf_prefix)shoulder_pan_joint
143+
- $(var tf_prefix)shoulder_lift_joint
144+
- $(var tf_prefix)elbow_joint
145+
- $(var tf_prefix)wrist_1_joint
146+
- $(var tf_prefix)wrist_2_joint
147+
- $(var tf_prefix)wrist_3_joint

ur_controllers/src/passthrough_trajectory_controller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ controller_interface::return_type PassthroughTrajectoryController::update(const
327327
scaling_factor_ = scaling_state_interface_->get().get_value();
328328
}
329329

330-
active_trajectory_elapsed_time_ += period * scaling_factor_;
330+
active_trajectory_elapsed_time_ = active_trajectory_elapsed_time_ + (period * scaling_factor_);
331331

332332
// RCLCPP_INFO(get_node()->get_logger(), "Elapsed trajectory time: %f. Scaling factor: %f, period: %f",
333333
// active_trajectory_elapsed_time_.seconds(), scaling_factor_, period.seconds());
@@ -356,7 +356,7 @@ rclcpp_action::GoalResponse PassthroughTrajectoryController::goal_received_callb
356356
{
357357
RCLCPP_INFO(get_node()->get_logger(), "Received new trajectory.");
358358
// Precondition: Running controller
359-
if (get_lifecycle_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE) {
359+
if (get_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE) {
360360
RCLCPP_ERROR(get_node()->get_logger(), "Can't accept new trajectories. Controller is not running.");
361361
return rclcpp_action::GoalResponse::REJECT;
362362
}

ur_robot_driver/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ ament_python_install_package(${PROJECT_NAME})
156156
# Install Python executables
157157
install(PROGRAMS
158158
scripts/tool_communication.py
159+
scripts/example_move.py
159160
DESTINATION lib/${PROJECT_NAME}
160161
)
161162

ur_robot_driver/config/ur_controllers.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@ controller_manager:
2424
forward_position_controller:
2525
type: position_controllers/JointGroupPositionController
2626

27-
<<<<<<< HEAD
28-
=======
2927
passthrough_trajectory_controller:
3028
type: ur_controllers/PassthroughTrajectoryController
29+
3130
tcp_pose_broadcaster:
3231
type: pose_broadcaster/PoseBroadcaster
3332

34-
>>>>>>> ca5fb3e (Add trajectory passthrough controller (#944))
35-
ur_configuration_controller:
36-
type: ur_controllers/URConfigurationController
3733

3834
speed_scaling_state_broadcaster:
3935
ros__parameters:
@@ -44,10 +40,6 @@ io_and_status_controller:
4440
ros__parameters:
4541
tf_prefix: "$(var tf_prefix)"
4642

47-
ur_configuration_controller:
48-
ros__parameters:
49-
tf_prefix: "$(var tf_prefix)"
50-
5143
force_torque_sensor_broadcaster:
5244
ros__parameters:
5345
sensor_name: $(var tf_prefix)tcp_fts_sensor

ur_robot_driver/launch/ur_control.launch.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ def launch_setup(context, *args, **kwargs):
295295
"force_torque_sensor_broadcaster",
296296
"joint_state_broadcaster",
297297
"speed_scaling_state_broadcaster",
298-
"ur_configuration_controller",
299298
]
300299
},
301300
],
@@ -338,11 +337,7 @@ def controller_spawner(controllers, active=True):
338337
"io_and_status_controller",
339338
"speed_scaling_state_broadcaster",
340339
"force_torque_sensor_broadcaster",
341-
"ur_configuration_controller",
342340
]
343-
<<<<<<< HEAD
344-
controllers_inactive = ["forward_position_controller"]
345-
=======
346341
controllers_inactive = [
347342
"scaled_joint_trajectory_controller",
348343
"joint_trajectory_controller",
@@ -353,39 +348,11 @@ def controller_spawner(controllers, active=True):
353348
if activate_joint_controller.perform(context) == "true":
354349
controllers_active.append(initial_joint_controller.perform(context))
355350
controllers_inactive.remove(initial_joint_controller.perform(context))
356-
>>>>>>> ca5fb3e (Add trajectory passthrough controller (#944))
357351

358352
controller_spawners = [controller_spawner(controllers_active)] + [
359353
controller_spawner(controllers_inactive, active=False)
360354
]
361355

362-
# There may be other controllers of the joints, but this is the initially-started one
363-
initial_joint_controller_spawner_started = Node(
364-
package="controller_manager",
365-
executable="spawner",
366-
arguments=[
367-
initial_joint_controller,
368-
"-c",
369-
"/controller_manager",
370-
"--controller-manager-timeout",
371-
controller_spawner_timeout,
372-
],
373-
condition=IfCondition(activate_joint_controller),
374-
)
375-
initial_joint_controller_spawner_stopped = Node(
376-
package="controller_manager",
377-
executable="spawner",
378-
arguments=[
379-
initial_joint_controller,
380-
"-c",
381-
"/controller_manager",
382-
"--controller-manager-timeout",
383-
controller_spawner_timeout,
384-
"--inactive",
385-
],
386-
condition=UnlessCondition(activate_joint_controller),
387-
)
388-
389356
nodes_to_start = [
390357
control_node,
391358
ur_control_node,
@@ -395,8 +362,6 @@ def controller_spawner(controllers, active=True):
395362
urscript_interface,
396363
robot_state_publisher_node,
397364
rviz_node,
398-
initial_joint_controller_spawner_stopped,
399-
initial_joint_controller_spawner_started,
400365
] + controller_spawners
401366

402367
return nodes_to_start
@@ -525,16 +490,13 @@ def generate_launch_description():
525490
DeclareLaunchArgument(
526491
"initial_joint_controller",
527492
default_value="scaled_joint_trajectory_controller",
528-
<<<<<<< HEAD
529-
=======
530493
choices=[
531494
"scaled_joint_trajectory_controller",
532495
"joint_trajectory_controller",
533496
"forward_velocity_controller",
534497
"forward_position_controller",
535498
"passthrough_trajectory_controller",
536499
],
537-
>>>>>>> ca5fb3e (Add trajectory passthrough controller (#944))
538500
description="Initially loaded robot controller.",
539501
)
540502
)

ur_robot_driver/scripts/example_move.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,24 @@
4848
"traj0": [
4949
{
5050
"positions": [0.043128, -1.28824, 1.37179, -1.82208, -1.63632, -0.18],
51-
"velocities": [0, 0, 0, 0, 0, 0],
51+
"velocities": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
5252
"time_from_start": Duration(sec=4, nanosec=0),
5353
},
5454
{
5555
"positions": [-0.195016, -1.70093, 0.902027, -0.944217, -1.52982, -0.195171],
56-
"velocities": [0, 0, 0, 0, 0, 0],
56+
"velocities": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
5757
"time_from_start": Duration(sec=8, nanosec=0),
5858
},
5959
],
6060
"traj1": [
6161
{
6262
"positions": [-0.195016, -1.70094, 0.902027, -0.944217, -1.52982, -0.195171],
63-
"velocities": [0, 0, 0, 0, 0, 0],
63+
"velocities": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
6464
"time_from_start": Duration(sec=0, nanosec=0),
6565
},
6666
{
6767
"positions": [0.30493, -0.982258, 0.955637, -1.48215, -1.72737, 0.204445],
68-
"velocities": [0, 0, 0, 0, 0, 0],
68+
"velocities": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
6969
"time_from_start": Duration(sec=8, nanosec=0),
7070
},
7171
],

ur_robot_driver/src/hardware_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ hardware_interface::return_type URPositionHardwareInterface::prepare_command_mod
887887

888888
if (!std::all_of(start_modes_.begin() + 1, start_modes_.end(),
889889
[&](const std::string& other) { return other == start_modes_[0]; })) {
890-
RCLCPP_ERROR(get_logger(), "Start modes of all joints have to be the same.");
890+
RCLCPP_ERROR(rclcpp::get_logger("URPositionHardwareInterface"), "Start modes of all joints have to be the same.");
891891
return hardware_interface::return_type::ERROR;
892892
}
893893

0 commit comments

Comments
 (0)