-
-
Couldn't load subscription status.
- Fork 6.9k
-
Hi guys I am very new to this field and I came across this repo and it seems very helpful. I am trying to make a homemade roomba based on the turtlebot3 platform. I found this repo has a grid based sweep algorithm which is great for my use case. I kind of a newb so I wondering how I can implement the algorithm into a workspace and test it out with RVIZ and gazebo. I found another repon on github which is doing something very similar to what I am trying to implement but has no sweep algorithms, only p2p (https://github.com/SakshayMahna/Robotics-Playground/tree/main/turtlebot3_ws) if anyone with some experience could help me out, I would be very grateful. Thanks. (email: zeyadkhodeir@gmail.com)
Beta Was this translation helpful? Give feedback.
All reactions
Hello @ZKhodeir!
It sounds like you're diving into an exciting project, and it’s great that you're using the TurtleBot3 platform! To help you implement the grid-based sweep algorithm into your workspace and test it in RViz and Gazebo, I'll break it down into a few key steps:
1. Set up your TurtleBot3 Workspace
If you haven’t done so already, you need to set up your ROS workspace where you will integrate the code. Here's how you can do that:
-
Install ROS: Make sure you have ROS installed on your system. TurtleBot3 typically uses ROS Melodic or Noetic, so make sure to follow the correct setup instructions for your ROS version.
- For ROS Melodic: [Installation guide](http://wiki.ros.org/melo...
Replies: 1 comment 4 replies
-
Hello @ZKhodeir!
It sounds like you're diving into an exciting project, and it’s great that you're using the TurtleBot3 platform! To help you implement the grid-based sweep algorithm into your workspace and test it in RViz and Gazebo, I'll break it down into a few key steps:
1. Set up your TurtleBot3 Workspace
If you haven’t done so already, you need to set up your ROS workspace where you will integrate the code. Here's how you can do that:
-
Install ROS: Make sure you have ROS installed on your system. TurtleBot3 typically uses ROS Melodic or Noetic, so make sure to follow the correct setup instructions for your ROS version.
- For ROS Melodic: [Installation guide](http://wiki.ros.org/melodic/Installation)
- For ROS Noetic: [Installation guide](http://wiki.ros.org/noetic/Installation)
-
Set up the TurtleBot3 packages:
Clone the TurtleBot3 repo and install the necessary dependencies:mkdir -p ~/turtlebot3_ws/src cd ~/turtlebot3_ws/src git clone https://github.com/ROBOTIS-GIT/turtlebot3.git cd .. rosdep install --from-paths src --ignore-src -r -y catkin_make source devel/setup.bash
2. Download the Grid Sweep Algorithm Repo
You mentioned that you’ve found a repo with a grid-based sweep algorithm. Assuming you have already cloned it, you’ll want to put it inside your workspace:
-
Go to the
srcfolder of yourturtlebot3_wsworkspace:cd ~/turtlebot3_ws/src git clone <url-of-sweep-algorithm-repo>
-
Once you’ve added the repo, make sure the code is properly integrated into the workspace. You may need to build it using
catkin_make:cd ~/turtlebot3_ws catkin_make source devel/setup.bash
3. Set Up RViz and Gazebo
-
RViz: RViz is a great tool to visualize your robot's state and sensor data (e.g., LiDAR, camera feeds). To run RViz with your TurtleBot3:
roslaunch turtlebot3_bringup turtlebot3_robot.launch roslaunch turtlebot3_rviz_launchers view_navigation.launch
This will start RViz with the necessary configurations for your TurtleBot3 model.
-
Gazebo: To simulate your TurtleBot3 in Gazebo, you can use:
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
This launches an empty world in Gazebo where you can test the robot. If you want a world with obstacles, there are other
.launchfiles available in the TurtleBot3 Gazebo package, liketurtlebot3_world.launch.
4. Integrating the Sweep Algorithm
-
Look through the code in the grid-based sweep repo. The algorithm might involve controlling the robot's movement in a grid pattern, using a combination of move commands and sensor feedback (e.g., LiDAR or ultrasonic).
-
Adapt the Grid Sweep Code:
- Check if the algorithm has a main control loop (probably a Python or C++ file). You may need to adapt it to control the robot's movement in the simulation or on real hardware.
- Modify or connect the algorithm to move the TurtleBot3 via topics such as
/cmd_vel, which controls the robot's velocity. This may require creating a ROS node that listens to the robot's sensor data (for example, distance sensors or LiDAR) and publishes movement commands based on the grid sweep logic.
5. Testing the Algorithm in Gazebo
Once you've integrated the algorithm, you can launch your Gazebo simulation and test it:
-
Start the Gazebo simulation (
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch). -
Start your grid sweep algorithm node in the same terminal:
rosrun <your_package> <your_sweep_algorithm_node>
-
You should be able to watch the robot's movement in Gazebo. Use RViz to visualize sensor data and the robot's position. The grid-based sweep algorithm should move the robot in a grid pattern within the simulation.
6. Debugging and Refinement
-
If the robot isn’t behaving as expected, check:
- ROS logs (
roslaunchorrosrunoutputs). - The sensor data in RViz to ensure the robot is receiving and processing information correctly.
- Test smaller components of the code (e.g., does the robot move when you manually send commands?).
- ROS logs (
-
If needed, you can adjust the algorithm’s parameters (e.g., speed, grid size) and tweak it to work better in simulation.
7. Final Testing
Once the algorithm is working well in Gazebo and RViz, you can start thinking about deploying it on a real TurtleBot3, but that's another step. For now, Gazebo should give you a good environment to test and fine-tune the behavior.
Some Resources:
- [TurtleBot3 Documentation](https://emanual.robotis.com/docs/en/platform/turtlebot3/)
- [ROS Wiki](http://wiki.ros.org/)
- Tutorials for RViz and Gazebo simulations: [RViz tutorial](http://wiki.ros.org/rviz/Tutorials), [Gazebo tutorial](http://gazebosim.org/tutorials)
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Hi Farid!
Thank you for this extremely helpful response. I appreciate it a lot. I have explored things a bit over the past month, and I have reached a very comfortable level. I adapted a python algorithm that does some heuristic calculations adapted from A* to make a complete coverage path plan, including obstacles and any arbitrary map shape. I built upon it further. Now the code can take any PGM file, like the one scanned by tb3 lidar and turns it into a format that can be interpreted by the algorithm. The algorithm also creates an array of xy coordinates that will be hopefully sent to the turtlebot and tell it where to go (a bit like step 4 in your reply). What i am struggling with figuring out now, is creating a publish subscribe node for sending the coordinates to the bot and then telling it what motor movements to make to reach the positions. If you know of any existing repos that achieve this function or have any thoughts on how to build this part, I would be very grateful. And thanks again for this wonderful response from your end. Hope you have a wonderful day!
Beta Was this translation helpful? Give feedback.
All reactions
-
That is great. And Please can you accept the previous response as an answer. Thanks !
For further help and examples, you can check these repositories:
TurtleBot3 Navigation Stack – A more complete example for autonomous navigation with TurtleBot3.
TurtleBot3 ROS – The official TurtleBot3 repo, which includes examples of controlling the robot using cmd_vel.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you Ferid!
Sorry I am new to Github so I don't know how things work on here. I accepted the answer. Thanks a lot for all your help
Beta Was this translation helpful? Give feedback.
All reactions
-
No problem. Good luck. If you want we can follow each other
Beta Was this translation helpful? Give feedback.