def __init__( self ): NaoNode.__init__( self ); # Initialize ROS node. rospy.init_node( 'nao_camera' ); self.__videoDeviceProxy = self.getProxy( 'ALVideoDevice' ); # Get options. self.__options = {}; self.__options[ 'resolution' ] = rospy.get_param( '~resolution', vision_definitions.kVGA ); self.__options[ 'colorSpace' ] = rospy.get_param( '~color_space', vision_definitions.kBGRColorSpace ); self.__options[ 'fps' ] = rospy.get_param( '~fps', 15 ); self.__options[ 'camera' ] = rospy.get_param( '~camera', 0 ); self.subscribe(); # Create publishers. self.__imagePublisher = rospy.Publisher( '/nao_camera/image_raw', Image ); self.__cameraInfoPublisher = rospy.Publisher( '/nao_camera/camera_info', CameraInfo ); # Publish images. rate = rospy.Rate( self.__options[ 'fps' ] ); while( not rospy.is_shutdown() ): self.publish(); rate.sleep();
def __init__( self ): NaoNode.__init__( self ); # Initialize ROS node. rospy.init_node( 'nao_speech' ); self.__textToSpeechProxy = self.getProxy( 'ALTextToSpeech' ); # Create subscribers. self.__speechSubscriber = rospy.Subscriber( '/nao_speech', String, self.onSpeechReceived );
def __init__( self, name ): NaoNode.__init__( self ); ALModule.__init__( self, name ); self.name = name; # Initialize ROS node. rospy.init_node( 'nao_landmark_detection' ); self.memoryProxy = self.getProxy( 'ALMemory' ); self.landmarkDetectionProxy = self.getProxy( 'ALLandMarkDetection' ); self.subscribe(); # Create publishers. self.landmarkDetectionPublisher = rospy.Publisher( 'nao_landmark_detection', LandmarkDetection ); # Create messages. self.LandmarkDetectionMessage = LandmarkDetection();
def __init__( self ): NaoNode.__init__( self ); # Initialize ROS node. rospy.init_node( PACKAGE_NAME ); # Create dynamic configure server. self.__configService = dynamic_reconfigure.server.Server( NaoBlobDetectionConfig, self.onConfigReceived ); # Initialize self.initialize(); # Setup OpenCV. self.__cvBridge = CvBridge(); # Create publishers. self.__cameraPublisher = rospy.Publisher( self.__topicCameraPublisher, Image ); # Create subscribers. self.__cameraSubscriber = rospy.Subscriber( self.__topicCameraSubscriber, Image, self.onImageReceived ); self.__blobsSubscriber = rospy.Subscriber( self.__topicBlobsSubscriber, Blobs, self.onBlobsReceived );
def __init__( self, name ): NaoNode.__init__( self ); ALModule.__init__( self, name ); self.name = name; # Initialize ROS node. rospy.init_node( 'nao_sensors' ); self.memoryProxy = self.getProxy( 'ALMemory' ); self.subscribe(); # Create publishers. self.tactileButtonPublisher = rospy.Publisher( 'nao_sensors_tactile_button', TactileButton ); self.bumperButtonPublisher = rospy.Publisher( 'nao_sensors_bumper_button', BumperButton ); self.chestButtonPublisher = rospy.Publisher( 'nao_sensors_chest_button', ChestButton ); # Create messages. self.TactileButtonMessage = TactileButton(); self.BumperButtonMessage = BumperButton(); self.ChestButtonMessage = ChestButton();
def __init__(self): NaoNode.__init__(self) rospy.init_node("nao_experiment") # Connect to the server. self.__actionClient = actionlib.SimpleActionClient("joint_trajectory", JointTrajectoryAction) if not self.__actionClient.wait_for_server(rospy.Duration(10)): rospy.logerr('Unable to establish a connection to the "joint_trajectory" server.') sys.exit(1) # Subscribe to the blob detection. """ self.setStiffness( [ 'HeadYaw', 'HeadPitch', 'RShoulderPitch', 'RShoulderRoll', 'RElbowYaw', 'RElbowRoll', 'RWristYaw', 'RHand', 'LShoulderPitch', 'LShoulderRoll', 'LElbowYaw', 'LElbowRoll', 'LWristYaw', 'LHand' ], [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); self.setPose( 'headAndArmsInitial' ); self.laneOne(); rospy.sleep( 2 ); self.setPose( 'headAndArmsInitial' ); self.laneTwo(); rospy.sleep( 2 ); self.setPose( 'headAndArmsInitial' ); self.laneThree(); rospy.sleep( 2 ); self.setPose( 'headAndArmsInitial' ); self.laneFour(); rospy.sleep( 2 ); self.setPose( 'headAndArmsInitial' ); self.laneFive(); rospy.sleep( 2 ); self.setPose( 'headAndArmsInitial' ); self.setStiffness( [ 'HeadYaw', 'HeadPitch', 'RShoulderPitch', 'RShoulderRoll', 'RElbowYaw', 'RElbowRoll', 'RWristYaw', 'RHand', 'LShoulderPitch', 'LShoulderRoll', 'LElbowYaw', 'LElbowRoll', 'LWristYaw', 'LHand' ], [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); """ # Sit down. # self.enableBodyStiffness(); # self.setPose( 'sit' ); # self.disableBodyStiffness(); # print( self.getProxy( 'ALMotion' ).getSummary() ); # Read in bins. path = os.path.join(roslib.packages.get_pkg_dir(PACKAGE_NAME), "cfg") fileName = os.path.join(path, "config.yaml") file = open(fileName, "r") data = yaml.load(file) print("File name: {fileName}".format(fileName=fileName)) print(data)