publishing to /cmd_vel gives error
hey everyone,
i am trying to let my jackal drive with this custom node :
#! /usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan
def callback(msg):
seconds = rospy.get_time()
if int(seconds) % 3 == 0:
move.linear.x = 0
move.linear.y = 1
move.angular.z = 0
elif int(seconds+1) % 3 == 0:
move.linear.x = 0
move.angular.z = -0
else:
move.linear.x = -2
move.angular.z = -2
pub.publish(move)
rospy.init_node('sub_node')
sub = rospy.Subscriber('/kobuki/laser/scan', LaserScan, callback)
pub = rospy.Publisher('/cmd_vel',Twist,queue_size=10)
move = Twist()
rospy.spin()
however it returns the error : /clock not being published
etc. you probably know the error.
but /clock definetely is running, and my jackal isnt moving. rostopic info /cmd_vel does state its subscribing the node i want. maybe its worth it to state that this script DOES work with the turtlebot in gazebo.
greetings girpon
Rather strangely you code will only publish a cmd_vel message when it receives a LaserScan message. So my first though is that there are no LaserScan messages being published and therefore no cmd_vel Twist messages.
I second @PeteBlackerThe3rd about no laser data being published, it probably works with the turtlebot because you subscribe to the topic
/kobuki/something
,kobuki
being the mobile base of the turtlebot but not related to the jackal robot.