Fejemis Sim ROS2
Back to Fejemis ROS2 Software
Purpose
fejemis_sim contains the Gazebo Sim bringup for Fejemis. It provides the world files, model assets, ROS-GZ bridge configuration, and launch file used to spawn the robot in simulation with the same control interface as the real robot.
The package is used to:
- Load a selectable Gazebo world for development and testing.
- Publish the robot description from fejemis_description and spawn the model in Gazebo.
- Bridge robot state, sensors, and commands between ROS 2 and Gazebo.
- Optionally convert RoverCommand messages into Gazebo Twist commands so simulation matches the real control path.
Package Layout
Important package folders:
- launch - simulation bringup entry point.
- config - Gazebo GUI configuration, bridge mappings, and RViz configuration.
- models - xacro fragments used to assemble Gazebo world templates.
- worlds - ready-made Gazebo worlds such as room.world, empty.world, and dynamic.world.
Main Launch File
The package is centered around launch/sim.launch.py.
Launch sequence:
- Includes fejemis_description::launch/model.launch.py with use_sim_time=true so the robot description is available before spawning.
- Starts ros_gz_sim::launch/gz_sim.launch.py with the selected world file and config/gazebo.config GUI settings.
- Spawns the robot in Gazebo with ros_gz_sim/create using /robot_description and the Gazebo model name fejemis.
- Starts ros_gz_bridge/parameter_bridge in the fejemis namespace using config/gz_bridge.yaml.
- Optionally starts raubase_core/rover_2_twist when the rover-command adapter is enabled.
Launch arguments:
- world - selects the world to load. Default: fejemis_sim::worlds/room.world.
- rover_cmd_adapter - enables the RoverCommand-to-Twist adapter. Default: True.
- rviz - declared for launch consistency and GUI workflows.
World Files
The default world is fejemis_sim::worlds/room.world, which assembles the standard world template with the Fejemis simulation models.
Available world files:
- worlds/room.world - the main indoor test room used by the simulator.
- worlds/empty.world - a minimal empty world for lightweight testing.
- worlds/dynamic.world - a more active world variant for motion and interaction testing.
The world templates are built from the xacro fragments in models/worlds.
Gazebo Bridge
The bridge configuration in config/gz_bridge.yaml maps the robot command, state, and sensor topics between ROS 2 and Gazebo.
Bridged topics:
- /fejemis/cmd_vel_twist to /model/fejemis/cmd_vel - command input from ROS to Gazebo.
- /clock - simulation time from Gazebo to ROS.
- /joint_states to /world/demo/model/fejemis/joint_state - joint state feedback.
- /fejemis/odom to /model/fejemis/odom - simulated odometry.
- /fejemis/imu to /model/fejemis/imu - IMU output.
- /fejemis/mag to /model/fejemis/mag - magnetometer output.
- /fejemis/scan to /model/fejemis/scan - LiDAR scan.
- /fejemis/image_raw to /model/fejemis/image_raw - camera image stream.
- /fejemis/camera_info to /model/fejemis/camera_info - camera calibration data.
This bridge lets the simulator exercise the same downstream ROS 2 stack that runs on the real robot.
Robot Control Path
By default, the simulator expects rover commands on /fejemis/cmd_vel in the raubase_core/msg/RoverCommand format. When rover_cmd_adapter is enabled, raubase_core/rover_2_twist converts that into geometry_msgs/Twist on /fejemis/cmd_vel_twist, which is then forwarded to Gazebo.
This keeps the simulation control interface aligned with the real Fejemis command pipeline.
If the adapter is disabled, you can publish geometry_msgs/Twist directly to /fejemis/cmd_vel_twist.
Visualisation
The package also ships an RViz configuration in config/rviz2.rviz for simulator debugging and model inspection.
The Gazebo GUI settings are stored in config/gazebo.config.
Typical Usage
Basic simulator launch:
ros2 launch fejemis_sim sim.launch.py
Use a different world:
ros2 launch fejemis_sim sim.launch.py world:=fejemis_sim::worlds/empty.world
Disable the rover-command adapter and publish Twist directly:
```bash ros2 launch fejemis_sim sim.launch.py rover_cmd_adapter:=False ```
Example RoverCommand input:
```bash ros2 topic pub /fejemis/cmd_vel raubase_core/msg/RoverCommand "{source: 2, linear_vel: 0.2, turn_rate: 0.0}" ```
Integration With The Rest Of The Stack
The simulation package is usually started together with fejemis and fejemis_maploc when testing the full ROS 2 stack in a desktop or lab environment.
In a simulated workflow, the same map, navigation, and behaviour layers can be exercised without running the physical bridge or Teensy hardware, while still keeping the robot description, command topics, and sensor topics aligned with the real system.