删除movement_task相关文件

aaaaaa
iden 6 months ago
parent c3bbbb8de6
commit c438c2fb4b

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>movement_task</name>
<version>0.0.0</version>
<description>T-shape movement task for robot</description>
<maintainer email="your_email@example.com">your_name</maintainer>
<license>Apache License 2.0</license>
<depend>rclpy</depend>
<depend>geometry_msgs</depend>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>
<export>
<build_type>ament_python</build_type>
</export>
</package>

@ -1,4 +0,0 @@
[develop]
script_dir=$base/lib/movement_task
[install]
install_scripts=$base/lib/movement_task

@ -1,32 +0,0 @@
from setuptools import setup
import os
from glob import glob
package_name = 'movement_task'
setup(
name=package_name,
version='0.0.0',
packages=[],
py_modules=[
'text.t_shape',
],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
(os.path.join('share', package_name, 'text'), glob('text/*.py')),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='your_name',
maintainer_email='your_email@example.com',
description='T-shape movement task for robot',
license='Apache License 2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
't_shape = text.t_shape:main',
],
},
)

@ -1,25 +0,0 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ament_copyright.main import main
import pytest
# Remove the `skip` decorator once the source file(s) have a copyright header
@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.')
@pytest.mark.copyright
@pytest.mark.linter
def test_copyright():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found errors'

@ -1,25 +0,0 @@
# Copyright 2017 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ament_flake8.main import main_with_errors
import pytest
@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc, errors = main_with_errors(argv=[])
assert rc == 0, \
'Found %d code style errors / warnings:\n' % len(errors) + \
'\n'.join(errors)

@ -1,23 +0,0 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ament_pep257.main import main
import pytest
@pytest.mark.linter
@pytest.mark.pep257
def test_pep257():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found code style errors / warnings'

@ -1,130 +0,0 @@
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import Twist
import time
def main():
rclpy.init()
node = Node('t_shape_movement')
publisher = node.create_publisher(Twist, '/cmd_vel', 10)
node.get_logger().info("=== 开始T字形运动控制 ===")
node.get_logger().info("机器人将循环执行T字形路径")
time.sleep(2.0)
cycle_count = 0
try:
while True:
cycle_count += 1
# T字向上移动
node.get_logger().info("T字竖线: 向前移动")
twist = Twist()
twist.linear.x = 0.15 # 前进速度
publisher.publish(twist)
time.sleep(2.5) # 前进2.5秒
# 停止一下
node.get_logger().info("暂停")
twist = Twist()
publisher.publish(twist)
time.sleep(0.5)
# T字左转并前进
node.get_logger().info("T字横线左半: 左转")
twist = Twist()
twist.angular.z = 0.4 # 左转速度
publisher.publish(twist)
time.sleep(1.2) # 左转1.2秒约45度
node.get_logger().info("暂停")
twist = Twist()
publisher.publish(twist)
time.sleep(0.3)
node.get_logger().info("T字横线左半: 向前移动")
twist = Twist()
twist.linear.x = 0.15
publisher.publish(twist)
time.sleep(2.0) # 前进2秒
node.get_logger().info("暂停")
twist = Twist()
publisher.publish(twist)
time.sleep(0.5)
# 回到T字中心点
node.get_logger().info("回到T字中心: 向后移动")
twist = Twist()
twist.linear.x = -0.15 # 后退速度
publisher.publish(twist)
time.sleep(2.0) # 后退2秒
node.get_logger().info("暂停")
twist = Twist()
publisher.publish(twist)
time.sleep(0.3)
# T字右转并前进
node.get_logger().info("T字横线右半: 右转")
twist = Twist()
twist.angular.z = -0.4 # 右转速度
publisher.publish(twist)
time.sleep(2.4) # 右转2.4秒约90度
node.get_logger().info("暂停")
twist = Twist()
publisher.publish(twist)
time.sleep(0.3)
node.get_logger().info("T字横线右半: 向前移动")
twist = Twist()
twist.linear.x = 0.15
publisher.publish(twist)
time.sleep(2.0) # 前进2秒
node.get_logger().info("暂停")
twist = Twist()
publisher.publish(twist)
time.sleep(0.5)
# 回到起点准备下一次循环
node.get_logger().info("回到起点: 向后移动")
twist = Twist()
twist.linear.x = -0.15
publisher.publish(twist)
time.sleep(2.0) # 后退2秒
node.get_logger().info("回到起点: 左转")
twist = Twist()
twist.angular.z = 0.4
publisher.publish(twist)
time.sleep(1.2) # 左转1.2秒
node.get_logger().info(f"=== 第 {cycle_count} 次T字形完成 ===")
node.get_logger().info("等待3秒后开始下一次循环...")
# 停止等待
twist = Twist()
publisher.publish(twist)
time.sleep(3.0)
finally:
# 停止机器人
twist = Twist()
publisher.publish(twist)
node.get_logger().info("机器人已停止")
# 关闭节点
node.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
main()
Loading…
Cancel
Save