Not sure if this answer is relevant after all it's been 2 years.
Anyways, here goes.
There are 2 things that the model needs to spawn in gazebo and rviz
--namespace : Changing this in robot_description changes the model name.
tf_prefix : This parameter changes your TF description. WHY??? So that we can find the relationship between the models.
group ns : changing this parameter changes your node names. type /rosnode list or rostopic list
OK here are some examples:
1 node name="robot1_controller_spawner" pkg="controller_manager" type="spawner"
args="--namespace=/robot1
Model name of base_link is now ....
robot1/base_link robot1/sexy_link
2 Conditions
....
a. if (tf_prefix=null) No transform from [robot1/sexy_link] to [robot1/base_link]
b. if(tf_prefix=robot1) Your model works fine.
BUT WAIT, THERE'S more Why does my model still not work???
and the error No transform from [robot1/sexy_link] to [robot1/base_link] is still present???
Here are the steps
1. go to somefile.rviz
Instructions below are the two changes
find Fixed Frame , change this to Fixed Frame: robot1/base_link
find Link Tree Style, change the parameter to Joints in Alphabetic Order,
like so...
Link Tree Style: Joints in Alphabetic Order
^Knowing this information... Will help u understand rviz better
Here's a more modular answer. https://answers.ros.org/question/2634...
Step 1: change Fixed Frame : map
Step 2: add this into launch file
node pkg="tf" type="static_transform_publisher" name="odom_map_broadcaster" args="0 0 0 0 0 0 map robot1/base_link 100"