Running my launch file for Exercise 4.2, but the odom_subscriber launch fille just immediately ends after running
odom_sub_node (my_examples_pkg/odom_subscriber.py)
process[odom_sub_node-1]: started with pid [25381]
[odom_sub_node-1] process has finished cleanly
log file: /home/user/.ros/log/f875e7de-f97f-11eb-8b29-0242c0a83007/odom_sub_node-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor…
… shutting down processing monitor complete
done
move_robot.launch
< launch >
< !-- My Package launch file – >
< node pkg=“my_examples_pkg” type=“move_robot.py” name=“MoveRobot” output=“screen”>
< /node >
< /launch >
odom_subscriber.launch
< launch >
< !-- My Package launch file – >
< node pkg=“my_examples_pkg” type=“odom_subscriber.py” name=“odom_sub_node” output=“screen” >
< /node >
< /launch >
move_robot.py
rospy.init_node(‘move_robot_node’)
pub = rospy.Publisher(‘/cmd_vel’, Twist, queue_size=1)
rate = rospy.Rate(2)
var = Twist()
seed(1)
factorX = 0.5
factorZ = 0.5while not rospy.is_shutdown():
for _ in range(10):
valueX = random()
valueZ = random()
var.linear.x = valueX-factorX
var.angular.z = valueZ-factorZ
print("x: ", var.linear.x)
print("z: ", var.angular.z)
pub.publish(var)
rate.sleep() # Make sure the publish rate maintains at frequency
Not sure what is wrong. I am running another concurrent launch file move_robot that is automatically moving the robot around to generate odometry so I can get live odom data in this exercise.