Commit 13b1923a authored by jad's avatar jad

fianl touches

parent e0ad987c
<launch>
<node pkg="drone_project" name="Sequencer" type="Sequencer.py">
</node>
<node pkg="drone_project" name="Main" type="Main.py">
</node>
<node pkg="drone_project" name="optFlow" type="testDenseOpticalFlow.py">
</node>
<node pkg="drone_project" name="curveMotion" type="turn_to_angle.py">
</node>
<node pkg="drone_project" name="turnAng" type="turn_ang.py">
</node>
<node pkg="drone_project" name="resetCmd" type="reset_cmd_node.py">
</node>
<node pkg="drone_project" name="computeTarX" type="compute_tar_x.py">
</node>
<node pkg="drone_project" name="computeTarY" type="compute_tar_y.py">
</node>
<node pkg="drone_project" name="computeTarZ" type="compute_tar_z.py">
</node>
<node pkg="drone_project" name="detectVanish" type="image_proc.py">
</node>
</launch>
\ No newline at end of file
<launch>
<node pkg="drone_project" name="ImageProcessing" type="image_proc.py">
<remap from="/image_in" to="/bebop/image_raw"/>
</node>
<node pkg="drone_project" name="XCommand" type="compute_tar_x.py">
</node>
<node pkg="drone_project" name="YCommand" type="compute_tar_y.py">
</node>
<node pkg="drone_project" name="ZCommand" type="compute_tar_z.py">
</node>
</launch>
\ No newline at end of file
No preview for this file type
......@@ -40,6 +40,7 @@ class Sequencer(object):
def enter_loop(self,ros_data):
if(self.mode == "init"):
self.doors_seq.reset_seq()
self.hallway_seq.reset_seq()
self.reset_seq_func()
pass
if(self.mode == self.doors_seq.get_mode()):
......@@ -57,7 +58,15 @@ class Sequencer(object):
def stairs_seq_func(self):
pass
def hallway_seq_func(self):
pass
if(hallway_seq.get_publ() == False):
self.actv_pub.publish("reset")
self.rate.sleep()
self.actv_pub.publish("detectVanish_1")
self.actv_pub.publish("computeTarX_1")
self.actv_pub.publish("computeTarY_1")
self.actv_pub.publish("computeTarZ_1")
self.rate.sleep()
self.doors_seq.set_published(True)
def doors_seq_func(self):
if(self.doors_seq.get_phase() == 0 ):
if (self.doors_seq.get_publ() == False) :
......
No preview for this file type
......@@ -15,11 +15,11 @@ from activation_class import NodeActivate
class ComputeXTar(NodeActivate):
def __init__(self):
super(ComputeXTar,self).__init__("compute_tar_x")
super(ComputeXTar,self).__init__("computeTarX")
cmd_reset = rospy.Publisher("/reset_cmd_x",Int32,queue_size=1)
self.sync_sub = rospy.Subscriber("/bebop/odom",Odometry,self.sync_cmd)
self.cmd_publisher = rospy.Publisher("/vel_in_x",Float32,queue_size=1)
self.targX = 0.3
self.targX = 0.2
def sync_cmd(self,ros_data):
if(self.node_active == 0):
return
......
......@@ -14,11 +14,11 @@ from activation_class import NodeActivate
class ComputeYTar(NodeActivate):
def __init__(self):
super(ComputeYTar,self).__init__("compute_tar_y")
super(ComputeYTar,self).__init__("computeTarY")
cmd_reset = rospy.Publisher("/reset_cmd_y",Int32,queue_size=1)
self.sDiff_subscriber = rospy.Subscriber("/sDiffs",Float32,self.read_sDiffs)
self.cmd_publisher = rospy.Publisher("/vel_in_y",Float32,queue_size=1)
self.act_publisher = rospy.Publisher("/activation_y",Int32,queue_size=1)
#self.act_publisher = rospy.Publisher("/activation_y",Int32,queue_size=1)
self.targY = 0
#self.act_publisher.publish(0)
def read_sDiffs(self,ros_data):
......@@ -27,7 +27,7 @@ class ComputeYTar(NodeActivate):
#read the centroid and send the data
self.targY = ros_data.data
#The value of the velocity is proportional to the value of the difference of the values
self.targY = self.targY * 0.1
self.targY = self.targY * -0.15
#Set the max of the Target to the
self.targY = GenTools.setMax(self.targY,0.3)
self.cmd_publisher.publish(self.targY)
......
......@@ -14,16 +14,16 @@ from activation_class import NodeActivate
class ComputeZTar(NodeActivate):
def __init__(self):
super(ComputeZTar,self).__init__("compute_tar_z")
super(ComputeZTar,self).__init__("computeTarz")
cmd_reset = rospy.Publisher("/reset_cmd_z",Int32,queue_size=1)
self.dc = DroneCommand(0.007,0,0)
self.centroid_subscriber = rospy.Subscriber("/centroids",Float32,self.read_centroid)
self.cmd_publisher = rospy.Publisher("/vel_in_z",Float32,queue_size=1)
self.act_publisher = rospy.Publisher("/activation_z",Int32,queue_size=1)
#self.act_publisher = rospy.Publisher("/activation_z",Int32,queue_size=1)
self.centroid = 160
self.TargCentroid = 160
self.cmd = 0
self.act_publisher.publish(1)
#self.act_publisher.publish(1)
def read_centroid(self,ros_data):
#read the centroid and send the data
if(self.node_active == 0):
......
......@@ -12,8 +12,8 @@ from std_msgs.msg import Float32
class XCommand(RegulatorClass):
def __init__(self):
super(XCommand,self).__init__(0.7,0.03,0.6)
#super(XCommand,self).__init__(0.8,0.0,0.7)
#super(XCommand,self).__init__(0.7,0.03,0.6)
super(XCommand,self).__init__(0.8,0.0,0.7)
self.deb = rospy.Publisher("/deb_x",Float32,queue_size=1)
def read_val(self,ros_data):
twist = ros_data.twist.twist
......
......@@ -196,8 +196,8 @@ class image_convert(NodeActivate):
def callback(self,ros_data):
#msg = ""
if(self.node_active == 0):
return
#if(self.node_active == 0):
# return
cv2_img = self.br.imgmsg_to_cv2(ros_data)
#np_arr = np.fromstring(ros_data.data, np.uint8)
#image_np = cv2.imdecode(np_arr, cv2.IMREAD_COLOR)
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment