You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In new terminal paste the following commmands one-by-one
git clone https://github.com/akshat0605/ros_ws.git
# Go to home directorycd ros_ws
# Build the workspace
colcon build
# Source the setup file to use built packagessource install/setup.bash
export GZ_SIM_RESOURCE_PATH=$HOME/ros_ws/src/gazebo_models
Once the build is successful, enter the following commands in the same terminal.
# Launch the robot simulation
ros2 launch bme_ros2_navigation spawn_robot.launch.py
If the simulation is launched witout any error, go to a new terminal and type the following commands:
# Run teleoperation node to control robot
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Creating a package in ros2
#Go to the home directory:cd# Create new workspace for custom packages
mkdir -p colcon_ws/src
cd~/colcon_ws/src
# Create C++ and Python ROS2 packages
ros2 pkg create my_cpp_pkg --build-type ament_cmake --dependencies rclcpp
ros2 pkg create my_python_pkg --build-type ament_python --dependencies rclcpy
# Build the workspace and source itcd~/colcon_ws
colcon build
source install/setup.bash
Task:
Add Launch and Node Files
# Navigate to your new Python packagecd~/colcon_ws/src/my_python_pkg
# Create a launch directory
mkdir launch
# Copy launch and node files from Downloads/src
cp -r $HOME/ros_ws/src/talker_listener.launch.py ~/colcon_ws/src/my_python_pkg/launch/
cp -r $HOME/ros_ws/src/talker.py ~/colcon_ws/src/my_python_pkg/my_python_pkg/
cp -r $HOME/ros_ws/src/listener.py ~/colcon_ws/src/my_python_pkg/my_python_pkg/
Update setup.py. Replace contents of setup.py with: