This is my first script to practice C++ with ROS (Melodic), using turtlesim
The purpose of the script is to to control turtlesim through C++, implementing the following functions
- Specify movement and direction to turtle
- Specify a specific spot (goal) the turtle should go to
To use:
- Put entire content inside <catkin_workspace>/src/turtlesim_runner
- Run catkin_make on <catkin_workspace>
- To run the script, you may need to first do source devel/setup.bash
- Run roscore, turtlesim_node then script, which is rosrun turtlesim_runner runner
- Follow script prompts
As of V1.2, the code is
- A turtle class which holds the turtle's current pose (coordinates & orientation)
- move() function which publishes commands to /turtle1/cmd_vel using geometry_msg/Twist
- Subscribing to turtlesim/Pose to obtain current pose (location and orientation) of the turtle, this allows one to determine the distance and angle to turn, and can use move() to get to the goal
- Almost Linear Time-Invariant (LTI), smoothmove() allows it to achieve an accuracy up to the error threshold from user.
TODO:
- Make move() LTI as well.
History & Changelog: V1.2
- Made new smoothmove() for travelling to specific spot function
- smoothmove() is LTI, can achieve accuracy up to error threshold from user
- Implemented a Proportional controller for smoothmove()
V1.1
- Turtle Class made
- Code block comments in runner.cpp removed
V1
- move() function which publishes commands to /turtle1/cmd_vel using geometry_msg/Twist
- Using time based approach for easier implementation, however results in an error of about 0.3m
- Subscribing to turtlesim/Pose to obtain current pose (location and orientation) of the turtle, this allows one to determine the distance and angle to turn, and can use move() to get to the goal