ros2.robot.arm.package.mov
- Ensure you have ROS2 Foxy installed on your system, and install the necessary dependencies:
sudo apt update
sudo apt install ros-foxy-ament-cmake ros-foxy-urdf ros-foxy-rviz2 ros-foxy-robot-state-publisher ros-foxy-joint-state-publisher ros-foxy-joint-state-publisher-gui
- Source ROS 2 environment:
source /opt/ros/foxy/setup.bash
- Create a new directory:
mkdir -p ~/ros2_ws/src cd ~/ros2_ws/src
- Initialize the workspace:
colcon build source install/setup.bash
- Clone the repository:
cd ~/ros2_ws/src git clone https://github.com/smart-methods/arduino_robot_arm.git
- Copy the URDF and mesh files:
mkdir -p ~/ros2_ws/src/robot_arm_package/urdf mkdir -p ~/ros2_ws/src/robot_arm_package/meshes cp ~/ros2_ws/src/arduino_robot_arm/robot_arm_pkg/urdf/arduino_robot_arm.urdf ~/ros2_ws/src/robot_arm_package/urdf/ cp -r ~/ros2_ws/src/arduino_robot_arm/robot_arm_pkg/meshes/* ~/ros2_ws/src/robot_arm_package/meshes/
- 🔗 URDF File: The URDF file describing the robot model.
- Update the
CMakeLists.txt
andpackage.xml
files:- 🔗 CMakeLists.txt: The CMake configuration file for this package.
- 🔗 Package.xml: The package file.
- Create Launch File to visualize the robot in RViz:
cd ~/ros2_ws/src/robot_arm_package
mkdir -p launch
nano launch/display.launch.py
- 🔗 Launch File: The launch file to start the robot visualization.
- Build the workspace:
cd ~/ros2_ws
colcon build
- Source the setup file:
source install/setup.bash
- Launch the URDF:
ros2 launch robot_arm_package display.launch.py
-
Set the "Fixed Frame":
- In RViz, go to the "Global Options" section in the "Displays" panel on the left.
- Set the "Fixed Frame" to
base
.
-
Add a "RobotModel" Display:
- In the "Displays" panel, click the "Add" button at the bottom.
- In the "By display type" tab, select "RobotModel" and click "OK".
- Set the "Description Topic" to
/robot_description
.
- Using the Joint State Publisher GUI
ros2 run joint_state_publisher_gui joint_state_publisher_gui