本文整理汇总了Python中std_msgs.msg.Bool方法的典型用法代码示例。如果您正苦于以下问题:Python msg.Bool方法的具体用法?Python msg.Bool怎么用?Python msg.Bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std_msgs.msg
的用法示例。
在下文中一共展示了msg.Bool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _home_arm_planner
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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
示例2: start_ros_subscribers
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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)
示例3: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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
示例4: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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
示例5: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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))
示例6: reset
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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)
开发者ID:clamesc,项目名称:Training-Neural-Networks-for-Event-Based-End-to-End-Robot-Control,代码行数:7,代码来源:environment.py
示例7: reset
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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.
开发者ID:clamesc,项目名称:Training-Neural-Networks-for-Event-Based-End-to-End-Robot-Control,代码行数:13,代码来源:environment.py
示例8: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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)
示例9: __spread_done
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
def __spread_done(self):
"""
Pulishing True on done-pub
"""
self.__done_pub.publish(Bool(True))
示例10: __spread_new_task
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
def __spread_new_task(self):
"""
Pulishing True if new task is set. Ready to be solved
"""
self.__new_task_pub.publish(Bool(True))
示例11: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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)
示例12: publish_joystick_enabled
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
def publish_joystick_enabled(self, event):
msg = Bool()
msg.data = self.joy_enabled
self.joystick_enabled_publisher.publish(msg)
示例13: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
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)
示例14: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
def __init__(self):
self.pin = BUTTON_GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
rospy.loginfo("GPIO setup : " + str(self.pin) + " as input")
rospy.sleep(0.1)
self.last_state = self.read_value()
self.consecutive_pressed = 0
self.activated = True
self.timer_frequency = 20.0
self.shutdown_action = False
self.hotspot_action = False
self.button_mode = ButtonMode.TRIGGER_SEQUENCE_AUTORUN
self.change_button_mode_server = rospy.Service(
"/niryo_one/rpi/change_button_mode", SetInt, self.callback_change_button_mode)
self.monitor_button_mode_timer = rospy.Timer(rospy.Duration(3.0), self.monitor_button_mode)
self.last_time_button_mode_changed = rospy.Time.now()
# Publisher used to send info to Niryo One Studio, so the user can add a move block
# by pressing the button
self.save_point_publisher = rospy.Publisher(
"/niryo_one/blockly/save_current_point", Int32, queue_size=10)
self.button_state_publisher = rospy.Publisher(
"/niryo_one/rpi/is_button_pressed", Bool, queue_size=10)
self.button_timer = rospy.Timer(rospy.Duration(1.0 / self.timer_frequency), self.check_button)
rospy.on_shutdown(self.shutdown)
rospy.loginfo("Niryo One Button started")
示例15: publish
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Bool [as 别名]
def publish(self):
self.handler_pub = rospy.Publisher("object_tracker/grasp_ready", Bool)
self.pub_rate = rospy.Rate(params['rate'])