当前位置:网站首页>[ROS play with turtle turtle]
[ROS play with turtle turtle]
2022-06-24 22:59:00 【Both food and fun_】
ROS Get along well with Turtlesim Little Turtle
Turtlesim It's a place for learning ROS Lightweight simulator for , Because it has a turtle , So it is often called Little Turtle .
I am a ROS beginner , Just touched , Let me share with you ROS My learning experience , Want to learn ROS My friends can refer to . Use to : ubuntu ,ros
/
/
One _ Keyboard control turtle movement
1. The first thing to do is to open it ROS Master , Open a new terminal (Ctrl+alt+T), Input :
~$ roscore
2. Open another terminal , Start the little turtle simulator :
~$ rosrun turtlesim turtlesim_node
A window appears after successful startup :
3. Open a new terminal , Start the little turtle control node , Input :
~$ rosrun turtlesim turtle_teleop_key
After success
[email protected]:~$ rosrun turtlesim turtle_teleop_key
Reading from keyboard
---------------------------
Use arrow keys to move the turtle. 'q' to quit.
Place the cursor in the current window , Use the keyboard up, down, left and right to control the movement of the little turtle :

< ctrl > + < C > You can exit keyboard control
/
/
Two _ Command line control turtle movement
Open a new terminal , Input :
[email protected]:~$ rostopic pub /turtle1/cmd_vel geometry_msgs/Twist "linear:
x: 1.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
among linear It's linear velocity ,angular It's angular velocity
take linear Under the x Set to 1.0, The little turtle will walk along x Move a little bit in the direction , To keep the little turtle moving , stay pub Add... After the order -r 10 : That is, a transmission frequency is set 10hz, So the little turtle will keep moving in one direction , Also press < ctrl > + < C > Control can be exited , The little turtle stopped moving .
[email protected]:~$ rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear:
x: 1.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
So we can find a way to make the little turtle draw a circle , Input :
[email protected]:~$ rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear:
x: 1.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 1.0"
Let the little turtle have x Linear displacement of shaft and z Angular displacement in the axial direction , A complete circle appears :

/
/
/
3、 ... and _ Control the turtle's movement according to the memory route
- Memory path generation
Keep the previous terminal window , Create a new window , Input :~$ rosbag record -a -O cmd_record Start recording the turtle's path , appear :
[email protected]:~$ rosbag record -a -O cmd_record
[ INFO] [1655641849.095812339]: Recording to 'cmd_record.bag'.
[ INFO] [1655641849.096922059]: Subscribing to /turtle1/color_sensor
[ INFO] [1655641849.098730076]: Subscribing to /turtle1/cmd_vel
[ INFO] [1655641849.100702759]: Subscribing to /rosout
[ INFO] [1655641849.102427902]: Subscribing to /rosout_agg
[ INFO] [1655641849.105294212]: Subscribing to /turtle1/pose
Place the cursor on the terminal that starts the keyboard control , Control the movement of the little turtle , At this time, the path information of the little turtle has been recorded , After recording, place the cursor on the terminal that opens the recording path Press down < ctrl > + < C > Stop recording , The home folder will generate a .bag The file is our record file :
//
/
/
- Follow the memory path
Turn off all previous terminals , Open the turtle control window again according to the steps , Open a new terminal input :
~$ rosbag play cmd_record.bag
The little turtle began to move according to the previously recorded path ~~~
边栏推荐
- Win10 or win11 printer cannot print
- EPICS记录参考3 -- 所有记录都有的字段
- Problem solving - nested lists
- The usage difference between isempty and isblank is so different that so many people can't answer it
- [text data mining] Chinese named entity recognition: HMM model +bilstm_ CRF model (pytoch) [research and experimental analysis]
- 【nvm】
- STP spanning tree protocol Foundation
- Cat write multiline content to file
- Programmers become gods by digging holes in one year, carrying flags in five years and becoming gods in ten years
- Sword finger offer 42 Maximum sum of successive subarrays
猜你喜欢

Layer 2 and layer 3 forwarding principle based on VLAN

Memory alignment of structures

加分利器 不负所托 | 知道创宇获攻防演练防守方感谢信!

JWT(Json Web Token)

面试害怕被问MySQL相关问题 ?这份三万字精华总结 + 面试100 问,吊打面试官完全够了

See how sparksql supports enterprise level data warehouse

ACL (access control list) basic chapter - Super interesting learning network

Recommended course: workplace writing training

Beijiafu (p+f) R2000 modified radar IP
![[postgraduate entrance examination English] prepare for 2023, learn list9 words](/img/2d/9ff691c9ff50fba2df73f726db26f2.jpg)
[postgraduate entrance examination English] prepare for 2023, learn list9 words
随机推荐
Dynamic memory management (1)
[postgraduate entrance examination English] prepare for 2023, learn list8 words
Simulated 100 questions and online simulated examination of high voltage electrician examination in 2022
Recommended course: workplace writing training
Data communication and physical network
Servlet
China Sky Lantern market trend report, technical dynamic innovation and market forecast
Solve the problem of port occupation
倍加福(P+F)R2000修改雷达IP
EPICS记录参考4--所有输入记录都有的字段和所有输出记录都有的字段
Envoy obtain the real IP address of the client
【Laravel系列7.9】测试
ThreadLocal local thread
China solar window market trend report, technical dynamic innovation and market forecast
大厂面试必问:如何解决TCP可靠传输问题?8张图带你详细学习
Wechat side: what is consistent hash? In what scenario? What problems have been solved?
环境配置 | VS2017配置OpenMesh源码和环境
Are you afraid of being asked MySQL related questions during the interview? This 30000 word essence summary + 100 interview questions, and it's enough to hang the interviewer
MySQL夺命10问,你能坚持到第几问?
2022年高压电工考试模拟100题及在线模拟考试