Skip to content

Commit b640b0e

Browse files
authored
[Robotics] Refactor Pick & Place simulation (#2196)
1 parent fb69fcb commit b640b0e

File tree

10 files changed

+15
-1013
lines changed

10 files changed

+15
-1013
lines changed

robotics-ai-suite/components/simulations/PicknPlace/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The aim is to harnesses the capabilities of both the Nav2 and MoveIt2 stacks, pr
1313

1414
OS: Ubuntu 22.04
1515

16-
ROS2: Tested on Humble (but Should work with Foxy too)
16+
ROS2: Tested on Humble
1717

1818
### Prerequisites
1919

robotics-ai-suite/components/simulations/PicknPlace/gazebo_plugins/src/ConveyorBeltPlugin.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ void ConveyorBeltPlugin::Configure(
7575
this->publish_period_ = std::chrono::nanoseconds(
7676
static_cast<int64_t>((1.0 / this->publish_rate_) * 1e9));
7777

78+
// Initialize ROS node if it hasn't been initialized yet
79+
if (!rclcpp::ok()) {
80+
rclcpp::init(0, nullptr);
81+
}
82+
83+
// Initialize ROS node
84+
std::string node_name = "conveyor_belt_simplified";
85+
if (_sdf) {
86+
node_name =
87+
_sdf->Get<std::string>("node_name", "conveyor_belt_simplified").first;
88+
}
89+
this->ros_node_ = rclcpp::Node::make_shared(node_name);
90+
7891
// Resolve joint
7992
this->joint = model.JointByName(_ecm, this->joint_name_);
8093
if (this->joint == gazebo::kNullEntity) {
@@ -88,16 +101,6 @@ void ConveyorBeltPlugin::Configure(
88101
_ecm.CreateComponent(this->joint,
89102
gazebo::components::JointVelocityCmd({0.0}));
90103

91-
// Initialize ROS node if it hasn't been initialized yet
92-
if (!rclcpp::ok()) {
93-
rclcpp::init(0, nullptr);
94-
}
95-
96-
// // Initialize ROS node
97-
auto node_name =
98-
_sdf->Get<std::string>("node_name", "conveyor_belt_simplified").first;
99-
this->ros_node_ = rclcpp::Node::make_shared(node_name);
100-
101104
std::string stateTopic = "conveyor/state";
102105
std::string controlTopic = "conveyor/control";
103106

robotics-ai-suite/components/simulations/PicknPlace/robot_config/launch/arm.launch.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ def launch_setup(context: LaunchContext):
197197
]
198198
}"""
199199

200-
controller_run_state = 'active'
201-
if os.environ.get('ROS_DISTRO') == 'foxy':
202-
controller_run_state = 'start'
203-
204200
# Set initial joint position for robot - needed for all ROS distros
205201
set_initial_pose = ExecuteProcess(
206202
cmd=[

robotics-ai-suite/components/simulations/PicknPlace/robot_config/launch/gazebo.launch.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,6 @@
1616
# and limitations under the License.
1717

1818
# Description: Helper launch file to spawn AMR in Gazebo separated by namespace
19-
# Example usage:
20-
#
21-
# gazebo_launch_cmd = IncludeLaunchDescription(
22-
# PythonLaunchDescriptionSource(
23-
# os.path.join(robot_config_launch_dir, 'gazebo.launch.py')),
24-
# launch_arguments={ 'use_sim_time': 'true',
25-
# 'world': os.path.join(
26-
# package_path,
27-
# 'worlds',
28-
# 'warehouse.world',
29-
# )
30-
# }.items()
31-
# )
32-
# ld.add_action(gazebo_launch_cmd)
3319

3420
import os
3521

@@ -71,7 +57,7 @@ def generate_launch_description():
7157
os.path.join(ros_gz_sim, 'launch', 'gz_sim.launch.py')
7258
),
7359
launch_arguments={
74-
'gz_args': [world, ' -v 4'],
60+
'gz_args': [world, ' -v 4 -r'],
7561
'on_exit_shutdown': 'true'
7662
}.items(),
7763
)
@@ -85,21 +71,4 @@ def generate_launch_description():
8571
output='screen',
8672
)
8773
ld.add_action(gz_ros_bridge_clock)
88-
89-
# Remove faulty TF Bridge - TF will be handled by robot state publishers
90-
# and static transform publishers instead of trying to bridge from Gazebo
91-
# gz_ros_bridge_tf = Node(
92-
# package='ros_gz_bridge',
93-
# executable='parameter_bridge',
94-
# arguments=[
95-
# '/tf@tf2_msgs/msg/TFMessage[gz.msgs.Pose_V',
96-
# '/tf_static@tf2_msgs/msg/TFMessage[gz.msgs.Pose_V'
97-
# ],
98-
# output='screen',
99-
# )
100-
# ld.add_action(gz_ros_bridge_tf)
101-
102-
# Entity service bridges are intentionally disabled for Harmonic in this launch.
103-
# Primary runtime uses TF-based object/AMR tracking, which is stable and sufficient.
104-
10574
return ld

robotics-ai-suite/components/simulations/PicknPlace/robot_config/launch/nav2_bringup/foxy/bringup_launch.py

Lines changed: 0 additions & 158 deletions
This file was deleted.

robotics-ai-suite/components/simulations/PicknPlace/robot_config/launch/nav2_bringup/foxy/localization_launch.py

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)