Skip to content

Commit 4140e2e

Browse files
author
Emiliano Borghi
committed
Improve move_square script
1 parent ce3655a commit 4140e2e

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

ca_tools/launch/move_square.launch

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<launch>
2+
<!--
3+
Arguments to the move_square.py node:
4+
- "vel [ left | right ]"
5+
- "odom"
6+
- "odom_imu"
7+
-->
8+
<arg name="args"/>
9+
10+
<arg name="robot_id" default="$(optenv ID 1)" doc="Unique identifier of the robot [1-Inf.)"/>
11+
<arg name="ns" value="create$(arg robot_id)" doc="Namespace of the robot. By default: create1"/>
12+
13+
<node pkg="ca_tools" type="move_square.py" name="move_square"
14+
output="screen" ns="$(arg ns)"
15+
args="$(arg args)"/>
16+
</launch>

ca_node/scripts/move_square.py renamed to ca_tools/scripts/move_square.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def __init__(self):
3030

3131
# Declare ROS subscribers and publishers
3232
self.node_name = "square_move"
33-
self.odom_sub_name = "/create1/odom"
34-
self.vel_pub_name = "/create1/cmd_vel"
33+
self.odom_sub_name = "odom"
34+
self.vel_pub_name = "cmd_vel"
3535
self.vel_pub = None
3636
self.odometry_sub = None
3737

@@ -65,8 +65,6 @@ def stop_robot(self):
6565
self.vel_ros_pub(Twist())
6666
time.sleep(self.pub_rate)
6767

68-
sys.exit("The process has been interrupted by the user!")
69-
7068
def move(self):
7169
""" To be surcharged in the inheriting class"""
7270

@@ -243,7 +241,7 @@ def __init__(self):
243241
# The functions are the same as in the previous example except for the odometry name that is now filtered
244242
# in a, Extended Kalman Filter (EKF) with the IMU values thanks to the node robot_pose_ekf
245243
super(SquareMoveOdomIMU, self).__init__()
246-
self.odom_sub_name = "/create1/odom_combined"
244+
self.odom_sub_name = "odom_combined"
247245

248246

249247
if __name__ == '__main__':

0 commit comments

Comments
 (0)