CW1 2023 Brief
Background Story
You are writing code for a telepresence robot, which people must be able to control remotely. It accepts navigation commands as strings and executes them. You must use the turtlesim environment.
Ros Fundamentals
- Create a package called "first_coursework" [1 mark]
- Create a node called command_generator, which will read a sequence of commands from a text file and output them to the navigation node.
Commands are of the form “movement amount”, where movement is an element of {forward, backward, turn} and amount is an integer representing a number of meters for forward and backward, and a number of degrees for turn. For example, the command “forward 1” makes the robot move forward by 1m, while the command “turn 90” makes the robot rotate counterclockwise by 90 degrees (remember that positive rotations are counterclockwise, while negative rotations are clockwise).
- Define a message type called Command to represent a single command. You can choose the fields that you think best represent the command. There is no right or wrong, as long as the navigation node is later able to execute the corresponding command (for example, omitting the amount would not allow the navigation node to execute the corresponding command). [3 marks]
The command_generator node must:
- Read a sequence of commands from a text file called “command_list.txt”, located in the user’s home directory, one command per line. [1 mark]
- For each command, publish a message of type Command on a topic called /navigation_command. [3 marks]
- Commands with movement forward and backward by a negative amount are malformed and must be ignored. [1 mark]
This is an example of a command_list.txt file that would make the turtle draw a square:
forward 1
turn 90
forward 1
turn 90
forward 1
turn 90
forward 1
Robot Navigation
The robot is allowed to navigate with maximum linear velocity of 2 m/s, and maximum angular velocity of pi/2 rad/s. The linear velocity along the y axis must be 0 m/s at all times. The hardware of this robot (that is, the simulated legs of the turtle) require Twist messages at a frequency of 5 messages per second.
Create a node navigation_node that subscribes to the topic /navigation_command to receive commands as they are generated. [2 marks]
The node must store every command received from the command generator in a local queue, and therefore guarantee that the message queue never overflows. [3 marks]
The node must execute every navigation command moving or turning the turtle by the required amount.
- Forward and backward [3 marks]
- Turn [3 marks]
Implement all commands with a PD controller (disregard the integral component), so that the commands are executed more precisely, without any drift characteristic of open-loop control. [7 marks]
欢迎关注我公众号:AI悦创,有更多更好玩的等你发现!
公众号:AI悦创【二维码】
AI悦创·编程一对一
AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh
C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh
方法一:QQ
方法二:微信:Jiabcdefh
- 0
- 0
- 0
- 0
- 0
- 0