ori-drs / quadruped_robcogen

RobCoGen code generator for any quadruped robot from the xacro description
BSD 3-Clause "New" or "Revised" License
13 stars 5 forks source link

Moving on from kindsl & dtdsl #1

Open dlee640 opened 3 years ago

dlee640 commented 3 years ago

Hello. First of all, thank you for open sourcing your work. ori-drs github page has always been a good resource to learn from. I am working with quadruped called A1 (made by chinese company called Unitree Robotics), and I am trying to generate c++ robogen code to enable state estimation for the robot. (I plan on moving to pronto_anymal example after figuring this out).

Basically, I am trying to create 'a1_robcogen', as shown in this example with anymal.

I had to take a slightly different approach, since I already had URDF file provided by the company, so I could skip the first step where I needed to convert xacro to URDF. (This was going to be problmetic for me since the robot model was split into multiple xacro files. Therefore having the URDF file ready became handy)

I was able to run $ rosrun quadruped_robcogen urdf2kindsl.py /home/dlee640/robcogen_ws/src/quadruped_robcogen/external/urdf2kindsl/a1.urdf --output='a1.kindsl' and successfully obtain a1.kindsl file. (I won't attach it since the code is quite lengthy. If you want to see it, however, please let me know.)

I have 2 questions now:

  1. There was no instruction on how to write/generate dtdsl file, so I used example from anymal. The code looked generic for any quadruped, so I just changed the Robot name. Does this dtdsl file look correct?
    
    Robot a1_description

Frames { fr_base, imu_link, LF_FOOT, RF_FOOT, LH_FOOT, RH_FOOT }

Transforms { fr_base <- LF_FOOT fr_base <- RF_FOOT fr_base <- LH_FOOT fr_base <- RH_FOOT imu_link <- LF_FOOT imu_link <- RF_FOOT imu_link <- LH_FOOT imu_link <- RH_FOOT }

Jacobians { base = fr_base target = LF_FOOT base = fr_base target = RF_FOOT base = fr_base target = LH_FOOT base = fr_base target = RH_FOOT base = imu_link target = LF_FOOT base = imu_link target = RF_FOOT base = imu_link target = LH_FOOT base = imu_link target = RH_FOOT
}


2. Now, I need to use these two files (a1.dtdsl & a1.kindsl) to generate robcogen c++ folder that looks like ['anymal_robcogen' in this link](https://github.com/ori-drs/pronto_anymal_example/tree/master/anymal_robcogen). **Can you please guide me to next step?** I see that there are four executables - generate_catkin_pkg.sh, robcogen.sh, generate_cpp.sh, and urdf2kindsl.py - under the quadruped_robcogen package. Which one do I need to use and how? Your documentation is good, its just that since I am not starting from xacro file, I do need some guidance on only executing the final step.

Your help would be much appreciated. Thank you.
nimesh00 commented 3 years ago

Assuming you have installed all the dependencies, run the following series of commands to generate the robcogen catkin package as well as the cpp files. Make sure you keep the feet names as in the quadruped_robcogen/config/robot.dtdsl file. Also, make sure that you have a separate base_inertia link and also an imu_link. (Replace all the instances of ROBOT below with the name of your own robot) cd ~/catkin_ws/ catkin build ROBOT_description cd src rosrun quadruped_robcogen generate_catkin_pkg.sh ROBOT cd .. && catkin build ROBOT_robcogen cd src rosrun quadruped_robcogen generate_cpp.sh ROBOT ROBOT_robcogen

nimesh00 commented 3 years ago

Also, since you do not have a xacro file, just include that urdf file in a xacro file with required name. It will make things easier. Take a look at files at: https://github.com/ori-drs/pronto_anymal_example/tree/master/anymal_b_simple_description/urdf as example on how to include urdf file in xacro file.

Kwach00 commented 1 year ago

Hello! I'm in similar situation, I have custom quadruped robot urdf file. I take care of separate dummy base_inertia link, imu link and naming feet according robot.dtdsl file. What is more I have xacro file in which I include robot's urdf file.

I'm running the commands you recommended @nimesh00, and everything works to the point when I should build generated robcogen package catkin build ROBOT_robcogen (ofc I'm changing ROBOT for my robot name). Here I got error:

c++: error: /home/chris/pronto_test_ws/mab_pronto_ws/src/hb40_robcogen/src/transforms.cpp: No such file or directory
c++: fatal error: no input files
compilation terminated.
make[2]: *** [CMakeFiles/hb40_robcogen.dir/build.make:88: CMakeFiles/hb40_robcogen.dir/src/transforms.cpp.o] Error 1

Did you ever encounter this problem? Do you have any recommendation?

nimesh00 commented 1 year ago

Is the command rosrun quadruped_robcogen generate_catkin_pkg.sh ROBOT completing successfully? Please share the output of this command here (remove the ROBOT_robcogen package before this for a fresh start). The error means that the files that are supposed to be created from this command have not been created.

Kwach00 commented 1 year ago

That's my output:

rosrun quadruped_robcogen generate_catkin_pkg.sh hb40
WARNING: missing optional argument ROBOT_DESCRIPTION_PKG_NAME.
Using default: hb40_description
WARNING: missing optional argument ROBOT_XACRO_NAME.
Using default: hb40
WARNING: missing optional argument LICENSE.
Using default: Proprietary
Creating package "hb40_robcogen" in "/home/chris/pronto_test_ws/mab_pronto_ws/src"...
Created file hb40_robcogen/package.xml
Created file hb40_robcogen/CMakeLists.txt
Successfully created package files in /home/chris/pronto_test_ws/mab_pronto_ws/src/hb40_robcogen.
Kwach00 commented 1 year ago

There is still one thing I don't understand. My error after running catkin build ROBOT_robcogen says there is no src/transforms.cpp file, but script generate_catkin_pkg.sh is not generating any files in src folder. There is just almost empty ROS package. So how does the catkin command know it should look for that specific file, do you have any ideas @nimesh00 ?

nimesh00 commented 1 year ago

Actually I was trying to generate these files last time you posted but the same problem was happening with me as well (files not generating). It was really weird as I had recently generated these files for a custom quadruped URDF successfully. I'll try getting back to it again and update you if I figure out anything.

nimesh00 commented 1 year ago

Hi @Kwach00, I debugged this again recently when I had to generate robcogen files for another robot. This error occured for me again because maxima was not installed on my system. Maybe that was the issue in your case as well?