The exercise is available at here.
A detailed step-by-step Gazebo installation tutorial is provided in assignment5
After sourcing the Gazebo workspace, execute the following command:
gz sim shapes.sdfThe result should be like this:

Gazebo and ROS2 publish distinct topics, but they can be interconverted using the ros_gz_bridge library. In this exercise, we demonstrate the conversion of an Int32 message, which is published on /keyboard/keypress in Gazebo, to ROS2 format.
ros2 run ros_gz_bridge parameter_bridge /keyboard/keypress@std_msgs/msg/Int32@gz.msgs.Int32We started a bridge on /keyboard/keypress topic with message of type Int32. For ROS it is std_msgs/msg/Int32 and for Gazebo it is gz.msgs.Int32. The full list of topic conversions is available here.
In another terminal launch an Gazebo Sim world, for example the empty.sdf world:
gz sim empty.sdfThen add the Key Publisher plugin from the dropdown menu on the top right corner, and start Gazebo simulation.
And finally:
ros2 topic echo /keyboard/keypressNow by typing in Gazebo, ascii numbers are bridged into Ros2 topics and are shown in echo terminal.

