roswtf: node subscriptions arenot connected (same machine) [closed]

asked 2018-07-29 05:26:49 -0600

RoboRos gravatar image

updated 2018-07-29 10:25:15 -0600

Hello,

i am getting the following error by running roswtf and i am stuck with that for a 3 weeks:

WARNING The following node subscriptions are unconnected:
 * /speed_controller:
   * /odom
 * /soundplay_node:
   * /sound_play/goal
   * /sound_play/cancel
   * /robotsound
 * /gazebo:
   * /gazebo/set_model_state
   * /gazebo/set_link_state

I have searched answers and this usually happens running it on different machines. However, i am trying to run it in the gazebo simulation. rosmaster has the same uri anywayz.

I have written the publisher and subscriber and named it as speed_controller.py. " python speed_controller.py" is the command to run the node. Code is from: http://www.theconstructsim.com/ros-qa... :

 #! /usr/bin/env python

import rospy
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion
from geometry_msgs.msg import Point, Twist
from math import atan2


x = 0.0
y = 0.0
theta = 0.0

def newOdom (msg):
    global x
    global y
    global theta

    x = msg.pose.pose.position.x
    y = msg.pose.pose.position.y

    rot_q = msg.pose.pose.orientation
    (roll, pitch, theta) = euler_from_quaternion([rot_q.x, rot_q.y, rot_q.z, rot_q.w])

rospy.init_node("speed_controller")



sub = rospy.Subscriber ("/odom", Odometry, newOdom)
pub = rospy.Publisher("/cmd_vel", Twist, queue_size = 1)

speed = Twist ()

r = rospy.Rate(4)

goal = point()

goal.x = 5
goal.y = 5


while not rospy.is_shutdown():
    inc_x = goal.x - x
    inc_y = goal.y - y

    angle_to_goal = atan2(inc_y, inc_x)

    if abs(angle_to_goal > 0.1):
        speed.linear.x = 0.0
        speed.angular.z = 0.3

    else:
        speed.linear.x = 0.0
        speed.angular.z = 0.5

pub.publish(speed)
r.sleep()

Most important part is to connect odom and speed_controller because i am not able to move my robot. It was working just fine before.

Thanks in advance.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by RoboRos
close date 2018-09-11 03:33:01.824294

Comments

What happens if you do rostopic info on the topics in question? Then do rosnode info on the nodes you expect to be connected?

Tom Moore gravatar imageTom Moore ( 2018-07-30 04:22:42 -0600 )edit

reinstallation of ros solve the problem.

RoboRos gravatar imageRoboRos ( 2018-09-11 03:32:49 -0600 )edit