Skip to content

wyqsnddd/panda_cnoid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

panda_cnoid

This repository contains the necessary VRML and cnoid project file to run panda simulation with Choreonoid and mc_openrtm.

The project takes care of:

  • installing the VRML model of the panda robot
  • generate an URDF file from the panda xacro file
  • install a JSON RobotModule for mc_rtc
  • install a robot alias for mc_rtc
  • install a Choreonoid project suitable for mc_openrtm control

The URDF model for Panda was taken from franka_gazebo which is a dependency of this project. The VRML model was converted using simtrans and restoring joint axis to the URDF ones.

Dependencies

Install

mkdir build
cd build
cmake ../
make
sudo make install

Usage

Edit your mc_rtc configuration so that MainRobot is panda

Adding a new panda variant

  1. Create a new xacro file for your panda extension

An example is given in xacro/panda_arm_foot.urdf.xacro. In that particular case we are putting a specific end-effector on the panda arm so the xacro file itself includes the panda arm xacro file for franka_gazebo.

Things to note:

  • that particular file uses an extra xacro file (xacro/foot.xacro), we will see how to handle this in the next step;
  • we use CMake specific variables (e.g. @CMAKE_BINARY_DIR@ or @MESHES_DESTINATION@) in those file because we are not building a catkin package.
  1. Create an mc_rtc YAML RobotModule and aliase

Simply copy the existing models in the repository.

  1. Append the relevant data to CMakeLists.txt

This will ensure that the URDF model is generated from your xacro file and that the robot model and aliases are generated.

Here is the relevant snippet for panda_arm_foot

configure_file("xacro/foot.xacro" "${CMAKE_BINARY_DIR}/xacro/foot.xacro" @ONLY)
install(FILES xacro/meshes/foot.stl DESTINATION "${MESHES_DESTINATION}")
GENERATE_ROBOT("xacro/panda_arm_foot.urdf.xacro" "panda_foot" "${CMAKE_BINARY_DIR}/xacro/foot.xacro")

The first two lines take care of generating the intermediary xacro file we need and to install the extra mesh we have added.

The last line is generating the robot URDF and the relevant files for mc_rtc. The first two arguments are mandatory, they provide the main xacro file used to generate the urdf and the robot name. Extra arguments are provided to specify extra dependencies on the URDF generation.

  1. Generate a VRML model

This requires simtrans and a generated URDF file.

Go into the model/panda folder and run the following:

simtrans -i /path/to/your/panda.urdf -o panda_arm_myvariant.wrl

You then need to edit panda_arm_myvariant.wrl to:

  • modify jointId entries so that panda_joint1 has id 0, panda_joint2 has id 1 and so-on (up-to panda_joint7 or more if your own model has extra joints)
  • modify jointAxis to 0.0 0.0 1.0 for every joint from panda_joint1 to panda_joint7 as simtrans seems to get those wrong (if your model includes extra joints you might need to check whether the axis are correctly defined by yourself)

You can check that your robot is displayed correctly by running choreonoid panda_arm_myvariant_project.cnoid. You can remove this file and panda_arm_myvariant_project.xml afterwards as those files are not required.

  1. Generate a cnoid project

First copy cnoid/panda_foot into cnoid/panda_myvariant. If you robot does not have extra joints that's probably enough.

If needed, here are the three files:

  • cnoid/panda_default/joint_positions.cnoid: the initial joint configuration for your robot; DO NOT CHANGE THE INDENT IN THIS FILE
  • cnoid/panda_default/PDcontroller.conf.choreonoid: configuration file for the PDcontroller component, you only need to edit pdcontrol_tlimitratio to match your number of joints (including mimics)
  • cnoid/panda_default/PDgains_sim.dat: PD gains for the PDcontroller component; there should be one entry per joint

Once these files are correct, you can append the following to CMakeLists.txt:

GENERATE_CNOID_PROJECT(panda_myvariant panda_arm_myvariant)

About

VRML and project files to run simulation with a panda robot in Choreonoid

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 67.8%
  • CMake 30.9%
  • Shell 1.3%