Python std_msgs.msg.Bool() Examples
The following are 30
code examples of std_msgs.msg.Bool().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
std_msgs.msg
, or try the search function
.
Example #1
Source File: movo_jtas.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _home_arm_planner(self): if self._prefix == 'left': rospy.sleep(5) else: move_group_jtas = MoveGroupInterface("upper_body", "base_link") move_group_jtas.setPlannerId("RRTConnectkConfigDefault") success = False while not rospy.is_shutdown() and not success: result = move_group_jtas.moveToJointPosition(self._body_joints, self._homed, 0.05) if result.error_code.val == MoveItErrorCodes.SUCCESS: rospy.logerr("_home_arm_planner completed ") success = True else: rospy.logerr("_home_arm_planner: _home_arm_planner failed (%d)" % result.error_code.val) self._arms_homing = True self._ctl.api.MoveHome() self._ctl.api.InitFingers() self.home_arm_pub.publish(Bool(True)) rospy.sleep(2.0) self._arms_homing = False self._planner_homing = False
Example #2
Source File: movo_system_wd.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self,pc_name): """ Initialize the UDP connection """ self._remote_shutdown_msg = Bool() self._remote_shutdown_msg.data = True if (pc_name == 'movo1'): self.remote_sub = rospy.Subscriber('movo1/shutdown_pc',Bool,self._shutdown_cb) self.remote_pub = rospy.Publisher('movo2/shutdown_pc',Bool,queue_size=1,latch=True) else: self.remote_sub = rospy.Subscriber('movo2/shutdown_pc',Bool,self._shutdown_cb) self.remote_pub = rospy.Publisher('movo1/shutdown_pc',Bool,queue_size=1,latch=True) self._continue = True self.conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.conn.setblocking(False) self.conn.bind(('',6234))
Example #3
Source File: publisher_bool_state.py From flexbe_behavior_engine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def on_enter(self, userdata): val = Bool() val.data = userdata.value self._pub.publish(self._topic, val)
Example #4
Source File: Dronet.py From rpg_public_dronet with MIT License | 5 votes |
def __init__(self, json_model_path, weights_path, target_size=(200, 200), crop_size=(150, 150), imgs_rootpath="../models"): self.pub = rospy.Publisher("cnn_predictions", CNN_out, queue_size=5) self.feedthrough_sub = rospy.Subscriber("state_change", Bool, self.callback_feedthrough, queue_size=1) self.land_sub = rospy.Subscriber("land", Empty, self.callback_land, queue_size=1) self.use_network_out = False self.imgs_rootpath = imgs_rootpath # Set keras utils K.set_learning_phase(TEST_PHASE) # Load json and create model model = utils.jsonToModel(json_model_path) # Load weights model.load_weights(weights_path) print("Loaded model from {}".format(weights_path)) model.compile(loss='mse', optimizer='sgd') self.model = model self.target_size = target_size self.crop_size = crop_size
Example #5
Source File: omnirobot_server.py From robotics-rl-srl with MIT License | 5 votes |
def stop(self): """ Publish the stop signal to robot """ msg = Bool() msg.data = True self.stop_signal_pub.publish(msg) self.move_finished = True
Example #6
Source File: omnirobot_server.py From robotics-rl-srl with MIT License | 5 votes |
def disableVelocityController(self): """ Disable the velocity controller, this server send the wheel_speed_command instead """ msg = Bool(False) self.switch_velocity_controller_pub.publish(msg) self.enabled_velocity_controller = False
Example #7
Source File: omnirobot_server.py From robotics-rl-srl with MIT License | 5 votes |
def enableVelocityController(self): """ enable the velocity controller """ msg = Bool(True) self.switch_velocity_controller_pub.publish(msg) self.enabled_velocity_controller = True
Example #8
Source File: omnirobot_server.py From robotics-rl-srl with MIT License | 5 votes |
def enablePosController(self): """ enable the pos controller """ msg = Bool(True) self.switch_pos_controller_pub.publish(msg) self.enabled_pos_controller = True
Example #9
Source File: motionplanner.py From omg-tools with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self): self._mp_result_topic = rospy.Publisher('mp_result', FleetTrajectories, queue_size=1) self._mp_feedback_topic = rospy.Publisher('mp_feedback', Bool, queue_size=1) rospy.Subscriber('mp_trigger', Trigger, self.update) rospy.Subscriber('mp_configure', Settings, self.configure)
Example #10
Source File: controller.py From omg-tools with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, sample_time, update_time, n_robots, obst_traj=[]): rospy.init_node('p3dx_controller') self._sample_time = sample_time self._update_time = update_time self._mp_status = False self._n_robots = n_robots self._obst_traj = obst_traj self._robobst = list(obst_traj.keys()) self._robot_est_pose = [[0., 0., 0.] for k in range(n_robots)] self._robot_real_pose = [[0., 0., 0.] for k in range(n_robots)] self._robobst_est_pose = [[0., 0.] for k in range(len(self._robobst))] self._robobst_est_velocity = [[0., 0.] for k in range(len(self._robobst))] self._vel_traj = [{'v': [], 'w': []} for k in range(n_robots)] self._vel_traj_applied = [{'v': [], 'w': []} for k in range(n_robots)] self._cmd_vel_topic = [rospy.Publisher('robot'+str(k)+'/p3dx/cmd_vel', Twist, queue_size=1) for k in range(n_robots)] self._cmd_vel_robobst_topic = [rospy.Publisher('robobst'+str(l)+'/p3dx/cmd_vel', Twist, queue_size=1) for l in range(len(self._robobst))] self._mp_trigger_topic = rospy.Publisher('mp_trigger', Trigger, queue_size=1) self._mp_configure_topic = rospy.Publisher('mp_configure', Settings, queue_size=1) rospy.Subscriber('mp_result', FleetTrajectories, self.get_mp_result) rospy.Subscriber('mp_feedback', Bool, self.get_mp_feedback) # for k in range(n_robots): # rospy.Subscriber('robot'+str(k)+'/p3dx/base_pose_ground_truth', Odometry, callback=self.get_est_pose, callback_args=k) rospy.Subscriber('/gazebo/model_states', ModelStates, callback=self.get_model_states) # for l in range(len(self._robobst)): # rospy.Subscriber('robobst'+str(l)+'/p3dx/base_pose_ground_truth', Odometry, callback=self.get_est_pose_robobst, callback_args=l)
Example #11
Source File: gamepad_marshall_node.py From tello_driver with Apache License 2.0 | 5 votes |
def __init__(self): # Define parameters self.joy_state_prev = GamepadState() # if None then not in agent mode, otherwise contains time of latest enable/ping self.agent_mode_t = None self.flip_dir = 0 # Start ROS node rospy.init_node('gamepad_marshall_node') # Load parameters self.agent_mode_timeout_sec = rospy.get_param( '~agent_mode_timeout_sec', 1.0) self.pub_takeoff = rospy.Publisher( 'takeoff', Empty, queue_size=1, latch=False) self.pub_throw_takeoff = rospy.Publisher( 'throw_takeoff', Empty, queue_size=1, latch=False) self.pub_land = rospy.Publisher( 'land', Empty, queue_size=1, latch=False) self.pub_palm_land = rospy.Publisher( 'palm_land', Empty, queue_size=1, latch=False) self.pub_reset = rospy.Publisher( 'reset', Empty, queue_size=1, latch=False) self.pub_flattrim = rospy.Publisher( 'flattrim', Empty, queue_size=1, latch=False) self.pub_flip = rospy.Publisher( 'flip', UInt8, queue_size=1, latch=False) self.pub_cmd_out = rospy.Publisher( 'cmd_vel', Twist, queue_size=10, latch=False) self.pub_fast_mode = rospy.Publisher( 'fast_mode', Bool, queue_size=1, latch=False) self.sub_agent_cmd_in = rospy.Subscriber( 'agent_cmd_vel_in', Twist, self.agent_cmd_cb) self.sub_joy = rospy.Subscriber('/joy', Joy, self.joy_cb) rospy.loginfo('Gamepad marshall node initialized')
Example #12
Source File: Controller.py From GtS with MIT License | 5 votes |
def __init__(self, ID): self.id = ID self.mat = None self.data = None #need to facilitate a set of publishers per cf node self.data_sub = rospy.Subscriber('cf/%d/data' % ID, CFData, self.data_cb) self.image_sub = rospy.Subscriber('cf/%d/image' % ID, CompressedImage, self.image_cb) self.cmd_pub = rospy.Publisher('cf/%d/command'% self.id, CFCommand, queue_size=10) self.motion_pub = rospy.Publisher('cf/%d/motion'% self.id, CFMotion, queue_size=10) self.coll_pub = rospy.Publisher('cf/%d/coll'% self.id, Bool, queue_size=10)
Example #13
Source File: omnirobot_server.py From robotics-rl-srl with MIT License | 5 votes |
def reset(self): """ Publish the reset signal to robot (quit the stop state) The odometry will not be reset automatically """ msg = Bool() self.reset_signal_pub.publish(msg)
Example #14
Source File: event_state.py From flexbe_behavior_engine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _enable_ros_control(self): super(EventState, self)._enable_ros_control() self._pub.createPublisher(self._feedback_topic, CommandFeedback) self._sub.subscribe(self._repeat_topic, Empty) self._sub.subscribe(self._pause_topic, Bool)
Example #15
Source File: respeaker_node.py From respeaker_ros with Apache License 2.0 | 5 votes |
def __init__(self): rospy.on_shutdown(self.on_shutdown) self.update_rate = rospy.get_param("~update_rate", 10.0) self.sensor_frame_id = rospy.get_param("~sensor_frame_id", "respeaker_base") self.doa_xy_offset = rospy.get_param("~doa_xy_offset", 0.0) self.doa_yaw_offset = rospy.get_param("~doa_yaw_offset", 90.0) self.speech_prefetch = rospy.get_param("~speech_prefetch", 0.5) self.speech_continuation = rospy.get_param("~speech_continuation", 0.5) self.speech_max_duration = rospy.get_param("~speech_max_duration", 7.0) self.speech_min_duration = rospy.get_param("~speech_min_duration", 0.1) self.main_channel = rospy.get_param('~main_channel', 0) suppress_pyaudio_error = rospy.get_param("~suppress_pyaudio_error", True) # self.respeaker = RespeakerInterface() self.respeaker_audio = RespeakerAudio(self.on_audio, suppress_error=suppress_pyaudio_error) self.speech_audio_buffer = str() self.is_speeching = False self.speech_stopped = rospy.Time(0) self.prev_is_voice = None self.prev_doa = None # advertise self.pub_vad = rospy.Publisher("is_speeching", Bool, queue_size=1, latch=True) self.pub_doa_raw = rospy.Publisher("sound_direction", Int32, queue_size=1, latch=True) self.pub_doa = rospy.Publisher("sound_localization", PoseStamped, queue_size=1, latch=True) self.pub_audio = rospy.Publisher("audio", AudioData, queue_size=10) self.pub_speech_audio = rospy.Publisher("speech_audio", AudioData, queue_size=10) self.pub_audios = {c:rospy.Publisher('audio/channel%d' % c, AudioData, queue_size=10) for c in self.respeaker_audio.channels} # init config self.config = None self.dyn_srv = Server(RespeakerConfig, self.on_config) # start self.speech_prefetch_bytes = int( self.speech_prefetch * self.respeaker_audio.rate * self.respeaker_audio.bitdepth / 8.0) self.speech_prefetch_buffer = str() self.respeaker_audio.start() self.info_timer = rospy.Timer(rospy.Duration(1.0 / self.update_rate), self.on_timer) self.timer_led = None self.sub_led = rospy.Subscriber("status_led", ColorRGBA, self.on_status_led)
Example #16
Source File: carla_manual_control.py From ros-bridge with MIT License | 5 votes |
def __init__(self, role_name, hud): self.role_name = role_name self.hud = hud self._autopilot_enabled = False self._control = CarlaEgoVehicleControl() self._steer_cache = 0.0 self.vehicle_control_manual_override_publisher = rospy.Publisher( "/carla/{}/vehicle_control_manual_override".format(self.role_name), Bool, queue_size=1, latch=True) self.vehicle_control_manual_override = False self.auto_pilot_enable_publisher = rospy.Publisher( "/carla/{}/enable_autopilot".format(self.role_name), Bool, queue_size=1) self.vehicle_control_publisher = rospy.Publisher( "/carla/{}/vehicle_control_cmd_manual".format(self.role_name), CarlaEgoVehicleControl, queue_size=1) self.carla_status_subscriber = rospy.Subscriber( "/carla/status", CarlaStatus, self._on_new_carla_frame) self.set_autopilot(self._autopilot_enabled) self.set_vehicle_control_manual_override( self.vehicle_control_manual_override) # disable manual override
Example #17
Source File: carla_manual_control.py From ros-bridge with MIT License | 5 votes |
def set_vehicle_control_manual_override(self, enable): """ Set the manual control override """ self.hud.notification('Set vehicle control manual override to: {}'.format(enable)) self.vehicle_control_manual_override_publisher.publish((Bool(data=enable)))
Example #18
Source File: carla_manual_control.py From ros-bridge with MIT License | 5 votes |
def set_autopilot(self, enable): """ enable/disable the autopilot """ self.auto_pilot_enable_publisher.publish(Bool(data=enable)) # pylint: disable=too-many-branches
Example #19
Source File: collect_gps_points.py From lawn_tractor with MIT License | 5 votes |
def collect_gps(): global gps_file rospy.init_node('collect_gps_points', anonymous=True) rospy.Subscriber("/fake_gps", NavSatFix, callback) rospy.Subscriber("/status/gps_waypoint_collection",Bool, collection_status_CB ) try: gps_file = open(location_collect, "a") rospy.loginfo(gps_file) except IOError: print "Could not open gps_points_file.txt file." rospy.spin()
Example #20
Source File: visual_servo.py From baxter_demos with Apache License 2.0 | 5 votes |
def publish(self): self.handler_pub = rospy.Publisher("object_tracker/grasp_ready", Bool) self.pub_rate = rospy.Rate(params['rate'])
Example #21
Source File: environment.py From Training-Neural-Networks-for-Event-Based-End-to-End-Robot-Control with GNU General Public License v3.0 | 5 votes |
def reset(self): # Reset robot, change lane and return empty state self.outer = not self.outer self.reset_pub.publish(Bool(self.outer)) return np.zeros((self.resolution[0]*self.resolution[1]),dtype=int)
Example #22
Source File: environment.py From Training-Neural-Networks-for-Event-Based-End-to-End-Robot-Control with GNU General Public License v3.0 | 5 votes |
def reset(self): # Reset steering wheel model self.left_pub.publish(0.) self.right_pub.publish(0.) self.v_pre = v_min self.turn_pre = 0. # Change lane self.outer = not self.outer self.reset_pub.publish(Bool(self.outer)) time.sleep(1) return np.zeros((resolution[0],resolution[1]),dtype=int), 0.
Example #23
Source File: Evaluation.py From drl_local_planner_ros_stable_baselines with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, state_collector, ns, robot_radius = 0,robot_width = 0.58, robot_height = 0.89): self.__robot_radius = robot_radius # robot radius self.__robot_height = robot_height # robot width self.__robot_width = robot_width # robot heigth self.__odom = Odometry() # most recently published odometry of the robot self.__path = Path() # most recently published path self.__done = False # is episode done? self.__new_task_started = False # has a new task started? self.__state_collector = state_collector # for getting relevant state values of the robot self.__rl_agent_path = rospkg.RosPack().get_path('rl_agent') # absolute path rl_agent-package self.__flatland_topics = [] # list of flatland topics self.__timestep = 0 # actual timestemp of training self.__NS = ns self.MODE = rospy.get_param("%s/rl_agent/train_mode", 1) self.__clock = Clock().clock self.__task_generator = TaskGenerator(self.__NS, self.__state_collector, 0.46) self.__recent_agent_states = [] # Subscriber for getting data #self.__odom_sub = rospy.Subscriber("%s/odom"%self.__NS, Odometry, self.__odom_callback, queue_size=1) self.__global_plan_sub = rospy.Subscriber("%s/move_base/NavfnROS/plan"%self.__NS, Path, self.__path_callback, queue_size=1) # self.__path_sub = rospy.Subscriber("%s/move_base/GlobalPlanner/plan" % self.__NS, Path, self.__path_callback, queue_size=1) self.__done_sub = rospy.Subscriber("%s/rl_agent/done"%self.__NS, Bool, self.__done_callback, queue_size=1) self.__new_task_sub = rospy.Subscriber('%s/rl_agent/new_task_started'%self.__NS, Bool, self.__new_task_callback, queue_size=1) self.__flatland_topics_sub = rospy.Subscriber("%s/flatland_server/debug/topics"%self.__NS, DebugTopicList, self.__flatland_topic_callback, queue_size=1) self.__agent_action_sub = rospy.Subscriber('%s/rl_agent/action'%self.__NS, Twist, self.__trigger_callback) self.__ped_sub = rospy.Subscriber('%s/pedsim_simulator/simulated_agents' % self.__NS, AgentStates, self.__ped_callback) if self.MODE == 1 or self.MODE == 0: self.clock_sub = rospy.Subscriber('%s/clock' % self.__NS, Clock, self.__clock_callback) # Publisher for generating qualitative image self.__driven_path_pub = rospy.Publisher('%s/rl_eval/driven_path'%self.__NS, Path, queue_size=1) self.__driven_path_pub2 = rospy.Publisher('%s/rl_eval/driven_path2'%self.__NS, Path, queue_size=1) self.__global_path_pub = rospy.Publisher('%s/rl_eval/global_path'%self.__NS, Path, queue_size=1) self.__agent_pub = rospy.Publisher('%s/rl_eval/viz_agents'%self.__NS, MarkerArray, queue_size=1)
Example #24
Source File: task_generator.py From drl_local_planner_ros_stable_baselines with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __spread_done(self): """ Pulishing True on done-pub """ self.__done_pub.publish(Bool(True))
Example #25
Source File: task_generator.py From drl_local_planner_ros_stable_baselines with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __spread_new_task(self): """ Pulishing True if new task is set. Ready to be solved """ self.__new_task_pub.publish(Bool(True))
Example #26
Source File: input_register_data_block.py From niryo_one_ros with GNU General Public License v3.0 | 5 votes |
def start_ros_subscribers(self): self.joint_state_sub = rospy.Subscriber('/joint_states', JointState, self.sub_joint_states) self.robot_state_sub = rospy.Subscriber('/niryo_one/robot_state', RobotState, self.sub_robot_state) self.selected_tool_id_sub = rospy.Subscriber('/niryo_one/current_tool_id', Int32, self.sub_selected_tool_id) self.learning_mode_sub = rospy.Subscriber('/niryo_one/learning_mode', Bool, self.sub_learning_mode) self.joystick_enabled_sub = rospy.Subscriber('/niryo_one/joystick_interface/is_enabled', Bool, self.sub_joystick_enabled) self.hardware_status_sub = rospy.Subscriber('/niryo_one/hardware_status', HardwareStatus, self.sub_hardware_status) self.ros_log_status_sub = rospy.Subscriber('/niryo_one/rpi/ros_log_status', LogStatus, self.sub_ros_log_status) self.software_version_sub = rospy.Subscriber('/niryo_one/software_version', SoftwareVersion, self.sub_software_version) rospy.Subscriber('/niryo_one/kits/conveyor_1_feedback', ConveyorFeedback, self.sub_conveyor_1_feedback) rospy.Subscriber('/niryo_one/kits/conveyor_2_feedback', ConveyorFeedback, self.sub_conveyor_2_feedback)
Example #27
Source File: joystick_interface.py From niryo_one_ros with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.joy_enabled = False self.joint_mode = JointMode() joy_subscriber = rospy.Subscriber('joy', Joy, self.callback_joy) self.joystick_server = rospy.Service( '/niryo_one/joystick_interface/enable', SetInt, self.callback_enable_joystick) self.joystick_enabled_publisher = rospy.Publisher('/niryo_one/joystick_interface/is_enabled', Bool, queue_size=1) rospy.Timer(rospy.Duration(2), self.publish_joystick_enabled)
Example #28
Source File: joystick_interface.py From niryo_one_ros with GNU General Public License v3.0 | 5 votes |
def publish_joystick_enabled(self, event): msg = Bool() msg.data = self.joy_enabled self.joystick_enabled_publisher.publish(msg)
Example #29
Source File: gripper.py From baxter_demos with Apache License 2.0 | 5 votes |
def __init__(self, limb): self.limb = limb self.limb_if = baxter_interface.Limb(limb) self.gripper_if = baxter_interface.Gripper(limb) if not self.gripper_if.calibrated(): self.gripper_if.calibrate() self.gripper_if.open(block=True) self.traj = common.Trajectory(limb) #names = [limb+'_'+name for name in names] names = ['e0', 'e1', 's0', 's1', 'w0', 'w1', 'w2'] #TODO: Replace this with topic published from get_input node self.jvals=[1.187301128466797, 1.942403170440674, 0.08206797205810547, -0.996704015789795, -0.6734175651123048, 1.0266166411193849, 0.4985437554931641] self.final_jcommand = dict(zip(names, self.jvals)) self.handler_sub = rospy.Subscriber("object_tracker/grasp_ready", Bool, self.callback) self.done = False
Example #30
Source File: fans_manager.py From niryo_one_ros with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.setup_fans() self.learning_mode_on = True # Activate fans for 5 seconds to give an audio signal to the user self.set_fans(True) rospy.sleep(5) self.set_fans(not self.learning_mode_on) self.learning_mode_subscriber = rospy.Subscriber( '/niryo_one/learning_mode', Bool, self.callback_learning_mode)