ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The quick and dirty way to do this would be to create a global variable for last odom. You could save thiis variable at the end of every loop. It would look something like this
last_odom = Odometry()
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("/odom", Odometry, simple_callback)
rospy.spin()
def simple_callback(data):
global last_odom
if __name__== '__main__':
listener()
2 | No.2 Revision |
The quick and dirty way to do this would be to create a global variable for last odom. You could save thiis variable at the end of every loop. It would look something like this
last_odom = Odometry()
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("/odom", Odometry, simple_callback)
rospy.spin()
def simple_callback(data):
global last_odom
if __name__== '__main__':
listener()
3 | No.3 Revision |
The quick and dirty way to do this would be to create a global variable for last odom. You could save thiis variable at the end of every loop. It would look something like this
The quick and dirty way to do this would be to create a global variable for last odom. You could save thiis variable at the end of every loop. It would look something like this
last_odom = Odometry()
current_odom = Odometry()
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("/odom", Odometry, simple_callback)
rospy.spin()
def simple_callback(data):
global last_odom
last_odom global current_odom
last_odom = current_odom
current_odom = data
if __name__== '__main__':
listener()
4 | No.4 Revision |
The quick and dirty way to do this would be to create a global variable for last odom. You could save thiis this variable at the end of every loop. It would look something like this
The quick and dirty way to do this would be to create a global variable for last odom. You could save thiis variable at the end of every loop. It would look something like this
last_odom = Odometry()
current_odom = Odometry()
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("/odom", Odometry, simple_callback)
rospy.spin()
def simple_callback(data):
global last_odom
global current_odom
last_odom = current_odom
current_odom = data
if __name__== '__main__':
listener()
5 | No.5 Revision |
The quick and dirty way to do this would be to create a global variable for last and current odom. You could save this variable at the end of every loop. It would look something like this
last_odom = Odometry()
current_odom = Odometry()
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("/odom", Odometry, simple_callback)
rospy.spin()
def simple_callback(data):
global last_odom
global current_odom
last_odom = current_odom
current_odom = data
if __name__== '__main__':
listener()