def __init__(self): self.eps_linear = 0.1 self.eps_angular = 0.01 # Initialize the node rospy.init_node(NODE) # Create publisher self.target_vel_pub = rospy.Publisher("turtle1/cmd_vel", Twist, queue_size=10) # Create current and target pose self.current_pose = Pose() self.target_pose = Pose() # Create velocity self.target_vel = Twist() # Create subscriber for pose from turtle self.current_pose_sub = rospy.Subscriber("turtle1/pose", Pose, self.current_pose_callback) # Create subscriber for pose from keyboard self.target_pose_sub = rospy.Subscriber("turtle_controller/pose", Pose, self.target_pose_callback) # Create publisher for velocity self.target_vel_pub = rospy.Publisher("turtle1/cmd_vel", Twist, queue_size=10)
def __init__(self): #initialize the server node rospy.init_node("turtle_server") #Display in the console the message rospy.loginfo("Server initiated") # Tolerance in term of postion and angle self.pos_tolerant = 0.1 self.ang_tolerant = 0.01 # Create current and target position self.current_pose = Pose() self.target_pose = Pose() # Create velocity self.target_vel = Twist() # Create subscriber for pose from turtle self.current_pose_sub = rospy.Subscriber("turtle1/pose", Pose, self.current_pose_callback) # Create publisher self.target_vel_pub = rospy.Publisher("turtle1/cmd_vel", Twist, queue_size=10) ser = rospy.Service("tutle_ser", pos_arr, self.func_move)
def __init__(self): rospy.init_node('rotate_by_pose', anonymous=True) rospy.Subscriber('/tb3pose', Pose, self.get_pose_cb) self.pub = rospy.Publisher('/cmd_vel', Twist, queue_size=10) self.tb3pose = Pose() # for subscribe self.org = Pose() # for store starting point
def __init__(self): # Spawn new turtle2 rospy.wait_for_service('spawn') spawn = rospy.ServiceProxy('spawn', Spawn) spawn(5.5, 5.5, 0.0, "turtle2") pen_color = rospy.ServiceProxy('/turtle2/set_pen', SetPen) pen_color(118, 224, 94, 1, False) # Create node rospy.init_node("turtle_follower") # Initialize publisher and subscriber self.pub = rospy.Publisher('/turtle2/cmd_vel', Twist, queue_size=10) self.guidesub = rospy.Subscriber('/turtle1/pose', Pose, self.update_pose) self.selfsub = rospy.Subscriber('/turtle2/pose', Pose, self.my_pose) self.vel_msg = Twist() self.guide_pose = Pose() self.my_pose = Pose() self.rate = rospy.Rate(10) self.vel_msg.linear.y, self.vel_msg.linear.z = 0, 0 self.vel_msg.angular.x, self.vel_msg.angular.y = 0, 0
def __init__(self, turtle_num): self.turtle_num = turtle_num self.pose_list = [] self.turtle_id_list = [] self.sub_list = [] for i in range(turtle_num): self.pose_list.append(Pose()) self.turtle_id_list.append('turtle' + str(i + 1)) self.sub_list.append( rospy.Subscriber('/turtle' + str(i + 1) + '/pose', Pose, callback=self.update, callback_args=(i + 1))) self.bar_pose = Pose() self.pub_bar = rospy.Publisher('formation_baricenter', Pose, queue_size=10) self.pub_whose_turn = rospy.Publisher('formation_whose_turn', String, queue_size=10) self.sub_just_moved = rospy.Subscriber('formation_just_moved', String, callback=self.select_turtle) rospy.sleep(0.5) # start movement of the first turtle self.pub_whose_turn.publish('turtle1')
def __init__(self, turtleNum, pattern, x, y, th): self.motionPath = pattern self.turtleID = turtleNum self.isTeleop = False self.distanceTolerance = 2 spawnTurtle = rospy.ServiceProxy('spawn', Spawn) spawnTurtle(x, y, th, 'turtle' + str(self.turtleID)) # ROS Object Construction self.velMsg = Twist() self.pose = Pose() self.goalPose = Pose() # ROS Topic Publishers and Subscribers self.velocityTopic = '/turtle' + str(self.turtleID) + '/cmd_vel' self.poseTopic = '/turtle' + str(self.turtleID) + '/pose' self.velocityPublisher = rospy.Publisher(self.velocityTopic, Twist, queue_size=10) self.poseSubscriber = rospy.Subscriber(self.poseTopic, Pose, self.poseCallback) self.posePublisher = rospy.Publisher(self.poseTopic, Pose, queue_size=10) self.rate = rospy.Rate(10) # Turtle Motion Begins self.motionPlanner()
def __init__(self, name): # Publisher which will publish to the topic '/turtle1/cmd_vel'. self.velocity_publisher = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10) # A subscriber to the topic '/turtle1/pose'. self.update_pose is called # when a message of type Pose is received. self.pose_subscriber = rospy.Subscriber('/turtle1/pose', Pose, self.update_pose1) self.pose_subscriber = rospy.Subscriber('/turtle2/pose', Pose, self.update_pose2) self.turtle1_pose = Pose() self.turtle2_pose = Pose() #global success self.rate = rospy.Rate(1000) self._feedback = actionlib_tutorials.msg.FibonacciFeedback() self._result = actionlib_tutorials.msg.FibonacciResult() self.success = False self._action_name = name self._as = actionlib.SimpleActionServer( self._action_name, actionlib_tutorials.msg.FibonacciAction, execute_cb=self.execute_cb, auto_start=False) self._as.start()
def __init__(self): rospy.init_node('turtlebot_controller', anonymous=True) self.velocity_publisher = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10) #VILLAIN TURTLE MOVES IN A CIRCLE self.villain_subscriber = rospy.Subscriber('/turtle2/pose', Pose, self.update_v_pose) #VELOCITY PUBLISHER FOR VILLAIN TURTLE self.velocity2_publisher = rospy.Publisher('/turtle2/cmd_vel', Twist, queue_size=10) self.warning_publisher = rospy.Publisher('chatter', Float32MultiArray, queue_size=10) self.pose_subscriber = rospy.Subscriber('/turtle1/pose', Pose, self.update_pose) self.pose = Pose() self.villain_pose = Pose() self.rate = rospy.Rate(10)
def __init__(self): # Launch the simulation with the given launchfile name gazebo_env.GazeboEnv.__init__(self, "GazeboProject.launch") self.vel_pub = rospy.Publisher('/cmd_vel', Twist, queue_size=5) #self.before_pose = rospy.Publisher('/gazebo/before_model_states', Pose, queue_size=5) rospy.Subscriber('/gazebo/model_states', ModelStates, self.update_pose) rospy.Subscriber('/clock', Clock, self.sim_time) self.unpause = rospy.ServiceProxy('/gazebo/unpause_physics', Empty) self.pause = rospy.ServiceProxy('/gazebo/pause_physics', Empty) self.reset_proxy = rospy.ServiceProxy('/gazebo/reset_simulation', Empty) self.action_space = spaces.Discrete(4) #F,L,R,B self.reward_range = (-np.inf, np.inf) self.sim_time = Clock() self.action_time = 0.00000 self.pose = Pose() self.goalpose = Pose() self.beforepose = Pose() self.startpose = Pose() self._seed() self.goal = False self.randomstart = False self.goalpose.x = 2.000 # map0: 1.5, map1: 1.25, map2: 2.0 self.goalpose.y = -0.250 # map0,1: 0.0, map2: -0.25 self.get_pose(self.beforepose)
def __init__(self, name): self.name = name # Creates a node with name 'turtlebot_controller' and make sure it is a # unique node (using anonymous=True). rospy.init_node('summit_controller', anonymous=True) # Publisher which will publish to the topic topic_name'. topic_name = "/robot/pad_teleop/cmd_vel" self.velocity_publisher = rospy.Publisher(topic_name, Twist, queue_size=10) # Instanziierung eines Twist() Objektes => siehe import self.vel_msg = Twist() # A subscriber to the topic sub_name. # self.update_pose is called # when a message of type Pose is received. sub_name = "/robot/robotnik_base_control/odom" self.pose_subscriber = rospy.Subscriber(sub_name, Odometry, self.update_pose) # Instanziierung eines Pose() Objektes => siehe import self.pose = Pose() self.goal = Pose() # x, y, theta self.rate = rospy.Rate(10)
def __init__(self): # Creates a node with name 'turtlebot_controller' and make sure it is a # unique node (using anonymous=True). rospy.init_node('turtlebot_controller', anonymous=True) # Publisher which will publish to the topic '/turtle1/cmd_vel'. self.velocity_publisher = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10) # A subscriber to the topic '/turtle1/pose'. self.update_pose is called # when a message of type Pose is received. self.pose_subscriber = rospy.Subscriber('/turtle1/pose', Pose, self.update_pose) spawn = rospy.ServiceProxy('/spawn', Spawn) spawn(0, 0, -1, 'turtle2') self.velocity_publisher2 = rospy.Publisher('/turtle2/cmd_vel', Twist, queue_size=10) self.pose_subscriber2 = rospy.Subscriber('/turtle2/pose', Pose, self.update_pose2) ## possible states:{ANGRY, WRITING, RETURNING} self.turle1_state = 'WRITING' self.pose = Pose() self.pose2 = Pose() self.rate = rospy.Rate(10)
def __init__(self): self.poseflag=False self.turtlebot3_pose=Pose() self.goal_pose=Pose() self.goal=PoseStamped() self.vel_msg=Twist() #set in zero linear velocities self.vel_msg.linear.x=0 self.vel_msg.linear.y=0 self.vel_msg.linear.z=0 #set in zero angular velocities self.vel_msg.angular.x=0 self.vel_msg.angular.y=0 self.vel_msg.angular.z=0 #set map propierties self.map_size_x=250 #cm self.map_size_y=250 #cm self.resolution = 1 #cm self.lineal=0.07#.1 #velocidad lineal self.lim_angular=0.22 #limite velocidad angular. self.lane=1 if (self.lane==1): self.matrix = np.load('/home/zarazua_rt/catkin_ws/src/tutoriales_basicos/scripts/TrayA1.npy') elif(self.lane==2): self.matrix = np.load('matrixDynamic_lane2.npy') else: self.matrix = np.load('matrixDynamic_lane2.npy') self.velocity_publisher=rospy.Publisher('/cmd_vel', Twist, queue_size=10) self.pose_subscriber=rospy.Subscriber("/amcl_pose", PoseWithCovarianceStamped,self.poseCallback,queue_size=1) self.rate = rospy.Rate(10) # 10hz
def __init__(self): # rospy.init_node('turtle_random_cmd', anonymous=True) # self.turtlename = rospy.get_param('~turtlename', default='turtle1') self.hz = rospy.get_param('~hz', default=50) # check if the initial value set for y0 is correct self.pub_cmd = rospy.Publisher('%s_custom_cmd' % self.turtlename, Vel_custom, queue_size=20) self.pub_just_moved = rospy.Publisher('formation_just_moved', String, queue_size=20) rospy.wait_for_service('%s/teleport_absolute' % self.turtlename) try: self.teleporter = rospy.ServiceProxy( '%s/teleport_absolute' % self.turtlename, TeleportAbsolute) except rospy.ServiceException as e: print("Service call failed: %s" % e) self.rate = rospy.Rate(self.hz) self.pose = Pose() self.bar_pose = Pose() self.null_speed = Vel_custom(lin=0., ang=0.) self.cmd = Vel_custom() self.sub_pose = rospy.Subscriber('/%s/pose' % self.turtlename, Pose, callback=self.update_pose) self.sub_bar = rospy.Subscriber('formation_baricenter', Pose, callback=self.update_baricenter) self.sub_whose_turn = rospy.Subscriber('formation_whose_turn', String, callback=self.is_my_turn)
def __init__(self): # Launch the simulation with the given launchfile name gazebo_env.GazeboEnv.__init__(self, "GazeboProject.launch") self.vel_pub = rospy.Publisher('/cmd_vel', Twist, queue_size=5) rospy.Subscriber('/gazebo/model_states', ModelStates, self.update_pose) rospy.Subscriber('/clock', Clock, self.sim_time) self.unpause = rospy.ServiceProxy('/gazebo/unpause_physics', Empty) self.pause = rospy.ServiceProxy('/gazebo/pause_physics', Empty) self.reset_proxy = rospy.ServiceProxy('/gazebo/reset_simulation', Empty) self.reward_range = (-np.inf, np.inf) self.sim_time = Clock() self.action_time = 0.00000 self.pose = Pose() self.goalpose = Pose() self.beforepose = Pose() self.startpose = Pose() self.before_avg_data = 0 self._seed() self.goal = False self.goalpose.x = 15.000 # map0: 1.5, map1: 1.25, map2: 2.0 self.goalpose.y = 0.000 # map0,1: 0.0, map2: -0.25 self.get_pose(self.beforepose) self.subgoal_as_dist_to_goal = 1000 # max. lidar's value
def collision_test(): global velocity1, velocity2, pub1, pub2, pos1, pos2 pos1 = Pose() pos2 = Pose() pos1.x = 10 pos2.x = 1.08889 pos1.y = 5.544445 pos2.y = 5.544445 rospy.init_node('turtle_circle_control', anonymous=True) rospy.wait_for_service('spawn') add_turtle = rospy.ServiceProxy('spawn', turtlesim.srv.Spawn) remove_turtle = rospy.ServiceProxy('kill', turtlesim.srv.Kill) remove_turtle("turtle1") add_turtle(pos1.x, pos1.y, -pi, 'turtle1') add_turtle(pos2.x, pos2.y, 0, 'turtle2') pub1 = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10) pub2 = rospy.Publisher('turtle2/cmd_vel', Twist, queue_size=10) rospy.Subscriber('/turtle1/pose', Pose, callback1) rospy.Subscriber('/turtle2/pose', Pose, callback2) velocity1 = Twist() velocity2 = Twist() velocity1.linear.x = 3 velocity2.linear.x = 3 rospy.sleep(1) while not rospy.is_shutdown(): pub1.publish(velocity1) pub2.publish(velocity2)
def __init__(self): self.poseflag=False ruta=os.path.dirname(os.path.abspath(__file__))+'/Generacion _de_Trayectorias/' PuntosA=np.array(np.load(ruta+'PuntosA1.npy')) self.ArbolA=self.Arbol(PuntosA,p) PuntosB=np.array(np.load(ruta+'PuntosB1.npy')) self.ArbolB=self.Arbol(PuntosB,p) PuntosC=np.array(np.load(ruta+'PuntosC1.npy')) self.ArbolC=self.Arbol(PuntosC,p) self.turtlebot3_pose_L=Pose() self.Positions_XL=[] self.Positions_YL=[] self.Positions_EL=[] self.turtlebot3_pose_F=Pose() self.Positions_XF=[] self.Positions_YF=[] self.Positions_EF=[] self.Positions_Count=[] self.count=0 self.lane=0 self.graph=False self.clear=False self.save_data=False self.language=False #self.fig = plt.figure(figsize=(7,7), facecolor='w') #self.fig.canvas.set_window_title('Trayectorias generadas') self.lane_subscriber=rospy.Subscriber("/lane",Int32,self.laneCallback,queue_size=1) self.posel_subscriber=rospy.Subscriber("/tb3_0/amcl_pose", PoseWithCovarianceStamped,self.poseCallback,queue_size=1) self.posef_subscriber=rospy.Subscriber("/tb3_1/amcl_pose", PoseWithCovarianceStamped,self.poseCallback2,queue_size=1) self.graph_subscriber=rospy.Subscriber("/graph", Bool,self.graph_on_Callback,queue_size=1) self.clear_graph_subscriber=rospy.Subscriber("/clear_graph",Bool,self.clear_graph_Callback,queue_size=1) self.save_data_subscriber=rospy.Subscriber("/save_data",Bool,self.save_data_Callback,queue_size=1) self.change_language_subscriber=rospy.Subscriber("/change_language",Bool,self.change_language_Callback,queue_size=1) plt.ion()
def __init__(self): #Variables init # self._odom = Odometry() #Don't froget to edit after testing to "/cmd_vel" self._odom = Pose() # self._startPosition = Odometry() #Don't froget to edit after testing to "/cmd_vel" self._startPosition = Pose() rospy.loginfo("TurtleBro ActionSever vars init complete") #TOREMOVE #ROS init self._goalRecieved = False rospy.init_node('move_server_node') rospy.loginfo("Start TurtleBro ActionSever") rospy.on_shutdown(self.shutdown) self._cmd_vel = rospy.Publisher( '/turtle1/cmd_vel', Twist, queue_size=1) #Don't froget to edit after testing to "/cmd_vel" # rospy.Subscriber("/odom", Odometry, self.odometry_cb) ---- to modyfy after tests rospy.Subscriber('/turtle1/pose', Pose, self.odometry_cb) # ---- TO REMOVE after tests self._tbasm = actionlib.SimpleActionServer( 'movetodistance', movetodistanceAction, execute_cb=self.actionserver_goal_recieve_cb, auto_start=False) self._tbasm.start() rospy.loginfo("TurtleBro ActionSever started") #TOREMOVE #Action server inits self._result = movetodistanceResult() self._feedback = movetodistanceFeedback() rospy.loginfo("TurtleBro ActionSever init complete") #TOREMOVE
def __init__(self): # Creates a node with name 'turtle_controller' rospy.init_node('turtle_controller') # Publisher for publishing control commands to 'turtle1/cmd_vel'. self.vel_pub = rospy.Publisher('turtle1/cmd_vel', Twist) # A subscriber to the topic 'turtle1/pose'. # self.update_pose is called to store the latest pose self.pose_sub = rospy.Subscriber('turtle1/pose', Pose, self.update_pose) # A subscriber to the topic 'turtle1ctrl/goal'. # self.update_goal is called to store the goal self.goal_sub = rospy.Subscriber('turtle1ctrl/goal', Pose, self.update_goal) # A publisher for notification of reaching the current goal # to the topic 'turtle1ctrl/reach' self.reach_pub = rospy.Publisher('turtle1ctrl/reach', Empty) self.pose = Pose() # The latest pose self.goal_pose = Pose() # The current goal pose self.distance_tolerance = 0.01 # Tolerance of distance to goal # Controllers' parameters self.Kp_lin = 1.5 self.Kp_ang = 6.0 # Limits of velocities self.lin_vel_max = 2. self.lin_vel_min = 0. self.ang_vel_max = 2*pi self.ang_vel_min = -2*pi self.rate = rospy.Rate(10) # The control rate in Hertz self.started = False # Only start controlling after the first goal is received self.reached_goal = False # Whether the goal has been reached
def __init__(self): rospy.init_node('swim', anonymous=False) self.pose_sub = rospy.Subscriber('turtle1/pose', Pose, self.update_pose) self.cmd_vel = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10) self.rate = rospy.Rate(10) self.pose = Pose() self.goal = Pose()
def move2ref(self, x_ref, y_ref): ref_pose = Pose() ref_pose.x = x_ref ref_pose.y = y_ref ref_tol = 0.01 vel_msg = Twist() while self.ref_distance(ref_pose) >= ref_tol: angulo = (int(self.pose.theta)) if (self.scan.ranges[angulo] < 0.6): vel_msg.linear.x = 0 vel_msg.linear.y = 0 vel_msg.linear.z = 0 vel_msg.angular.x = 0 vel_msg.angular.y = 0 vel_msg.angular.z = 0 self.vel_publisher.publish(vel_msg) self.rate.sleep() correcao_x = 1 correcao_y = 1 while (self.scan.ranges[angulo] < 0.6): ref_pose_nova = Pose() ref_pose_nova.x = self.pose.x * (1 + math.cos(angulo)) ref_pose_nova.y = self.pose.x * (1 + math.sin(angulo)) vel_msg.linear.x = self.linear_vel_control(ref_pose_nova) vel_msg.linear.y = 0 vel_msg.linear.z = 0 vel_msg.angular.x = 0 vel_msg.angular.y = 0 vel_msg.angular.z = self.angular_vel_control(ref_pose_nova) self.vel_publisher.publish(vel_msg) self.rate.sleep() else: vel_msg.linear.x = self.linear_vel_control(ref_pose) vel_msg.linear.y = 0 vel_msg.linear.z = 0 vel_msg.angular.x = 0 vel_msg.angular.y = 0 vel_msg.angular.z = self.angular_vel_control(ref_pose) self.vel_publisher.publish(vel_msg) self.rate.sleep() # stop vel_msg.linear.x = 0 vel_msg.angular.z = 0 self.vel_publisher.publish(vel_msg) rospy.loginfo("Finished")
def __init__(self): self.rPose = Pose() self.fPose = Pose() self.rabb_sub = rospy.Subscriber('/michelangelo/pose', Pose, self.setRabbit) self.runner_sub = rospy.Subscriber('/raphael/pose', Pose, self.setFox) self.runner_pub = rospy.Publisher('/raphael/cmd_vel', Twist, queue_size=1)
def __init__(self): rospy.init_node('robot_listener') # get parameters from the parameter server self.robot = rospy.get_param('turtle', 'turtle2') self.human = rospy.get_param('turtle', 'turtle1') # spawn service to create multiple turtles rospy.wait_for_service('spawn') spawner = rospy.ServiceProxy('spawn', Spawn) spawner(5.5, 1, 0.5 * math.pi, self.robot) # # listener for human pose # self.transformBuffer = tf2_ros.Buffer() # self.humanTransform = TransformStamped() # listener = tf2_ros.TransformListener(self.transformBuffer) # subscriber for self pose self.pose = Pose() self.subscriber = rospy.Subscriber('%s/pose' % self.robot, Pose, self.update_pose) # subscriber for human pose self.human_pose = Pose() self.humanSubscriber = rospy.Subscriber('%s/pose' % self.human, Pose, self.update_human_pose) # publisher for twist message self.msg = Twist() self.publisher = rospy.Publisher('%s/cmd_vel' % self.robot, Twist, queue_size=1) # social cost from human self.socialCost = [] # heuristic cost for goal configuration self.heuristicCost = [] # distance cost from self self.distanceCost = [] # total cost self.totalCost = [] # initialize all costs to 0 tmp = [] for ii in range(0, 100): tmp.append(0) for ii in range(0, 100): self.socialCost.append(tmp[:]) self.heuristicCost.append(tmp[:]) self.distanceCost.append(tmp[:]) self.totalCost.append(tmp[:]) self.goal_flag = False self.subgoal_flag = False self.rate = rospy.Rate(10)
def __init__(self): self.surv_pose = Pose() self.surv_sub = rospy.Subscriber('/michelangelo/pose', Pose, self.set_surv_pose) self.runner_pose = Pose() self.runner_sub = rospy.Subscriber('/raphael/pose', Pose, self.set_runner_pose) self.runner_pub = rospy.Publisher('/raphael/cmd_vel', Twist, queue_size=1)
def __init__(self): rospy.init_node('Turtle_Mover', anonymous=True) self.vel_pub = rospy.Publisher('/turtle2/cmd_vel', Twist, queue_size=10) rospy.Subscriber('/turtle1/pose', Pose, self.update_pose1) rospy.Subscriber('/turtle2/pose', Pose, self.update_pose2) self.pose1 = Pose() # Turtle 1 pose self.pose2 = Pose() # Turtle 2 pose self.rate = rospy.Rate(10) #Frequency 10Hz
def __init__(self): self.rPose = Pose() self.fPose = Pose() self.rabb_sub = rospy.Subscriber('/michelangelo/pose', Pose, self.set_pose_outsider) self.runner_sub = rospy.Subscriber('/raphael/pose', Pose, self.set_pose_favorite) self.runner_pub = rospy.Publisher('/raphael/cmd_vel', Twist, queue_size=1)
def __init__(self): self.pub = rospy.Publisher('letter', String, queue_size=10) self.state = False self.timeInit = time.time() self.timeEnd = time.time() self.pose1 = Pose() self.pose2 = Pose() self.finalState = False self.folderPath = '' self.position = 0
def __init__(self): rospy.init_node("drive") self.turtle1 = Pose() self.abh = Pose() self.pub = rospy.Publisher("/turtle1/cmd_vel", Twist, queue_size=10) rospy.Subscriber("/turtle1/pose", Pose, self.turtleCallback) rospy.Subscriber("/abhiyaan/pose", Pose, self.abhiyaanCallback)
def __init__(self): # Creating our node,publisher and subscriber rospy.init_node('turtlebot_controller', anonymous=True) self.pub = rospy.Publisher('/turtle2/cmd_vel', Twist, queue_size=10) self.pose_subscriber = rospy.Subscriber('/turtle1/pose', Pose, self.callback) self.pose_subscriber = rospy.Subscriber('/turtle2/pose', Pose, self.callback2) self.pose1 = Pose() self.pose = Pose() self.rate = rospy.Rate(rate)
def __init__(self): self.poseflag=False self.turtlebot3_pose=Pose() self.pose_sub = rospy.Subscriber("/tb3_0/amcl_pose", PoseWithCovarianceStamped, self.PoseCallback, queue_size=1) #Posicion lider self.laser_sub = rospy.Subscriber("/tb3_0/scan", LaserScan, self.LaserCallback, queue_size=1) #Posicion lider self.force_publisher=rospy.Publisher('/tb3_0/force', Pose, queue_size=10) self.force=Pose() self.matrix = np.zeros((int(map_size_x/resolution),int(map_size_y/resolution)),dtype='f') self.lim_x,self.lim_y = (int(map_size_x/resolution),int(map_size_y/resolution)) self.count=1 self.rate = rospy.Rate(10) # 10hz self.loop()
def __init__(self): rospy.init_node('turtlebot_controller', anonymous=True) self.v_publisher = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10) # velocity publisher self.pose_subscriber = rospy.Subscriber('/turtle1/pose', Pose, self.update_pose) self.goal_subscriber = rospy.Subscriber('/robot_number', Pose, self.Goal_pose) self.friend_pose = Pose() self.my_pose = Pose() self.rate = rospy.Rate(10)