Пример #1
0
class AVRControl:
	def __init__(self):
		self.ns_global_prefix = "/odroidx_interface"

		if not rospy.has_param(self.ns_global_prefix + "/polling_interval"):
			self.polling_interval = 1
		else:
			self.polling_interval = rospy.get_param(self.ns_global_prefix + "/polling_interval")

		if not rospy.has_param(self.ns_global_prefix + "/analog_channels"):
			self.analog_ch = []
		else:
			self.analog_ch = map(int, str(rospy.get_param(self.ns_global_prefix + "/analog_channels")).split(","))

		self._connect()

		self.old_values = [-1]*14
		self.old_values[0] = 0	#prevent of motor stop
		self.old_values[1] = 0

		self.pub_marker = rospy.Publisher("state", ChannelFloat32)
		rospy.Subscriber("command", ChannelFloat32, self.setCallback, queue_size=1)

		s1 = rospy.Service('mot0', MotorAim, self.cb_mot0)
		s2 = rospy.Service('pullup', MotorAim, self.cb_pullup)

	def _connect(self):
		while True:
			try:
				self.intf = AVRInterface()
				self.intf.setup()
				break
			except Exception, e:
				print "AVR Error:", e
				rospy.sleep(1)
Пример #2
0
 def _connect(self):
     while True:
         try:
             self.intf = AVRInterface()
             self.intf.setup()
             break
         except Exception, e:
             print "AVR Error:", e
             rospy.sleep(1)
Пример #3
0
	def _connect(self):
		while True:
			try:
				self.intf = AVRInterface()
				self.intf.setup()
				break
			except Exception, e:
				print "AVR Error:", e
				rospy.sleep(1)
Пример #4
0
class AVRControl:
    def __init__(self):
        self.ns_global_prefix = "/odroidx_interface"

        if not rospy.has_param(self.ns_global_prefix + "/polling_interval"):
            self.polling_interval = 1
        else:
            self.polling_interval = rospy.get_param(self.ns_global_prefix +
                                                    "/polling_interval")

        if not rospy.has_param(self.ns_global_prefix + "/analog_channels"):
            self.analog_ch = []
        else:
            self.analog_ch = map(
                int,
                str(rospy.get_param(self.ns_global_prefix +
                                    "/analog_channels")).split(","))

        self._connect()

        self.old_values = [-1] * 14
        self.old_values[0] = 0  #prevent of motor stop
        self.old_values[1] = 0

        self.pub_marker = rospy.Publisher("state", ChannelFloat32)
        rospy.Subscriber("command",
                         ChannelFloat32,
                         self.setCallback,
                         queue_size=1)

        s1 = rospy.Service('mot0', MotorAim, self.cb_mot0)
        s2 = rospy.Service('pullup', MotorAim, self.cb_pullup)

    def _connect(self):
        while True:
            try:
                self.intf = AVRInterface()
                self.intf.setup()
                break
            except Exception, e:
                print "AVR Error:", e
                rospy.sleep(1)
Пример #5
0
#!/usr/bin/python
import roslib; 
roslib.load_manifest('ipa_odroidx_interface')
import rospy
import sys

from avr_interface import AVRInterface

intf = AVRInterface()
intf.setup()

print "Inputs are ", intf.get_input()
for i in range(0,4):
	print "Analog ch. ",i," is ", intf.get_analog(i)

intf.set_output(0,0)
intf.set_output(1,0)
intf.set_output(4,0)

intf.set_output(0, 55)
intf.set_pulse(0, 1)

intf.set_motoraim0(int(sys.argv[1]))
exit()

cnt=0
d=1
while False: #True:
	#print "Inputs are ", intf.get_input()
	intf.set_output(0,cnt)
	cnt+=d