roscore error

asked 2016-06-15 21:45:13 -0600

t13smitty gravatar image

updated 2016-06-15 23:30:07 -0600

ahendrix gravatar image

The following errors are coming up when i run my roscore

AttributeError: 'RosPack' object has no attribute 'get_custom_cache'
[master] killing on exit
Unhandled exception in thread started by
sys.excepthook is missing
lost sys.stderr

i believe my export is working correct what could be the issue? The program it is for is attached also.

#!/usr/bin/python
#========================================
#
# EV3 ROS Driver edited by Theodore Cornelius Smith
# Filename: serial_proj.py
#
#========================================
# Import the serial
import serial
# Import the rospy module
import rospy
# Import ROS Msgs
from std_msgs.msg import Int8
from geometry_msgs.msg import Twist
# Import ev3 driver messages
# Might use generic messages, but for now we need the header data
# to determine network integrity
# Dict for EV3 peripherals (sensors + motors)
p = {}
cs_pub = None
def init_ros_publishers():
    global cs_pub
    cs_pub =rospy.Publisher('arlobot/ping',UInt8MultiArray,queue_size=10)
def publish_ping_sensor():
    global cs_pub
    global startMarker, endMarker
    startMarker = '<'
    endMarker = '>'
    ck = ""
    x = "z" # any value that is not an end- or startMarker
    byteCount = -1 # to allow for the fact that the last increment will be one too many
    # wait for the start character
    while  ord(x) != startMarker: 
     x = ser.read()
    # save data until the end marker is found
     while ord(x) != endMarker:
       if ord(x) != startMarker:
         ck = ck + x 
         byteCount += 1
       x = ser.read()
# Add sensors from Guynays code here
    cs_pub.publish(ck.split('_'))
# print.cs_pub
def subscribe_cmd_vel(data):
    global p
    potential_left = (data.linear.x - data.angular.z)* 255
    if potential_left > 255:
        potential_left = 255
    elif potential_left < -255:
        potential_left = -255
    potential_right = (data.linear.x + data.angular.z) * 255
    if potential_right > 255:
        potential_right = 255
    elif potential_right < -255:
        potential_right = -255
    str = '<' + potential_Left + ', ' + potential_Left + '>'
# print.str
    ser.write(str)
def on_shutdown():
    global cs_pub
    cs_pub.unregister()
serPort = "/dev/ttyACM0"
baudRate = 9600
ser = serial.Serial(serPort, baudRate)
print "Serial port " + serPort + " opened  Baudrate " + str(baudRate)
# Main function
def arlo_driver():
    rospy.init_node('arlo_driver',anonymous=False)
    init_ros_publishers()
    s = rospy.Subscriber("arlobot/cmd_vel",Twist,subscribe_cmd_vel,queue_size=10)
    rate = rospy.Rate(100) # 25Hz
    while not rospy.is_shutdown():  
        if s.get_num_connections() == 0:
            publish_ping_sensor()
        rate.sleep()

if __name__ == '__main__':
    try:
            arlo_driver()
    except rospy.ROSInterruptException:
        pass
edit retag flag offensive close merge delete

Comments

Are you running this on an EV3? Might want to update your question with platform, versions of relevant pieces of software, etc, etc. How did you install ROS? Did you build it from source, or did you use a binary distribution?

gvdhoorn gravatar imagegvdhoorn ( 2016-06-16 02:10:01 -0600 )edit