SITL Gazebo custom model integration issue

Hi guys, I want to integrate custom Gazebo(Garden) model with SITL. Firstly, i installed plugin then integrate my xacro file below one

<fdm_addr>127.0.0.1</fdm_addr>
<fdm_port_in>9002</fdm_port_in>
5
<lock_step>1</lock_step>
boat::sensors::imu_sensor

Then i started launch file. There is no any plugin error. So, i wrote this ./sim_vehicle.py -v Rover -f gazebo-rover --console --map --out=udp:127.0.0.1:9002 on the another terminal. I just want to provide connection. I think that Rover or anything doesnt matter. I got “link 1 down” in console. There isn’t connection between Gazebo and SITL.

Also,
I want to add something when SITL and Gazebo open.
netstat -tulnp | grep 900
i see UDP 0.0.0.0:9003 but i can not see 9002. I suspect that SITL cant send data to the Gazebo

Many thanks for your help.

hello, remove this line. The --out is a mavlink connexion from mavproxy, so that isn’t what you need. By default, SITL will connect allow Gazebo to connect on port 9002 so it will work

Thanks for your help, i removed but nothing changed. I just see udp 0.0.0.0:9003. It seems SITL cant send to the Gazebo.

Right, I didn’t read carefully.
Check back the docs ! Using SITL with Gazebo — Dev documentation

You command should be sim_vehicle.py -v Rover -f gazebo-rover --model JSON --map --console

I have read and implemented this Using SITL with Gazebo — Dev documentation already. It works Zephyr model but it doesn’t work for my custom model. Also when i run this command ./sim_vehicle.py -v Rover -f gazebo-rover --model JSON --map --console
I dont see “udp 0 0 0.0.0.0:9003” but for this
“./sim_vehicle.py -v Rover -f gazebo-rover --console --map”
I see “udp 0 0 0.0.0.0:9003” this happens on my custom model. I dont understand why thats bizarre I will research. Thanks

Oh, I found problem. ArduPilot Plugin must be defined under “model” block. My system is so complicated and there are many xacro files in order to simplfy system. “model” block can be used in sdf files but it can’t be used in xacro files. Probably I can’t migrate xacro systems to sdf beacuse of complexity of the system. I’m looking for solution. I hope that i will find.

I wrote simple sdf file that has 2 link which are base and imu in model block. I started sdf file, controlled my model. There is no any problem after that i checked gz topic of imu sensor. It worked, no problem again. There is no error about plugin and my sdf. Below one is my plugin definiton
<fdm_addr>127.0.0.1</fdm_addr>
<fdm_port_in>9002</fdm_port_in>
5
<lock_step>1</lock_step>
0 0 0 180 0 -90
0 0 0 180 0 90
boat_imu_link::imu_sensor

I copied from zephyr it just doesnt include control channels. My goal is providing connection. After I started sdf, I wrote ./sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --map --console in another terminal. I always get
[Wrn] [ArduPilotPlugin.cc:1589] Duplicate input frame in sdf terminal, No JSON sensor message received, resending servos and link 1 down in console. Does anyone have any ideas about the solution or problem? I probably won’t be able to finish the homework :frowning:

@unknown_player25 - Is there a course setting homework that uses ArduPilot and Gazebo?