Gazebo with LiDAR

Update: I updated to copter 3.5 with the original Aurelien plugin. I managed to get an SDF model with a modified hokuyo lidar to output on ros and show up in gazebo. Still having issues getting mavros to send the message. (Not showing up in wireshark and my application isn’t getting it)

distance_sensor:
  laser:
    id: 1
    #    frame_id: "lidar_link"
    orientation: NONE  # RPY:{180.0, 0.0, 0.0}
    #    field_of_view: 0.0  # XXX TODO
    #    send_tf: true
    #    sensor_position: {x:  0.0, y:  0.0, z:  -0.1}
    subscriber: true

It is connecting over tcp to the FCU and UDP to the GCS. I’m not seeing any mavlink traffic to the FCU, but the GCS has quite a bit. Looking at the distance_sensor mavros plugin code, it is sending it to the FCU…

[ INFO] [1516892771.818369442]: FCU URL: tcp://127.0.0.1:5760
[ INFO] [1516892771.818863689]: tcp0: Server address: 127.0.0.1:5760
[ INFO] [1516892771.819085812]: GCS URL: udp://127.0.0.1@127.0.0.1:14550
[ INFO] [1516892771.819245774]: udp1: Bind address: 127.0.0.1:14555
[ INFO] [1516892771.819291110]: udp1: Remote address: 127.0.0.1:14550

Edit: Did some logging and it looks like it is never getting the range_cb, even though I can echo the topic and the type of message is correct (and I verified the subscribed topic name.)

header: 
  seq: 1368133
  stamp: 
    secs: 1368
    nsecs: 291000000
  frame_id: "hokuyo"
radiation_type: 0
field_of_view: 0.0
min_range: 0.0799999982119
max_range: 10.0
range: 10.0

Edit2:

This is partially solved. I re-read the document khancyr provided and had missed that I needed to publish on /mavros/distance_sensor/range rather than /range. I am now getting the subscribed message, but it isn’t showing up over in my application.