<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[turtlesim问题]]></title><description><![CDATA[<p dir="auto">在使用动作通信中，在spawn随机生成乌龟，暂定为turtle2,启动Turtlesim_node节点，让turtle2跟随turtle1，但是出现了问题，                self.distance = sqrt(pow(self.turtlerandom_pose_x - self.turtle1_pose_x , 2)+<br />
pow(self.turtlerandom_pose_y - self.turtle1_pose_y , 2))</p>
<pre><code>            self.theta = atan2(abs(self.turtlerandom_pose_y - self.turtle1_pose_y),
                               abs(self.turtlerandom_pose_x - self.turtle1_pose_x))

            turtle_velocity_param = Twist()

            turtle_velocity_param.linear.x =  self.distance * cos(self.theta) * 0.05
            turtle_velocity_param.linear.y =  self.distance * sin(self.theta) * 0.05
            turtle_velocity_param.linear.z = 0.0

            turtle_velocity_param.angular.x = 0.0
            turtle_velocity_param.angular.y = 0.0
            turtle_velocity_param.angular.z = 0.0

            self.publish_velocity_create.publish(turtle_velocity_param)
</code></pre>
<p dir="auto">使用该代码的目的，是让乌龟2跟随乌龟1，当乌龟1静止时，乌龟2应该直线跟随，但是该代码是以弧形路径去跟随，旋转到目标乌龟，此旋转是路径，就像螺旋线</p>
]]></description><link>https://fishros.org.cn/forum/topic/4588/turtlesim问题</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 21:12:49 GMT</lastBuildDate><atom:link href="https://fishros.org.cn/forum/topic/4588.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Oct 2025 06:39:48 GMT</pubDate><ttl>60</ttl></channel></rss>