admin 管理员组

文章数量: 887039

【1

任务一:运行小乌龟节点

(1)roscore
(2)rosrun turtlesim turtlesim_node
(3)rosrun turtlesim turtle_teleop_key

 任务二:创建一个简单节点

mkdir -p ~/robot_ws/src
cd ~/robot_ws/src
catkin_init_workspace
cd ~/robot_ws
catkin_make
cd ~/robot_ws/src
catkin_create_pkg hello roscpp rospy std_msgs
cd ~/robot_ws
catkin_make
cd ~/robot_ws/src/hello
mkdir scripts
cd scripts
touch hello.py
gedit hello.py

#!/usr/bin/env python
import rospy
import timeif __name__=="__main__":rospy.init_node("Hello")time.sleep(1)rospy.loginfo("Hello World")

chmod +x hello.py
catkin_install_python(PROGRAMS 
    scripts/hello.py 
    DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} )

cd ~/robot_ws
catkin_make
    roscore    (另外打开一个终端

source ./devel/setup.bash
rosrun hello hello.py

(新端1)

🔺mentioin~

本文标签: 1