robotics-upo / hunav_gazebo_wrapper

A ROS2 wrapper to use the HuNavSim with the Gazebo Simulator
MIT License
13 stars 9 forks source link

Creating custom human models #9

Open SadeepRathnayaka opened 4 days ago

SadeepRathnayaka commented 4 days ago

I have followed the PDF on creating custom human models and did all the things exactly. After that how can I set the skin number for that model and use the agents.yaml file to configure to use that model?

I would really appreciate if you could give further instructions on how to add that custom-made human agent to the gazebo simulation.

noeperez commented 3 days ago

Hello, to add new models is not very easy, but can be done. First, you need to place the model (.dae) in the directory /media/models. Then you need to modify the code of the function processXML() of the class WorldGenerator.cpp to add your new model, so it can be used in the agents.yaml file, and therefore added to the simulation.

SadeepRathnayaka commented 3 days ago

Hello,

I have followed exactly the same path you mentioned above. But still those human agents are not added to the simulation. I have used skin as 5 in agents.yaml file.

Also I have done following customizations. After that it worked but not always. Sometimes it works sometimes it doesn't.

Added the following code snippet in HuNavPlugin.cpp in hunav_gazebo_wrapper/src line 765.

case 5: actorPose.Pos().Z(0.40); break;

Added this line in actor_panel.cpp in hunav_rviz2_panel/src line 232

skin_combobox->addItem("Child");

Added this line in actor_panel.cpp in hunav_rviz2_panel/src line 1203

else if (aux.compare("Child") == 0) // added { person_skin = "package://hunav_rviz2_panel/meshes/child.dae"; return 5; }

Added this line in actor_panel.cpp in hunav_rviz2_panel/src line 1257

else if (skin == 5) { person_skin = "package://hunav_rviz2_panel/meshes/child.dae"; }

I only have a rough idea about what these codes and scripts are doing. But after doing those changes that custom model was spawned in the simulator. But for the same code, when I run it again sometimes that custom build human agent does not spawned.

noeperez commented 3 days ago

Hi! Most of the modifications you commented are related to the RViz panel. I would suggest you to forget about the panel for the moment and to try do to the required modifications in the WorldGenerator and the HuNavPlugin, which are more critical. So you can modifty the agents.yaml by hand instead of using the panel. Once everything is ok, you can try to modify the RViz panel.

SadeepRathnayaka commented 3 days ago

Would you mind telling about the changes that I have to do in HuNavPlugin.cpp ? Also I guess I will have to use skin : 5 in agents.yaml since I have created a new skin for the model ?

This is the updated version of the processXML function in WorldGenerator.cpp. I have added child.dae at the end of the skin_filename array.

std::string skin_filename[] = { "elegant_man.dae", "casual_man.dae", "elegant_woman.dae", "regular_man.dae", "worker_man.dae", "walk.dae", "walk-green.dae", "walk-blue.dae", "walk-red.dae", "stand.dae", "child.dae"};

std::string animation_filename[] = { "07_01-walk.bvh", "69_02_walk_forward.bvh", "137_28-normal_wait.bvh", "142_01-walk_childist.bvh", "07_04-slow_walk.bvh", "02_01-walk.bvh", "142_17-walk_scared.bvh", "17_01-walk_with_anger.bvh" };

I have not changed anything in animation_filename. Only the skin_filename.