Obtaining Sensor Data from SITL?

Hello Everyone,

I am a newbie for Drone and Ardupilot. I am currently catching up on your works.
I’d like to collect simulated sensor data like IMU. Is it possible to do it with Ardupilot?
I’ve been working on Ardupilot SITL and QGroundControl. I succeeded in flight ArduCoptor simulated on QGroundControl.
Now I want to collect sensor data, but it is hard to find related information.
Questions

  1. Is it possible to get sensor data from SITL?
  2. Does it collect via UDP or Serial?
  3. Could you give me a related blog or link?

Thanks in advance.

Hello Everyone, I figured out how to obtain specific sensor data through the SITL.

ardu@ardu-VirtualBox:~/Documents/workspace/ardupilot/ArduCopter$ sim_vehicle.py --out “192.168.0.10:14550”

The following command above makes you get MavLink data. you can debug yourself by using wireshark.

with a specific go script below, you can obtain specific sensor data as you want.

package main

import (
    "fmt"
    "github.com/aler9/gomavlib"
    "github.com/aler9/gomavlib/pkg/dialects/common"
)

func main() {
    node, err := gomavlib.NewNode(gomavlib.NodeConf{
        Endpoints:   []gomavlib.EndpointConf{gomavlib.EndpointUDPServer{":14550"}},
        Dialect:     common.Dialect,
        OutVersion:  gomavlib.V2, // change to V1 if you're unable to communicate with the target
        OutSystemID: 10,
    })

    if err != nil {
        panic(err)
    }
    defer node.Close()

    // print every message we receive
    for evt := range node.Events() {
        if frm, ok := evt.(*gomavlib.EventFrame); ok {
            if frm.Message().GetID() == 27 {
                recvmsg := frm.Message()         
                fmt.Printf("received: %+v\n", recvmsg.(*common.MessageRawImu).Xacc)
            }
        }
    }
}