Skip to content

This project demonstrates the simulation of a Fanuc CRX10IA/L robotic arm using ROS2 Humble and MoveIt2. The task involved moving the robotic arm from point A to point B using a straight-line trajectory.

Notifications You must be signed in to change notification settings

aaqibmahamood/Fanuc-CRX-10iA-L-Collaborative-Robot---Trajectory-using-Moveit2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simulate Fanuc CRX10ia/L using ROS2 Humble and MoveIt2

cover.png

ubuntu ROS MoveIt2

Clone and Launch Simulation

If you wish to clone and launch the simulation, follow these steps:

  1. Create a workspace
mkdir -p ~/fanuc_ws/src
cd ~/fanuc_ws/src
  1. Clone the repository
git clone https://github.com/aaqibmahamood/Fanuc-CRX-10iA-L-Collaborative-Robot---Trajectory-using-Moveit2.git
  1. Build the workspace
cd ~/fanuc_ws
colcon build
  1. Source the workspace
source install/setup.bash
  1. Launch the simulation - Start Move Group
ros2 launch crx10ia_l__moveit_config move_group.launch.py
  1. In a new terminal, launch RViz
source ~/fanuc_ws/install/setup.bash
ros2 launch crx10ia_l__moveit_config moveit_rviz.launch.py
  1. In another terminal, run the trajectory
source ~/fanuc_ws/install/setup.bash
ros2 launch moveit2_scripts test_trajectory.launch.py

FANUC ROS2 Driver Installation

manual.png

overview.png

Prerequisites

Before proceeding with the installation, ensure your system meets the following requirements:

  1. Update System Packages
sudo apt update && sudo apt upgrade -y
  1. Install ROS2 Humble Packages
sudo apt install -y \
ros-humble-desktop \
ros-humble-rviz \
ros-humble-control-msgs \
ros-humble-sensor-msgs
  1. Source ROS2 Setup
source /opt/ros/humble/setup.bash
  1. Install Dependencies
sudo apt install libmodbus-dev libjsoncpp-dev

Install FANUC ROS2 Driver

  1. Extract Driver Files

    • Unzip the installation file (install_humble_jammy.zip) to your Ubuntu PC
    • ⚠️ CAUTION: Do not place in your colcon workspace
  2. Set Required Permissions

chmod u+x {driver_location}/fanuc_ros2_driver/lib/f
chmod u+x {driver_location}/_local_setup_util_sh.py
  1. Add to ROS Path

    If using packages only under /opt/ros/* without colcon workspace:

source install/local_setup.bash

Table of Contents

0. Quick Start

Tested on Ubuntu 22.04 LTS with ROS2 Humble.

  1. Update System
sudo apt update && sudo apt upgrade -y
  1. Install ROS2 Humble Packages
sudo apt install -y \
ros-humble-desktop \
ros-humble-rviz \
ros-humble-control-msgs \
ros-humble-sensor-msgs
  1. Source ROS2 Setup
source /opt/ros/humble/setup.bash

1. ROS Setup

Install Core Dependencies

sudo apt install libmodbus-dev libjsoncpp-dev

Install MoveIt2

sudo apt update
sudo apt install -y ros-humble-moveit ros-humble-moveit-resources
sudo apt install -y python3-colcon-common-extensions build-essential

2. Workspace Preparation

Create Workspace

mkdir -p ~/fanuc_ws/src
cd ~/fanuc_ws
colcon build

Add CRX Description Files

# Option 1: Copy local files
cp -r /path/to/crx_description ~/fanuc_ws/src/

# Option 2: Clone Repository
git clone https://github.com/aaqibmahamood/Fanuc-CRX-10iA-L-Collaborative-Robot---Trajectory-using-Moveit2.git
cd fanuc_ws
cd src
cd crx_description

3. MoveIt2 Configuration

Launch MoveIt Setup Assistant

source /opt/ros/humble/setup.bash
ros2 launch moveit_setup_assistant setup_assistant.launch.py

Configuration Steps

  1. Load URDF
  • Browse and select crx10ia_l.urdf.xacro
  1. Self-Collision Matrix
  • Generate Collision Matrix collision_matrix.png
  1. Virtual Joints
  • Create Joint:
  • Name: world_base
  • Parent Frame: world
  • Child Link: base_link
  • Type: fixed virtual_joints.png
  1. Planning Groups
  • Group Name: manipulator
  • Kinematics Plugin: KDLKinematicsPlugin
  • Base Link: base_link
  • Tip Link: flange planning_groups.png
  1. Robot Poses
  • Add home pose for manipulator group

MoveIt2 Configuration - Home Robot Pose

home.mp4
  1. End Effector
  • Name: end_effector
  • Group: manipulator
  • Parent Link: flange end_effector.png
  1. Define Passive Joints
    passive_joints.png

  2. Generate and Save the MoveIt Package
    author.png generate.png

4. Trajectory Planning Package

Create MoveIt2 Scripts Package

cd ~/fanuc_ws/src
ros2 pkg create moveit2_scripts --build-type ament_cmake \
--dependencies rclcpp moveit_ros_planning_interface

Create Trajectory Script

src/test_trajectory.cpp:

#include <rclcpp/rclcpp.hpp>
#include <moveit/move_group_interface/move_group_interface.h>

int main(int argc, char** argv) {
    rclcpp::init(argc, argv);
    auto node = rclcpp::Node::make_shared("test_trajectory");
    
    moveit::planning_interface::MoveGroupInterface move_group(node, "manipulator");

    // Plan to a target pose
    geometry_msgs::msg::Pose target_pose;
    target_pose.orientation.w = 1.0;
    target_pose.position.x = 0.28;
    target_pose.position.y = -0.2;
    target_pose.position.z = 0.5;

    move_group.setPoseTarget(target_pose);
    
    auto success = (move_group.plan() == moveit::planning_interface::MoveItErrorCode::SUCCESS);
    
    if (success) {
        RCLCPP_INFO(node->get_logger(), "Planning successful. Executing...");
        move_group.move();
    } else {
        RCLCPP_WARN(node->get_logger(), "Planning failed.");
    }

    rclcpp::shutdown();
    return 0;
}

Launch File

launch/test_trajectory.launch.py:

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(
            package='moveit2_scripts',
            executable='test_trajectory',
            output='screen',
        )
    ])

5. Build and Run

Build Workspace

cd ~/fanuc_ws
colcon build --symlink-install
source install/setup.bash

Run Simulation

  1. Start Move Group - Terminal 1
ros2 launch crx10ia_l__moveit_config move_group.launch.py
  1. Launch RViz - Terminal 2
source ~/fanuc_ws/install/setup.bash
ros2 launch crx10ia_l__moveit_config moveit_rviz.launch.py

rviz.png

Plan a trajectory to the home position.

home.png

  1. Execute Trajectory - Terminal 3
source ~/fanuc_ws/install/setup.bash
ros2 launch moveit2_scripts test_trajectory.launch.py

6. Video Demonstrations

Trajectory Execution

trajectory.mp4

Troubleshooting

  • Ensure ROS2 Humble is correctly installed
  • Verify all dependencies are met
  • Check URDF and MoveIt configuration files

Contributing

Contributions are welcome! 🤖

Your stars, forks, and PRs are appreciated!

About

This project demonstrates the simulation of a Fanuc CRX10IA/L robotic arm using ROS2 Humble and MoveIt2. The task involved moving the robotic arm from point A to point B using a straight-line trajectory.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published