コード例 #1
0
ファイル: odom_graph.py プロジェクト: mcoteCPR/ROS101
def listener():

	rospy.init_node('odom_graph', anonymous=True)

	rospy.Subscriber("odom", Odometry, odomCB)

	rospy.spin()
コード例 #2
0
    def __init__(self, name) :
       
        rospy.on_shutdown(self._on_node_shutdown)
        self.current_node = "Unknown"
        self.nogo_pre_active = False
        self.nogo_active = False
        self.nogos=[]
        self.stop_services=["/enable_motors", "/emergency_stop", "/task_executor/set_execution_status"]
        self.activate_services=["/enable_motors", "/reset_motorstop", "/task_executor/set_execution_status"]

        #Waiting for Topological Map        
        self._map_received=False
        rospy.Subscriber('/topological_map', TopologicalMap, self.MapCallback)      
        rospy.loginfo("Waiting for Topological map ...")        
        while not self._map_received :
            pass
        rospy.loginfo(" ...done")


        self.update_service_list()
        print self.av_stop_services, self.av_activate_services
        
    
        #Subscribing to Localisation Topics
        rospy.loginfo("Subscribing to Localisation Topics")
        rospy.Subscriber('/current_node', String, self.currentNodeCallback)
        rospy.loginfo(" ...done")

        self.nogos = self.get_no_go_nodes()
        print self.nogos
        self._killall_timers=False
        t = Timer(1.0, self.timer_callback)
        t.start()
        rospy.loginfo("All Done ...")
        rospy.spin()
コード例 #3
0
def main():
    rospy.init_node(NODE_NAME)

    janus_host = required_param('/lg_mirror/janus_stream_host', str)
    janus_port = required_param('~janus_port', int)
    device = rospy.get_param('~device', '/dev/capture_cam')
    width = int(rospy.get_param('~width'))
    height = int(rospy.get_param('~height'))
    framerate = int(rospy.get_param('~framerate'))
    max_quantizer = int(rospy.get_param('~max_quantizer', 60))
    target_bitrate = int(rospy.get_param('~target_bitrate', 768000))
    flip = rospy.get_param('~flip', False) in ['true', 'True', 't', 'yes', 'flipped', True]

    capture = CaptureWebcam(
        janus_host,
        janus_port,
        device,
        width,
        height,
        framerate,
        max_quantizer,
        target_bitrate,
        flip,
    )

    capture.start_capture()

    rospy.spin()
コード例 #4
0
ファイル: ui_detect_sm.py プロジェクト: Mazet/srs_public
def main():
    rospy.init_node('sm_detect')

    sm0 = StateMachine(outcomes=['succeeded','not successful'])
    
    sm0.userdata.action=''
    sm0.userdata.pose=Pose()
    
    with sm0:
        smach.StateMachine.add('UI_detection', UI_detection(),
                                      transitions={'outcome1':'Answer'})
        smach.StateMachine.add('Answer', Answer(), 
                               transitions={'success':'succeeded','retry':'not successful'})
                     

    # Attach a SMACH introspection server
    sis = IntrospectionServer('smach_usecase_01', sm0, '/USE_CASE')
    sis.start()

    # Set preempt handler
    #smach.set_preempt_handler(sm0)

    # Execute SMACH tree in a separate thread so that we can ctrl-c the script
    smach_thread = threading.Thread(target = sm0.execute)
    smach_thread.start()

    # Signal handler
    rospy.spin()
コード例 #5
0
def setHeadingServer():
	#Initialise node
	rospy.init_node('set_heading_service')
	
	s = rospy.Service('set_heading_value', command_val, setHeadingValueHandler)
	print "Ready to set throttle value"
	rospy.spin() 
コード例 #6
0
    def __init__(self):
        # Set parameters
        self.flag = 1
        self.gap = .7   #space needed to pass through
        self.agent_id = 1   #Number for Robot $$change
        self.stage = 0      #initial target
        self.substage = 0   #initial task 0 = drive to objective

        self.topicConfig() #configure simulation namspaces or actual huskies

        self.connection = gpsLocalization(self.namespace, self.gpsTopic, self.imuTopic, self.xOffset, self.yOffset) #Connection which will give current position
        self.path_planner = GapFinder(self.gap) #Finds gaps that the robot can enter
        self.actuation = ROS2DimActuate(self.controlTopic)   #Controls the motion of the robot
        #Create a tracker which knows how to move the robot and get it's position
        self.tracker = PlanarTracker(self.actuation.actuate, self.connection.getStates)
        #Tell the tracker which robot to command
        self.tracker.setID(self.agent_id)

        #Countdown to start
        sleep_time = 3
        while sleep_time > 0:
            print "Mission starts in:", sleep_time
            sleep_time -= 1
            sleep(1)
        self.distance = []
        self.prev_closest_reading = 0.0
        self.prev_time = time()
        self.crash_avert_velocity = 0.0

        print 'Starting the Navigation'
        self.subscriber = rospy.Subscriber(self.lidarTopic, LaserScan, self.move, queue_size=1) #Call move for each laser scan


        rospy.spin()
コード例 #7
0
ファイル: pose2odom.py プロジェクト: raucha/raucha_utils
def main():
    rospy.init_node('pose2odom')

    # global cov_thresh
    # cov_thresh = rospy.get_param("~cov_thresh", 10**2)
    rospy.Subscriber("ndt_pose", PoseStamped, callback)
    rospy.spin()
コード例 #8
0
 def __init__(self):
     rospy.Subscriber("/speech_text", String, self.callback)
     rospy.init_node('simple_chart_parser_node', anonymous=True)
     self.path = os.path.join(rospy.get_param("/simple_chart_parser/grammar_path"), "grammars", rospy.get_param("/simple_chart_parser/grammar_name"))
     self.grammar = nltk.data.load('file:%s'%self.path)
     self.parser = nltk.ChartParser(self.grammar)
     rospy.spin()
コード例 #9
0
def listener_node():
	rospy.init_node('listener_node', anonymous=True)

	rospy.Subscriber("move_base/status", GoalStatusArray, move_base_callback)
	rospy.Subscriber("controller_cmd_vel", Twist, cmd_vel_callback)	

	rospy.spin() 
コード例 #10
0
ファイル: state_ai.py プロジェクト: clubcapra/Ibex
    def __init__(self, name, log_level=rospy.INFO, start=True):
        rospy.init_node(name, log_level=log_level)

        self.clear_octomap_service = rospy.ServiceProxy('/octomap_server/clear_bbx', BoundingBoxQuery)
        self.reset_octomap_service = rospy.ServiceProxy('/octomap_server/reset', Empty)
        is_sim = rospy.get_param("~is_simulation", False)
        self.is_ready = True
        rospy.wait_for_service('/obstacle_generator')
        rospy.wait_for_service('/goal_manager/add_goal', 5)
        rospy.wait_for_service('/move_base/make_plan', 5)
        if not is_sim:
            rospy.wait_for_message('/odometry/filtered', Odometry, timeout=None)
        rospy.sleep(0.02)
        self.generate_obstacle_service = rospy.ServiceProxy('/obstacle_generator', GenerateObstacle)
        self.send_goal_service = rospy.ServiceProxy('/goal_manager/add_goal', AddGoal)
        rospy.Subscriber("/goal_manager/current", GoalWithPriority, self.goal_callback)
        rospy.Subscriber("/goal_manager/last_goal_reached", Bool, self.last_goal_callback)

        self.tf_listener = tf.TransformListener()


        self.goal_count = 0

        self.tf_listener.waitForTransform("/odom", "/base_footprint", rospy.Time(), rospy.Duration(6.0))
        self.is_ready = True
        self.save_start_pos()
        rospy.loginfo("StateAi {} started.".format(name))

        if start:
            self.on_start()
            rospy.spin()
コード例 #11
0
def main():
    rospy.init_node('sm_gesture_recognition_test')

    sm = smach.StateMachine(outcomes=[succeeded, preempted, aborted])

    with sm:

        intro_text = "Lets see if I can detects some gestures."
        smach.StateMachine.add('TTS_START',
                               SpeakActionState(intro_text),
                               transitions={succeeded: 'PAUSE_STATEMACHINE'})

        smach.StateMachine.add('PAUSE_STATEMACHINE',
                               StopTillPressEnterAndReadKeyBoard(intro_text=GETURE_RECOG_TXT, debugging=DEBUGGING),
                               transitions={succeeded: 'GESTURE_RECOGNITION',
                                            preempted: preempted,
                                            aborted: 'TTS_END'},
                               remapping={'keyboard_input_out': 'keyboard_input'})

        smach.StateMachine.add('GESTURE_RECOGNITION',
                               GestureRecognition(GESTURE_LOOKING_FOR),
                               transitions={succeeded: 'PAUSE_STATEMACHINE', preempted: preempted, aborted: aborted},
                               remapping={'gesture_id_out': 'geture_detected'})

        intro_text = "Finished recognizing, have a pleasant day."
        smach.StateMachine.add('TTS_END',
                               SpeakActionState(intro_text),
                               transitions={succeeded: succeeded})

    sm.execute()

    rospy.spin()
コード例 #12
0
def main():
	rospy.init_node('exploration')

	# CONFIG
	# robot
	x, y = rospy.get_param('~start_position', [2.5, 2.5])
	z = rospy.get_param('~flight_height', 1.199)
	simulation.configure('start_position', [x, y, z])
	rot = rospy.get_param('~start_orientation', 0.)
	simulation.configure('start_rotation', rot)
	# world
	w, h = rospy.get_param('~world_size', [10., 10.])
	simulation.configure('world_width', w)
	simulation.configure('world_height', h)
	vsize = rospy.get_param('~voxel_size', .1)
	simulation.configure('voxel_size', vsize)

	# spawn simulation thread
	rospy.loginfo('starting computation of exploration path')
	SimWorker().start()
	# register service
	rospy.loginfo('registering waypoint service')
	s = rospy.Service('get_waypoint', GetWaypoint, handle_get_waypoint)
	# don't leave
	rospy.spin()
コード例 #13
0
ファイル: joystick.py プロジェクト: c0r3d3v/p3dx_joystick
def service():
	global velPub, tiltPub
	velPub = rospy.Publisher('/RosAria/cmd_vel', Twist, queue_size = 1)
	tiltPub = rospy.Publisher('/tilt_angle', Float64, queue_size = 1)
	sub = rospy.Subscriber('/joy', Joy, joystickCallback, queue_size = 10)
	rospy.init_node('p3dx_joystick')
	rospy.spin()
コード例 #14
0
ファイル: ui_bbmove.py プロジェクト: ankitasikdar/srs_public
def asisted_BBmove_server():
    rospy.init_node('asisted_BBmove_server')
    s = rospy.Service('assisted_BBmove', BBMove, moveBBSrv)


    rospy.loginfo("Assisted BBmove ready.")
    rospy.spin()
コード例 #15
0
ファイル: fast_template.py プロジェクト: AVP-UMN/rbx1
def main(args):
      FMT = FastMatchTemplate("fast_match_template")
      try:
        rospy.spin()
      except KeyboardInterrupt:
        print "Shutting down fast match template node."
        cv.DestroyAllWindows()
def main():
	rospy.init_node('hri_node', anonymous=True)
	rate = rospy.Rate(10) # 10hz
	
	left = baxter_interface.Gripper('left', CHECK_VERSION)
	right = baxter_interface.Gripper('right', CHECK_VERSION)
	
	while not rospy.is_shutdown():
		
		os.system("rosrun baxter_examples joint_trajectory_file_playback_modified.py -f /home/roberto/catkin_ws/src/articulated_object_manipulation/actions/right_reach_center.rec")
		
		right.close([])
		
		os.system("rosrun baxter_examples joint_trajectory_file_playback_modified.py -f /home/roberto/catkin_ws/src/articulated_object_manipulation/actions/left_reach_left_flat.rec")
		
		os.system("rosrun baxter_examples joint_trajectory_file_playback_modified.py -f /home/roberto/catkin_ws/src/articulated_object_manipulation/actions/left_pushrotate_left_flat_up.rec")
		
		os.system("rosrun baxter_examples joint_trajectory_file_playback_modified.py -f /home/roberto/catkin_ws/src/articulated_object_manipulation/actions/left_leave_left_up.rec")
		
		right.open([])
		
		os.system("rosrun baxter_examples joint_trajectory_file_playback_modified.py -f /home/roberto/catkin_ws/src/articulated_object_manipulation/actions/right_leave_center.rec")

		return;
		rospy.spin()
コード例 #17
0
def subs():
	global grid_pub
	rospy.init_node('printer')
	rospy.Subscriber('/map_metadata',MapMetaData,set_orig)
	rospy.Subscriber('/slam_out_pose',PoseStamped,update_pose)
	grid_pub = rospy.Publisher('gridout',Pose,queue_size=10)
	rospy.spin()
コード例 #18
0
def main():
    print "nodetest.py running..."

    rospy.init_node('imageproc_node')
    rospy.Subscriber('cmd_vel',
                     geometry_msgs.msg.Twist,
                     handle_command)

    global invertLeft, invertRight, minThrottle, maxThrottle, linearGain, angularGain
    device = rospy.get_param('~device', '/dev/ttyUSB0')
    invertLeft = rospy.get_param('~invertLeft', False)
    invertRight = rospy.get_param('~invertRight', False)
    minThrottle = rospy.get_param('~minThrottle', -500)
    maxThrottle = rospy.get_param('~maxThrottle', 500)
    linearGain = rospy.get_param('~linearGain', 2400)
    angularGain = rospy.get_param('~angularGain', 2400)

    print "invertLeft=" + str(invertLeft)
    print "invertRight=" + str(invertRight)
    print "minThrottle=" + str(minThrottle)
    print "maxThrottle=" + str(invertLeft)
    print "linearGain=" + str(linearGain)
    print "angularGain=" + str(angularGain)

    print "device=" + str(device)

    global robot
    ipu = ImageprocUARTStream(port=device)
    robot = UARTRobotStream(ipu)

    rospy.spin()
コード例 #19
0
def main(args):
    voice_analyzer()
    rospy.init_node('voice_analyzer', anonymous=True)
    try:
        rospy.spin()
    except KeyboardInterrupt:
        print "Shutting down"
コード例 #20
0
ファイル: motorControl.py プロジェクト: 00000111/beaglecar
def listener():
    rospy.init_node('listener', anonymous=True)
    rospy.Subscriber("turn_rate", Float32, callback)
    rospy.spin()
    print ("test")
    PWM.stop(pwm_pin)
    PWM.cleanup()
コード例 #21
0
ファイル: sonarFilter_old.py プロジェクト: quarbby/OpenCV
def main():
    rospy.init_node("sonarFilter", anonymous=False)
    filterChain = SonarFilter()
    try:
        rospy.spin()
    except rospy.ROSInterruptException:
        rospy.logerr("sonarFilter interrupted")
コード例 #22
0
def main():
    
    rospy.init_node('SECON_SPI', anonymous=True)
    rospy.Subscriber("geometry_msgs/command_velocity", Twist, navigation)
    rospy.Subscriber("std_msgs/Byte", Byte, button)
  
    rospy.spin()
コード例 #23
0
def main():
    rospy.init_node('follow_me_3rd_test')

    sm = smach.StateMachine(outcomes=['succeeded', 'aborted','preempted'])
    with sm:
        sm.userdata.standard_error='OK'
        # it prepare the name and the function for drope
        smach.StateMachine.add(
            'prepare_msg',
            prepare_msg(),
            transitions={'succeeded':'follow_me3rd_test','aborted' : 'aborted','preempted':'preempted'})
        # it call the drop_face state
        smach.StateMachine.add(
            'follow_me3rd_test',
            follow_me_3rd(),
            transitions={'succeeded':'succeeded','aborted' : 'follow_me_info','preempted':'preempted'})
        smach.StateMachine.add(
            'follow_me_info',
            follow_me_3rd_error(),
            transitions={'succeeded': 'succeeded', 'aborted':'aborted'})

    # This is for the smach_viewer so we can see what is happening, rosrun smach_viewer smach_viewer.py it's cool!
    sis = smach_ros.IntrospectionServer(
        'follow_me_3rd_introspection', sm, '/FM3_ROOT')
    sis.start()

    sm.execute()

    rospy.spin()
    sis.stop()
コード例 #24
0
def main():
    # Parse arguments
    parser = argparse.ArgumentParser(description="Delete frames being broadcast by a multi_static_transform_publisher")
    parser.add_argument(
        "--node-name",
        metavar=("node_name"),
        default=["multi_tf_pub"],
        type=str,
        nargs=1,
        help="The name of the multi publisher that should publish this transform. Default is 'multi_tf_pub'",
    )
    parser.add_argument(
        "frame_ids", metavar=("frame_id"), type=str, nargs="+", help="The frame_ids of each frame to stop broadcasting."
    )

    myargv = rospy.myargv(argv=sys.argv)
    args = parser.parse_args(args=myargv[1:])

    rospy.init_node("multi_static")

    topic_name = args.node_name[0] + "/del_frame"

    # Publish the transform
    pub = rospy.Publisher(topic_name, std_msgs.String, latch=True)
    for frame_id in args.frame_ids:
        pub.publish(std_msgs.String(frame_id))

    # Wait for sigint
    rospy.spin()
コード例 #25
0
def _test_smach_execute2():
    rospy.init_node('smach')
    
    rospy.on_shutdown(myhook)
    
    sq = Sequence(
        outcomes = ['succeeded','aborted','preempted'],
        connector_outcome = 'succeeded')
    
    with sq:
        Sequence.add('CHECK', CheckSmachEnabledState(),
                     transitions={'aborted':'SLEEP'})
        Sequence.add('SLEEP', SleepState(10))
    
    rospy.loginfo("Executing test...")
    TransformListenerSingleton.get()
    #outcome = sq.execute()
    
    #rospy.loginfo("outcome: %s" % outcome)
       
    # Create and start the introspection server
    sis = smach_ros.IntrospectionServer('server_name', sq, '/SM_ROOT')
    sis.start()
    
    
    # Execute the state machine
    print "EXECUTING.."
    outcome = sq.execute()

    # Wait for ctrl-c to stop the application
    print "SPINNING.ms."
    rospy.spin()
    #rospy.signal_shutdown("shutting down now")
    sis.stop()
コード例 #26
0
def main():
	""" Main entry point
	
	"""
	# It is needed to use a broker to be able to construct NAOQI 
	# modules and subscribe to other modules. The broker must stay
	# alive until  the program exists
	try:
		signal.signal(signal.SIGINT, signal_handler)
		print "[Core agent server] - Press Ctrl + C to exit system correctly"
		
		myBroker = ALBroker("myBroker", "0.0.0.0", 0, Constants.NAO_IP,Constants.PORT)
		global EmailRecognition
		EmailRecognition = EmailRecognitionModule("EmailRecognition")
		rospy.spin()
	
	except AttributeError:
		print "[Core agent server] - AttributeError"
		EmailRecognition.unsubscribe()
		myBroker.shutdown()
		sys.exit(0)
		
	except (KeyboardInterrupt, SystemExit):
		print "[Core agent server] - SystemExit Exception caught"
		EmailRecognition.unsubscribe()
		myBroker.shutdown()
		sys.exit(0)
		
	except Exception, ex:
		print "[Core agent server] - Exception caught %s" % str(ex)
		EmailRecognition.unsubscribe()
		myBroker.shutdown()
		sys.exit(0)
コード例 #27
0
ファイル: robozoo.py プロジェクト: changlongzj/robocup2014
def main():
    rospy.init_node('robozoo')

    sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted'])

    with sm:
   
        smach.StateMachine.add(
            'CheckDepencences',
            CheckDependencesState(),
            transitions={'succeeded': 'RoboZooSM', 'aborted': 'aborted'}) 
   
        smach.StateMachine.add(
            'RoboZooSM',
            RoboZooSM(),
            transitions={'succeeded': 'succeeded', 'aborted': 'aborted'})

    
    # This is for the smach_viewer so we can see what is happening, rosrun smach_viewer smach_viewer.py it's cool!
    sis = smach_ros.IntrospectionServer(
        'robozoo', sm, '/RZ_ROOT')
    sis.start()

    sm.execute()

    rospy.spin()
    sis.stop()
コード例 #28
0
def listener():	
	rospy.Subscriber("/usb_cam/image_raw", Image, callback)
	rospy.init_node("listener", anonymous=True)

	rospy.spin()

	cv2.destroyAllWindows()
コード例 #29
0
def launch_control_operator_node():
    rospy.init_node('dronemap_control_operator', anonymous=True)
    
    # get parameters for the client
    platform_ip_address = rospy.get_param('~cloud_platform_ip_address')
    platform_port_number = rospy.get_param('~cloud_platform_port_number')
    buffer_size = rospy.get_param('~buffer_size')

    # set global parameters for other processes (eg. hearbeat_operator_node)
    rospy.set_param('/cloud_platform_ip_address', platform_ip_address)
    rospy.set_param('/cloud_platform_port_number', platform_port_number)
    rospy.set_param('/buffer_size', buffer_size)
    
    rospy.set_param('/drone_registered', False)
    
    
    # get the formatter
    formatter = create_message_formatter()

    # start the operator
    client = TCPClient("dronemap_control_operator", platform_ip_address, platform_port_number, formatter, buffer_size)
    DronemapControlOperator(client)
    
    # Keep python from exiting until this node is stopped
    rospy.spin()
コード例 #30
0
def main(args):
      cs = CamShiftNode()
      try:
        rospy.spin()
      except KeyboardInterrupt:
        print "Shutting down vision node."
        cv.DestroyAllWindows()
コード例 #31
0
 def run(self):
     while not rospy.is_shutdown():
         rospy.spin()
コード例 #32
0
ファイル: sub_temp.py プロジェクト: iamadamsiwy/rosexplorer
def listener():
     rospy.init_node('listener', anonymous=False)

     rospy.Subscriber("rpiinfo", String, callback)

     rospy.spin()
コード例 #33
0
if __name__ == '__main__':

    rospy.init_node('pixel_to_coordinate_calculator')
    cloud_pub = rospy.Publisher(
        'pointcloud_debug',
        PointCloud,
        queue_size=10
    )
    rate = rospy.Rate(10)
    while not rospy.is_shutdown():

        debug_pointcloud = PointCloud()
        debug_pointcloud.header = std_msgs.msg.Header()
        debug_pointcloud.header.stamp = rospy.Time.now()
        debug_pointcloud.header.frame_id = "laser"

        number_of_pixels = 10
        # create an empty list of correct size
        debug_pointcloud.points = [None] * number_of_pixels

        # fill up pointcloud with points where x value changes but y and z are all 0
        for p in xrange(0, number_of_pixels):
            debug_pointcloud.points[p] = Point(p, 0, 0)

        # now publish the debug pointcloud
        cloud_pub.publish(debug_pointcloud)
        rate.sleep()

    rospy.spin()

コード例 #34
0
 def main(self):
     rospy.spin()
コード例 #35
0
def main():
    rospy.init_node('pc_read')
    rospy.Subscriber("/velodyne_points", PointCloud2, callback)
    rospy.spin()
コード例 #36
0
def main():
    take_photo = TakePhoto()
    rospy.spin()
コード例 #37
0
def main():
    rospy.init_node("auto_nav_position", anonymous=False)
    rate = rospy.Rate(20)
    autoNav = AutoNav()
    autoNav.distance = 4
    last_detection = []
    while not rospy.is_shutdown() and autoNav.activated:
        rospy.loginfo("AutoNav is activated")
        #rospy.loginfo(autoNav.objects_list)
        rospy.loginfo(last_detection)
        if autoNav.objects_list != last_detection:
            rospy.loginfo("Last detection not activated")
            if autoNav.state == -1:
                rospy.loginfo("AutoNav.state == -1")
                while (not rospy.is_shutdown()) and (len(autoNav.objects_list) < 3):
                    autoNav.test.publish(autoNav.state)
                    rospy.loginfo("AutoNav.state in -1")
                    rate.sleep()
                autoNav.state = 0
               # last_detection = autoNav.objects_list

            if autoNav.state == 0:
                rospy.loginfo("AutoNav.state == 0")
                autoNav.test.publish(autoNav.state)
                if len(autoNav.objects_list) >= 3:
                    rospy.loginfo("AutoNav.objects_list) >= 3")
                    autoNav.calculate_distance_to_sub()
                if (len(autoNav.objects_list) >= 3) and (autoNav.distance >= 2):
                    rospy.loginfo("AutoNav.objects_list) >= 3 and (autoNav.distance >= 2)")
                    autoNav.center_point()
                else:
                    rospy.loginfo("No autoNav.objects_list")
                    initTime = rospy.Time.now().secs
                    while ((not rospy.is_shutdown()) and 
                        (len(autoNav.objects_list) < 3 or autoNav.distance < 2)):
                        rospy.loginfo("not rospy.is_shutdown() and  (len(autoNav.objects_list) < 3 or autoNav.distance < 2)")
                        if rospy.Time.now().secs - initTime > 2:
                            rospy.loginfo("rospy.Time.now().secs - initTime > 2")
                            autoNav.state = 1
                            rate.sleep()
                            break
                #last_detection = autoNav.objects_list

        if autoNav.state == 1:
            rospy.loginfo("AutoNav.state == 1")
            autoNav.test.publish(autoNav.state)
            if len(autoNav.objects_list) >= 3:
                autoNav.state = 2
            else:
                initTime = rospy.Time.now().secs
                while ((not rospy.is_shutdown()) and 
                    (len(autoNav.objects_list) < 3)):
                    if rospy.Time.now().secs - initTime > 1:
                        autoNav.farther()
                        rate.sleep()
                        break
            #last_detection = autoNav.objects_list

        if autoNav.objects_list != last_detection:
            rospy.loginfo("autoNav.objects_list != last_detection:")
            if autoNav.state == 2:
                rospy.loginfo("AutoNav.state == 2")
                autoNav.test.publish(autoNav.state)
                if len(autoNav.objects_list) >= 3:
                    autoNav.calculate_distance_to_sub()
                if len(autoNav.objects_list) >= 3 and autoNav.distance >= 2:
                    autoNav.center_point()
                else:
                    initTime = rospy.Time.now().secs
                    while ((not rospy.is_shutdown()) and 
                        (len(autoNav.objects_list) < 3 or autoNav.distance < 2)):
                        if rospy.Time.now().secs - initTime > 2:
                            autoNav.state = 3
                            rate.sleep()
                            break
               # last_detection = autoNav.objects_list

        elif autoNav.state == 3:
            autoNav.test.publish(autoNav.state)
            time.sleep(1)
            autoNav.status_pub.publish(1)

        rate.sleep()
    rospy.spin()
コード例 #38
0
ファイル: person.py プロジェクト: gafb/robotics
def main():

    rospy.init_node('person')

    rospy.Subscriber("/person_detector/detections", Detections2d, callback)
    rospy.spin()
コード例 #39
0
def ping_response_server():
    rospy.init_node('ping_response_server')
    s = rospy.Service('ping_response', PingResponse, handle_ping)
    print("Ready to respond to ping")
    rospy.spin()
コード例 #40
0
def debug_ardu():
    rospy.init_node('serial_node')
    rospy.Subscriber('move_seq', String, callback)
    rospy.spin()
コード例 #41
0
ファイル: end_effector.py プロジェクト: houriyeh/SPARO
def vision_node():
    rospy.init_node("endeffector")
    s = rospy.Service("move_endeffector", MoveEndEffector, handle_move_endeffector)
    rospy.spin()
コード例 #42
0
 def listener(self):
     rospy.Subscriber("/cmd_vel", Twist, self.callback)
     rospy.spin()
コード例 #43
0
ファイル: talker.py プロジェクト: Jtty/theCar
def talker():
    rospy.init_node('serial_talker', anonymous=True)
    em_pub.publish(False)
    rospy.Subscriber("drive_parameters", drive_param, callback)

    rospy.spin()
コード例 #44
0
 def spin(self):
     rospy.spin()
コード例 #45
0
def main():
    rospy.init_node('deep_sort_tracker_node')
    dstn = DeepSortTrackerNode()  # NOQA
    rospy.spin()
コード例 #46
0
def main():
    rospy.Subscriber('/usb_cam/image_raw', Image, callback)
    rospy.spin()
コード例 #47
0
def cb_detector_main(argv=None):
  rospy.init_node(NAME, anonymous=False)
  cb_detector = ImageCbDetectorNode()
  rospy.spin()
コード例 #48
0
def main():

    fg = FollowTheGap()
    rospy.spin()
コード例 #49
0
ファイル: test_d10.py プロジェクト: is0392hr/catkin_ws3
def listener():
    rospy.init_node('d_10')
    follower = Follower()
    rospy.spin()
コード例 #50
0
ファイル: infer.py プロジェクト: WeiChunyu-star/omtb_ml
def main(args):
    rospy.init_node("infer_image_server", anonymous=True)
    infer_server = Infer(args)
    rospy.spin()
コード例 #51
0
ファイル: mp_src01.py プロジェクト: GMDFr/ROS-Basics
        # slows the velocity and rotate agressively
        message = Twist(
            Vector3(0.25, 0, 0),
            Vector3(0, 0, 0.65)
        )
        
    elif min(right) < 2.0 and min(front) < 2.0 :
        message = Twist(
            Vector3(0.35, 0, 0),
            Vector3(0, 0, -0.65)
        )
        
    else :
        # Move forward
        message = Twist(
            Vector3(0.55,0,0),
            Vector3(0,0,0)
        )
        
    pub.publish(message)

# Subscriber node
rospy.init_node('mini_project_01')

# The topic "/cmd_vel" manages messages of "geometry_msgs/Twist" type.
pub = rospy.Publisher('/cmd_vel', Twist, queue_size = 1)
# The node is subscribed to the topic "/kobuki/laser/scan"
sub = rospy.Subscriber('kobuki/laser/scan', LaserScan, robot_control)

rospy.spin()    # Blocks until ROS node is shutdown
コード例 #52
0
 def main(self):
     rospy.Subscriber('//TemperatureCurrent', String, self.callback1)
     rospy.Subscriber('/echoes', MultiEchoLaserScan, self.callback)
     rospy.spin()
コード例 #53
0
def IK_server():
    # initialize node and declare calculate_ik service
    rospy.init_node('IK_server')
    s = rospy.Service('calculate_ik', CalculateIK, handle_calculate_IK)
    print "Ready to receive an IK request"
    rospy.spin()
コード例 #54
0
def main():
    rospy.init_node("trajectory_visualizer")
    TrajectoryVisualizer()
    rospy.spin()
コード例 #55
0
#! /usr/bin/python

import rospy as rp
import geomtwo.msg as gms
import threading as thd
import numpy as np
import circumnavigation_moving_target.srv as dns


delay=rp.get_param('delay')
agent_to_remove=rp.get_param('agent_to_remove')
rp.sleep(delay)
# Call to the service "Remove": the agent requires to the cloud to add his name
rp.wait_for_service('Remove')
remove_proxy=rp.ServiceProxy('Remove', dns.RemoveAgent)
remove_proxy.call(agent_to_remove)


rp.init_node('remove_agent') 
rp.spin()
コード例 #56
0
def Kinematic_server():
    rospy.init_node('Kinematic_server')
    s = rospy.Service('Kinematic', Kinematic, handle_Kinematic)
    print("Kinematic Direct Model")
    rospy.spin()
コード例 #57
0
ファイル: script.py プロジェクト: angellin0704/src
def listener():
	rospy.init_node('midpoint', anonymous=True)
	rospy.Subscriber("/darknet_ros/bounding_boxes", BoundingBoxes, callback)

	rospy.spin()
コード例 #58
0
def main():
    rospy.init_node('ekf', anonymous=True)
    my_ros = ros_odom_sub_pub()
    rospy.spin()
コード例 #59
0
def walk():
    rospy.Subscriber('motor_distance', Int32, callback)
    rospy.spin()
コード例 #60
0
def listener():
	rospy.init_node('listener', anonymous=True)
	rospy.Subscriber("chatter",  String, callback)

	rospy.spin()