Home        Store        Docs        Blog

Issues in getting sensor data


(Vatsal Shah) #1

import time
from pymavlink import mavutil

mavutil.set_dialect(“ardupilotmega”)

autopilot = mavutil.mavlink_connection(’/dev/ttyACM0’)

msg = None

while msg is None:
msg = autopilot.recv_msg()

print msg

autopilot.mav.heartbeat_send(
6,
8,
192,
0,
4,
3
)

autopilot.mav.command_long_send(
1,
1,
2510,
0,0,0,0,0,0,0,0)

print autopilot.mav.command_long_send(1,1,2510,0,0,0,0,0,0,0,0)

time.sleep(2)

autopilot.mav.command_long_send(
1,
1,
2511,
0,0,0,0,0,0,0,0)


I used the above python code. The code ran but I am not able to figure out where the sensor data is being logged.

Also if this does not work , can you provide alternate code to get and read sensor data?


(Jacob) #2

This is where you can save the information. This is your program, so you need to write the code to log data. The data comes in the messages, you can choose which messages and data to save, or save everything. I recommend using mavproxy; it has the functionality to log data.