Pubish custom odometry information for robot_localization
hello everyone. I am trying to publish a new custom odomtery information for robot_localization package. I have a sensor which is giving me a position x and y and i want to use that to locate my robot. Since i want to fuse this odomtery information with robot's wheel odometry information, Other things like Twist can be zero as i will use robot's odometry for that purpose.My sensor is recording the positioning information in a .txt file and i will be reading that values to use. How should i modify things to get ting running.
#!/usr/bin/env python
# license removed for brevity
import rospy
import time
from std_msgs.msg import String
from nav_msgs.msg import Odometry
def odom1():
global x
global y
pub = rospy.Publisher('odom1', Odometry, queue_size=10)
rospy.init_node('publisher_turtlebot', anonymous=True)
rate = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
f= open ("x.txt", "r")
x= f.readlines()
f1= open ("y.txt", "r")
y= f1.readlines()
odom1= Odometry()
odom1.header.stamp= rospy.Time.now()
odom1.header.frame_id = "odom"
odom1.pose.pose.position.x= x
odom1.pose.pose.position.y= y
pub.publish(odom1())
rate.sleep()
if __name__ == '__main__':
try:
odom1()
except rospy.ROSInterruptException:
pass``
One file read x and other read y. I am getting this error.
Error: Odometry object is not callable.
What should i do? I am using kinetic kame with ubuntu 16.04 and python.
It sounds like you're trying to integrate a GPS like sensor, those also produce position information but without heading information. Have you looked at the instructions for GPS here?