/freecad.robotcad

RobotCAD is a FreeCAD workbench to generate robot description packages for ROS2 (URDF) with launchers to Gazebo and RViz.

Primary LanguagePythonGNU Lesser General Public License v2.1LGPL-2.1

RobotCAD

RobotCAD is a FreeCAD workbench to generate robot description packages (xacro or URDF) for the Robot Operating System, ROS2. RobotCAD also known as OVERCROSS.

RobotCAD video teaser Workflow video

Key features short list:

  1. Autoinstall and run by startup script
  2. Modeling parts (in FreeCAD),
  3. Creating robot structure (joints, links, elements of link (Collisions, Visuals, Reals), etc),
    1. Automatic creating full robot structure by selected objects (links in joints will have order of objects selection)
    2. Automatic creating links by selected objects
    3. Automatic creating joints by selected links
  4. Š”onvenient new tools to set placement of joints and links (intuitive way)
    1. Set placement just by selecting faces of links and it will automatically connected
    2. Joint placement rotation tools
    3. Tools for set placement of joints based on LCS or other orienteers.
  5. Material setting (from library or custom) to link or whole robot
  6. Automatic calculation (based on material or custom mass):
    1. mass and inertia
    2. center of mass (in global and local coordinates)
    3. positions of joints relative to the robot's center of mass
  7. Collisions automatic making tools (based on Real element of robot link)
  8. Basic code generator:
    1. ROS2 package with launchers for Gazebo, RViz
    2. URDF
    3. Meshes
  9. Tool for use external extended code generating service (startup script, docker, multicopters)
    1. External code generator:
      1. all of basic code generator
      2. Project structure
      3. Startup script for build and run docker container with all dependencies of project
      4. Init Git with submodules for dependencies management
      5. Docker related code (dockerfiles, etc) (you dont need to manually install ROS2 or Gazebo, it will be installed automatically in docker)
      6. Specific robot types code (multicopter - PX4 + Gazebo + ROS2)
      7. Nvidia video cards container support
      8. README instruction how to use
  10. all features from CROSS workbench

Fast install and run

If you have docker (buildx, compose plugins) installed just do

git clone https://github.com/drfenixion/freecad.robotcad.git
cd freecad.robotcad/docker
bash run.bash

Tested on Ubuntu 22.04.

In case of start issue (transfer from 3.0.0 to next version may need "-f") recreate container by

bash run.bash -f

If docker is not installed look at docker/README.md. There is also additional information on how to use the startup script.

You also can install RobotCAD manually (long way) by Installation section

Screenshots

Launched RViz and Gazebo using generated code:

RViz RViz

Gazebo - Basic view basic

Gazebo - Joints view joints

Gazebo - Collisions view collision

Gazebo - Inertia view inertia

One more robot

Choosing of material of robot or link Choosing of material of robot or link

Generated ROS 2 package

Generated ROS 2 package

Launched Rviz and Gazebo from generated Gazebo launcher Launched Rviz and Gazebo from gazebo launcher

Generated inertia blocks and centers of mass in Gazebo Generated inertia blocks and centers of mass in Gazebo

Generated collisions in Gazebo Generated collisions in Gazebo

Usage

Common usage plan

Description

RobotCAD is a powerful ROS workbench for FreeCAD, a popular open-source 3D parametric modelling software. As the field of robotics continues to evolve rapidly, the need for comprehensive and efficient tools for robot development and simulation has become increasingly essential. RobotCAD emerges as a versatile solution, empowering engineers, researchers, and hobbyists to leverage the capabilities of both ROS and FreeCAD in a cohesive environment. At the time of writing (June 2023), RobotCAD is the only available open-source solution to generate robot description files for ROS with a graphical user interface with direct visual feedback.

With RobotCAD, users gain the ability to combine the flexibility of FreeCAD's 3D modeling capabilities with the extensive functionality of ROS, allowing for seamless collaboration between mechanical design and robotics development. By bridging the gap between these two powerful platforms, RobotCAD streamlines the process of designing, and visualizing robotic systems, ultimately accelerating the development cycle.

The key features of RobotCAD are:

  • ROS Integration: RobotCAD offers native integration with ROS, an open-source framework widely adopted in the robotics community. This integration enables users to leverage the vast ecosystem of ROS packages, libraries, and tools while working within the familiar FreeCAD environment.
  • 3D Modelling and Simulation: FreeCAD's 3D modelling capabilities empower users to design intricate mechanical components and complete robot systems. With RobotCAD, these designs can be seamlessly integrated with ROS simulations, allowing for realistic and accurate testing of robot behaviors and interactions.
  • Visualization and Analysis: RobotCAD provides advanced visualization and analysis tools provided by FreeCAD itself, enabling users to inspect, analyze, and validate their robot designs.
  • Collaborative Development: RobotCAD supports collaborative development by facilitating the sharing of robot models through the use of complex macro written in the Python language where a full robot can be generated by code. This encourages teamwork, knowledge sharing, and accelerates the pace of innovation within the robotics community.
  • Extensibility: As an open-source project, RobotCAD encourages contributions from the community, allowing users to extend its functionality and adapt it to their specific needs. By leveraging the collective expertise of the ROS and FreeCAD communities, RobotCAD continues to evolve and provide cutting-edge features for robot development.

Compatibility

Compatible with FreeCAD at least v0.21.2. Compatible with ROS2.

Features

  • Export Part::Box, Part::Sphere, and Part::Cylinder as text to be included in a URDF file,
  • Generate an enclosing box or sphere as collision object (only axis-aligned box for now),
  • Build a robot from scratch and generate the URDF file for it,
  • Set a value for each actuated joint of a robot and have the links move accordingly,
  • Import URDF/xacro files,
  • Import xacro definitions, i.e. import xacro files that only define some macros and ask the user to choose a macro and its parameters to generate a full-feature URDF,
  • Export the xacro as xacro that includes (xacro:include) the original xacro file and uses the macro.
  • Combine several xacros files (i.e. also URDF) into a workcell and export them as a xacro file.
  • Get the current planning scene (relies on the /get_planning_scene service of type moveit_msgs/srv/GetPlanningScene)
  • Define a pose and possibly bring a specific link to it. All links that are fixed to this link will follow but the inverse kinematic solutions are not shown.

Installation

You need a recent version of FreeCAD v0.21.2 with the ability to configure custom repositories for the Addon Manager to install the workbench via the Addon Manager. On earlier version you're on your own, see instructions for local install below.

  • In FreeCAD, menu "Edit / Preferences ..."
  • Category "Addon Manager"
  • Add an entry to "Custom repository" by clicking on the "+" sign.
  • Repository URL: https://github.com/drfenixion/freecad.robotcad.git, branch: main
  • Click on "OK" to close the dialog "Preferences"
  • Back to FreeCAD's main window, menu "Tools / Addon manager"
  • Search and install the workbench via the Addon Manager

Launching FreeCAD with ROS

The RobotCAD workbench is supposed to load also without ROS, with limited functionality. If this is not the case, please report.

You will probably want to be able to use ROS-related functionalities and this requires launching FreeCAD from the command line:

  • Install all RobotCAD dependencies by install RobotCAD dependency meta package
  • sudo apt-get update
  • cd docker/ros2_ws/ && rosdep update && rosdep install -y -r -q --from-paths src --ignore-src --rosdistro ${ROS_DISTRO}
  • . /install/setup.bash

(Optional) You can also set extra Python modules

  • Open a terminal
  • Source your ROS workspace
  • Launch FreeCAD with extra Python modules set by ROS, freecad --module-path ${PYTHONPATH//:/' --module-path '} (replace freecad by your FreeCAD executable). This bash magic will add for example --module-path path1 --module-path path2 if $PYTHONPATH is path1:path2.

Testing/developing the workbench

If you want to work on this workbench you have the following options (choose one):

  • Run RobotCAD by fast run script with -d flag. You need to remove RobotCAD docker container first if it was created before without -d flag. You can do remove old container and run with debug by -fd flags. After that you will able to use VSCODE debugger.
git clone https://github.com/drfenixion/freecad.robotcad.git
cd freecad.robotcad/docker
bash run.bash -d
  • Clone the repository directory in FreeCAD's Mod directory: cd ~/.local/share/FreeCAD/Mod && git clone https://github.com/drfenixion/freecad.robotcad.git on Linux
  • Start FreeCAD from the root-directory of this repository in a terminal (by default freecad.robotcad)
  • Clone this repository and create a symbolic link to the directory freecad.robotcad (or the directory containing this repository if you changed the name) to FreeCAD's Mod directory (~/.local/share/FreeCAD/Mod on Linux).
  • pip install -e . adds the root-directory to easy_install.path.

New code will not automatically load to FreeCAD. You should restart FreeCAD by bash run.bash -d command for getting affect of corrected code.