# Error with gazebo\_ros\_multicamera plugin

**URL:** <https://discuss.px4.io/t/error-with-gazebo-ros-multicamera-plugin/28795>\
**Category:** ROS 1 / ROS 2\
**Created:** [August 22, 2022, 10:13pm UTC](https://discuss.px4.io/t/error-with-gazebo-ros-multicamera-plugin/28795 "2022-08-22T22:13:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyungtaek](https://discuss.px4.io/user_avatar/discuss.px4.io/kyungtaek/32/11409_2.png) [@Kyungtaek](https://discuss.px4.io/u/Kyungtaek)\
**Post date:** [August 22, 2022, 10:13pm UTC](https://discuss.px4.io/t/error-with-gazebo-ros-multicamera-plugin/28795/1 "2022-08-22T22:13:15Z")

</div>

Hi.

I’m trying to run a roslaunch gazebo simulation with the stereo\_camera model.

First, I added the `iris_stereo_camera` model to the build target and built it.  
And `make px4_sitl gazebo_iris_stereo_camera` worked fine.  
The `libgazebo_ros_multicaemra.so` file was also created within `PX4-Autopilot/build/px4_sitl_default/build_gazebo/`.

Then, I created a launch file to run using roslaunch and made the `iris_stereo_camera.urdf` file to use.  
When roslaunch was executed, the image of the stereo camera could be checked with the gazebo topic.  
However, the following error occurred while running the simulation, and the topic of the stereo camera could not be confirmed in rostopic.  
`[Err] [Plugin.hh:212] Failed to load plugin /home/kyungtaek/PX4-Autopilot/build/px4_sitl_default/build_gazebo/libgazebo_ros_multicamera.so: /home/kyungtaek/PX4-Autopilot/build/px4_sitl_default/build_gazebo/libgazebo_ros_multicamera.so: undefined symbol: _ZTIN6gazebo17MultiCameraPluginE`  
Of course, because there was no rostopic, it could not be confirmed in rviz.

If anyone has had the same problem as me, I’d appreciate it if you could tell me how to fix it.

Below are the codes I used.

1.Launch File

```auto
<?xml version="1.0"?>
<launch>
	<!-- Posix SITL environment launch script -->
	<!-- launches PX4 SITL, Gazebo environment, and spawns vehicle -->
	<!-- vehicle pose -->
	<arg name="x" default="0"/>
	<arg name="y" default="0"/>
	<arg name="z" default="0"/>
	<arg name="R" default="0"/>
	<arg name="P" default="0"/>
	<arg name="Y" default="0"/>
	<!-- vehicle model and world -->
	<arg name="est" default="ekf2"/>
	<arg name="vehicle" default="iris_stereo_camera"/>
	<arg name="world" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/>
	<arg name="sdf" default="$(find mavlink_sitl_gazebo)/models/$(arg vehicle)/$(arg vehicle).sdf"/>
	<env name="PX4_SIM_MODEL" value="$(arg vehicle)" />
	<env name="PX4_ESTIMATOR" value="$(arg est)" />

	<!-- gazebo configs -->
	<arg name="gui" default="true"/>
	<arg name="debug" default="false"/>
	<arg name="verbose" default="true"/>
	<arg name="paused" default="false"/>
	<arg name="respawn_gazebo" default="false"/>
	<!-- PX4 configs -->
	<arg name="interactive" default="true"/>
	<!-- PX4 SITL -->
	<arg unless="$(arg interactive)" name="px4_command_arg1" value="-d"/>
	<arg if="$(arg interactive)" name="px4_command_arg1" value=""/>
	<node name="sitl" pkg="px4" type="px4" output="screen"
			args="$(find px4)/build/px4_sitl_default/etc -s etc/init.d-posix/rcS $(arg px4_command_arg1)" required="true"/>

	<!-- Gazebo sim -->
	<include file="$(find gazebo_ros)/launch/empty_world.launch">
			<arg name="gui" value="$(arg gui)"/>
			<arg name="world_name" value="$(arg world)"/>
			<arg name="debug" value="$(arg debug)"/>
			<arg name="verbose" value="$(arg verbose)"/>
			<arg name="paused" value="$(arg paused)"/>
			<arg name="respawn_gazebo" value="$(arg respawn_gazebo)"/>
	</include>

	<!-- gazebo/rviz model -->
	<param name="robot_description" textfile="/home/kyungtaek/PX4-Autopilot/Tools/sitl_gazebo/models/iris_stereo_camera/urdf/iris_stereo_camera.urdf" />
	<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
			<param name="publish_frequency" type="double" value="30.0" />
	</node>
	<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
	<node name="$(anon vehicle_spawn)" pkg="gazebo_ros" type="spawn_model" output="screen" args="-urdf -param /robot_description -model $(arg vehicle) -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/>

	<!-- mavros node -->
	<include file="$(find mavros)/launch/px4.launch">
		<arg name="gcs_url" value=""/>
		<arg name="fcu_url" value="udp://:14540@localhost:14557"/>
		<arg name="respawn_mavros" value="false"/>
	</include>

	<!-- rviz -->
	<node type="rviz" name="rviz" pkg="rviz" />

</launch>

```

1. Stereo camera in urdf file

```auto

  <joint name='stereo_joint' type='fixed'>
  <origin rpy='0 0 0.035' xyz='0 0 0'/>
    <parent link="base_link"/>
    <child link="stereo"/>
  </joint>
  <link name='stereo'>
    <origin rpy="0.01 0.025 0.025" xyz="0 0 0"/>
    <inertial>
      <mass value="0.01"/>
      <inertia ixx="4.15e-6" ixy="0" ixz="0" iyy="2.407e-6" iyz="0" izz="2.407e-6"/>
    </inertial>
    <visual>
      <geometry>
        <box size="0.01 0.01 0.01"/>
      </geometry>
    </visual>
  </link>
  <gazebo reference='stereo'>
    <sensor name='stereo_cam' type='multicamera'>
      <camera name='left'>
        <pose>0.1 0.035 0 0 0 0</pose>
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <format>R8G8B8</format>
          <width>640</width>
          <height>480</height>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      </camera>
      <camera name='right'>
        <pose>0.1 -0.035 0 0 0 0</pose>
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <format>R8G8B8</format>
          <width>640</width>
          <height>480</height>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      </camera>
      <plugin name='stereo_camera_controller' filename='libgazebo_ros_multicamera.so'>
        <alwaysOn>true</alwaysOn>
        <updateRate>20</updateRate>
        <cameraName>stereo</cameraName>
        <imageTopicName>image_raw/stereo_image</imageTopicName>
        <cameraInfoTopicName>camera_info/stereo_camera</cameraInfoTopicName>
        <frameName>camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortion_k1>0.0</distortion_k1>
        <distortion_k2>0.0</distortion_k2>
        <distortion_k3>0.0</distortion_k3>
        <distortion_t1>0.0</distortion_t1>
        <distortion_t2>0.0</distortion_t2>
      </plugin>
    </sensor>
  </gazebo>

```

1. multicamera part in CMakeLists.txt (PX4-Autopilot/Tools/sitl\_gazebo/)

```auto
  add_library(gazebo_ros_multicamera SHARED src/gazebo_ros_multicamera.cpp)
  list(APPEND plugins gazebo_ros_multicamera)
  message(STATUS "adding gazebo_ros_multicamera to build")
  
  target_link_libraries(gazebo_ros_multicamera
    ${catkin_LIBRARIES}
    ${roscpp_LIBRARIES}
    ${GAZEBO_libraries}
  )

```
