ROS2 Basics Python - Run examples & simulations locally

Hello everyone,

I am new to the ROS world and would like to know if there are some instructions on how to run the simulations and exercises contained in the Rosject and course locally (considering I already have ros2 and gazebo installed). I found a video but the file structure is different and ROS1 is used.

Thanks a lot in advance,

This is a bit complicated especially as you are new to ROS. Also, we don’t officially support it, and you will run into problems you will have to solve on your own.

That said, you can take some inspiration from this post.

Hi @jano7777777,

platform like ConstructSim on your local machine can be a bit tricky, but it’s definitely doable with some careful steps. While running them through ConstructSim is often smoother since it’s all set up and supported there, you can still give it a go locally since you’ve got ROS2 and Gazebo installed. Here’s a simplified guide on how to do it:

1. Get the Rosject Content

Start by grabbing the course or Rosject material. If there’s a Git repository or downloadable content, clone or download it to your computer. Make sure you’re picking up the ROS2-compatible stuff if it’s available.

2. Check the File Structure

Take a look at how the Rosject’s files are organized and compare that to the usual ROS2 workspace setup. Normally, in ROS2, you have something like this:

  • ~/ros2_ws/ (the main workspace folder)
    • src/ (where all your package folders live)
      • package_1/
      • package_2/
    • build/ (shows up after building)
    • install/ (after installation)
    • log/ (for log files)

If the Rosject’s layout is different, you’ll need to rearrange things to match this structure.

3. Update the Packages

Each package has a package.xml and a CMakeLists.txt file that need to be compatible with ROS2. These files are crucial as they talk about dependencies, how to build stuff, and more. There are some key differences here from ROS1, so be sure to make the necessary updates.

4. Build Your Workspace

Hop into your ROS2 workspace directory (~/ros2_ws/) and run:

bashCopy code

colcon build --symlink-install source install/setup.bash

This compiles everything and gets the environment ready.

5. Fire Up Gazebo and ROS2

For running a simulation, you generally open up Gazebo and kick off various ROS2 nodes, often using launch files. Like this:

bashCopy code

ros2 launch package_name launch_file.launch.py

6. Fix Up Launch Files

If the original stuff was in ROS1 (with .launch files), you’ll need to convert these to ROS2-style (.launch.py). The way you write these can be pretty different, so check out the ROS2 docs for help.

7. Test and Tinker

Run your simulations and exercises. If you bump into problems, whether they’re version mismatches or other quirks, you’ll have to do some debugging. The ROS2 documentation and online forums can be great for solutions and advice.

8. Sort Out Dependencies

The Rosject might need specific packages or tools that aren’t in your standard ROS2 setup. If that’s the case, install them using apt for general stuff or rosdep for ROS-related things.

9. Update Gazebo

Make sure your Gazebo version plays nice with the simulations. Update it or add any necessary plugins if needed.

Keep in mind, shifting projects from one environment (like ConstructSim) to another (your local setup) can have its challenges, so patience and a bit of trial and error will be your friends here!

Regards

Naren

To run ROSJect is straight forward (If you have ROS, Gazebo and all dependencies installed in Local Computer), just download the ROSJect, Unzip it, go to the workspace directory and build workspace, then you are good to go.

For running Course locally, I think you need to download the directory tree (Your ROS Workspace) from Online IDE.