Ich habe eine Führungsschildkröte und drei Nachfolgerschildkröten. Die Follower folgen mit der TF2 -Transformationsmethode. Gibt es eine Möglichkeit, dies zu stoppen? Manchmal kommt es korrekt und wird zum richtigen Ort, aber dies ist nicht das Verhalten, auf das ich hoffe.
Ich habe eine Führungsschildkröte und drei Nachfolgerschildkröten. Die Follower folgen mit der TF2 -Transformationsmethode. Gibt es eine Möglichkeit, dies zu stoppen? Manchmal kommt es korrekt und wird zum richtigen Ort, aber dies ist nicht das Verhalten, auf das ich hoffe.[code]#!/usr/bin/env python import rospy
import math import tf2_ros import geometry_msgs.msg import turtlesim.srv from turtlesim.msg import Pose from geometry_msgs.msg import Twist import time from random import randint from com760_assign_summer_ws_pkg.msg import bxxxxxxxxLeaderMessage
msg = b00830189LeaderMessage() msg.instructionID = 0 msg.message = "Followers are to gather in formation" msg_pub.publish(msg) # The message is cintinuously published msg_listener()
def rotate(): #Starts a new node # rospy.init_node('robot_cleaner', anonymous=True) # velocity_publisher = rospy.Publisher('/leader_turtle/cmd_vel', Twist, queue_size=10) # vel_msg = Twist()
speed = 90.0 angle = 90.0
clockwise = randint(0,1) # 0 = False, so, antilockwise, 1 - True, so, clockwise # clockwise = False
#Converting from angles to radians angular_speed = speed*2*PI/360 relative_angle = angle*2*PI/360
#We wont use linear components vel.linear.x=0 vel.linear.y=0 vel.linear.z=0 vel.angular.x = 0 vel.angular.y = 0
# Checking if our movement is CW or CCW if clockwise: vel.angular.z = -abs(angular_speed) else: vel.angular.z = abs(angular_speed) # Setting the current time for distance calculus t0 = rospy.Time.now().to_sec() current_angle = 0
def poseCallback(pose_message): global x global y, z, yaw x= pose_message.x y= pose_message.y yaw = pose_message.theta
def f1_poseCallback(f1_pose_message): # Function to get the polition of the follower 1 turtle global f1x, f1y, f1z, f1yaw f1x= f1_pose_message.x f1y= f1_pose_message.y f1yaw = f1_pose_message.theta
def f2_poseCallback(f2_pose_message): # Function to get the polition of the follower 2 turtle global f2x, f2y, f2z, f2yaw f2x= f2_pose_message.x f2y= f2_pose_message.y f2yaw = f2_pose_message.theta
def f3_poseCallback(f3_pose_message): # Function to get the polition of the follower 3 turtle global f3x, f3y, f3z, f3yaw f3x= f3_pose_message.x f3y= f3_pose_message.y f3yaw = f3_pose_message.theta
def pose_callback(pose): global robot_x rospy.loginfo("Robot X = %f : Y = %f : Z = %f \n", pose.x, pose.y, pose.theta) robot_x = pose.x
def straight_line_setup(): # --- Moves the turtle in a straight line after it has rotated --- # vel.linear.x = 0.5 # Speed vel.linear.y = 0 vel.linear.z = 0
time.sleep(5) # Allowing time for everything to get set up before next thing happens
# ------- Rotating, hopefully ------ ~ rotate() # This function will go off and rotate the turtle either closewise or anticlockwise.
time.sleep(3) # --- Moves the turtle in a straight line after it has rotated --- # straight_line_setup() # call this instead of the commented code above
rate = rospy.Rate(10.0) while not rospy.is_shutdown():
msg_talker()
# Now, I want an if-statement. If 0, for the followers, if 0, do the other thing if(instruction == 0): # pub.publish(vel) # publishing to leader turtle (i.e. main turtle) try: past = rospy.Time.now() - rospy.Duration(5.0)
if(((x > 10.5) or (x < 0.5)) or ((y > 10.5) or (y < 0.5))): print("Ah!! A wall") vel.linear.x = 0 vel.linear.y = 0 pub.publish(vel) else: # print("It isn't 0, you crazy fool!") pass
rate.sleep() < /code> Dann habe ich auch die folgenden, in separaten Dateien. Der einzige Unterschied ist, dass der T.Child_Frame_id [/code] in allen drei unterschiedlich ist. Die anderen beiden haben carot2 und dann carot3 und die x- und y-locations: [code]#!/usr/bin/env python import rospy import tf2_ros import tf2_msgs.msg import geometry_msgs.msg
Ich habe einen Fehler beim Erstellen von Micro-Ros-Firmware für Android getroffen. Im Folgenden finden Sie Details:
Hardware Beschreibung: ARM64-V8A
RTOS: UBUNTU 24.04, NOBLE LTS
Installationstyp:...
Ich bin dabei, alle meine Datenbankoperationen asynchron zu machen. Allerdings scheine ich nicht die gewünschten Ergebnisse der Asynchronität zu erzielen.
Ich wechsle von einem anderen Entwicklungsstapel zu Java/Spring und bin sehr verwirrt darüber, wie in Spring einige Dinge erledigt werden.
Eines der Probleme ist die magische Konvertierung von...
Breite Die neue CSS-Eigenschaft der Feldgrößengröße können bestimmte Formelemente zulassen, die in Bezug auf die Größe des Inhalts eingeben/schrumpfen. (Zum Schreiben nur auf Chrom unterstützt:...
Breite Die neue CSS-Eigenschaft der Feldgrößengröße können bestimmte Formelemente zulassen, die in Bezug auf die Größe des Inhalts eingeben/schrumpfen. (Zum Schreiben nur auf Chrom unterstützt:...