Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 01:32
    peterbarker opened #356
  • Sep 17 11:40
    peterbarker synchronize #351
  • Sep 17 11:27
    julianoes commented #343
  • Sep 17 11:05

    tridge on master

    generator: fix message length t… (compare)

  • Sep 17 11:05
    tridge closed #344
  • Sep 17 11:05
    tridge closed #145
  • Sep 17 11:05
    tridge commented #344
  • Sep 17 10:52

    tridge on master

    generator: fix off-by-one in ma… (compare)

  • Sep 17 10:52
    tridge closed #343
  • Sep 17 10:52
    tridge commented #343
  • Sep 17 07:17
    julianoes commented #343
  • Sep 17 07:17
    julianoes commented #344
  • Sep 16 22:37

    peterbarker on master

    mavutil: correct type of except… (compare)

  • Sep 16 22:37
    peterbarker closed #355
  • Sep 16 16:41
    andyp1per edited #354
  • Sep 16 02:39
    peterbarker opened #355
  • Sep 16 00:41

    tridge on master

    mavutil: fixed use of None port (compare)

  • Sep 15 18:12
    andyp1per commented #354
  • Sep 15 18:10
    andyp1per commented #354
  • Sep 15 18:09
    andyp1per synchronize #354
techsolution123
@techsolution123
It's very basic stage
Francisco Ferreira
@OXINARF
@techsolution123 time.time() returns a float and ping receives an integer...
techsolution123
@techsolution123
I found the issue and fixed it
I tried with Python 3.6, which is not working well
so I changed to Python 2 and it output no error
do you have any comment?
and i want to send the distance data via mavlink
am I correct to set the connection to "udpout:192.168.2.1:14450"?

master = mavutil.mavlink_connection('udpout:192.168.2.1:14450')

wait_conn(master)

master.mav.param_set_send(
1,
1,
"RNGFND_TYPE",
10, # "MAVLink"
mavutil.mavlink.MAV_PARAM_TYPE_INT8)

min = 10 # minimum valid measurement that the autopilot should use
max = 40 # maximum valid measurement that the autopilot should use
distance = 20 # You will need to supply the distance measurement
type = mavutil.mavlink.MAV_DISTANCE_SENSOR_UNKNOWN
id = 1
orientation = mavutil.mavlink.MAV_SENSOR_ROTATION_PITCH_270 # downward facing
covariance = 0

tstart = time.time()

print('Mavlink connected...')
while True:

time.sleep(0.5)
master.mav.distance_sensor_send(
    (time.time() - tstart) * 1000,
    min,
    max,
    distance,
    type,
    id,
    orientation,
    covariance)
print(".")
techsolution123
@techsolution123
This is my code
image.png
am I correct to set the connection to "udpout:192.168.2.1:14450"?
TunaLobster
@TunaLobster
Curiosity question, could the autotest scripts be run with a MAVProxy connected to a SITL instance (x-plane for flight dynamics)?
Francisco Ferreira
@OXINARF
@techsolution123 That depends entirely on your environment, I can't answer it.
Peter Barker
@peterbarker
@TunaLobster We don't really currently do alternate vehicle models with autotest. I've been considering on and off adding it. One reason it's not helpful for the autotest suite so much is that the flight dynamics may be different enough that the autotests don't pass! For someone constructing their own tests it is probably feasible.
You could play around with it - it's the --frame parameter, and it does work for different types of multi frame, for example.
TunaLobster
@TunaLobster
@peterbarker I was think the other direction. Using the autotest scripts while I was running a SITL simulation. Sort of as a way to get consistent inputs on each flight.
techsolution123
@techsolution123
I was trying to send the sensor data via mavlink so that QGC app shows the sensor data on the instrument channel. What do i have to do for it?
Peter Barker
@peterbarker
@techsolution123 You can kind of do what you're suggesting; you can put in a self.interact() in an autotest script and drops you to a mavproxy prompt.
@techsolution123 You can also create aliases to move forward with your SITL testing faster (I often make one-letter aliases to make it faster....). You can also create mavproxy modules to help out.
techsolution123
@techsolution123
@peterbarker Hi, Peter. Thank you for your help.
I have QGC app which shows the pi camera video with instrument panel of ardupilot
It seems there are some unused sensor values, so I want to use them to show another custom sensor values I installed on the vehicle, which are contact sensors
I have to show 2~3 sensor values, and I succeeded in showing 1 value on the MAV_DISTANCE_SENSOR
but still wondering which sensor values I can use.
If you have any experiences or suggestions, please let me know
techsolution123
@techsolution123
Thank you
Peter Barker
@peterbarker
@techsolution123 OBSTACLE_DISTANCE might do it for you. On MissionPlanner you'd get a radar image with whichever switches are activated appearing as objects. So I hear, anyway - I've never played with it.
I've no idea if QGC supports such a view
(checked - it doesn't know anything about obstacle_distance)
Atharva Atre
@sparklytopaz
I am having trouble connecting my Arducopter to a dronekit sitl instance.
I am having trouble connecting my Arducopter to a dronekit sitl instance.
the error is link timeout due to no heartbeat
the source of the error is a function named
vehicle = connect(connection_string,wait_ready=True)
so is this due to my mavlink version?
Akshath-Singhal
@Akshath-Singhal
@sparklytopaz Try setting baudrate as well. vehicle = connect(connection_string, wait_ready=True, baud=57600)
Atharva Atre
@sparklytopaz
@Akshath-Singhal
EOF on TCP socket
connection reset or closed by peer on tcp socket
this is the error that is repeated for 30 seconds and program closes due to no heartbeat
grateful for you help!
Peter Barker
@peterbarker
Can you give the invocations you're using, please?
Atharva Atre
@sparklytopaz
launchSitl.JPG

I have a bash code called launchSitl which is establishing link with qgc mavproxy and sitl

I have a a python script which is using drone kit

automission.JPG
automission2.JPG
error.JPG
Jessica Blunt
@JessicaBlunt
I'm using pymavlink to convert binary files to json. When I print out the lines of my json before writing them to the file, everything looks as I would expect. However, the file seems to have some sort of encoding issue and is unusable. Does anyone know what encoding it could be using? I know that it's not ASCII or UTF-8. Any suggestions on how to change how I'm writing to the file?
` if args.format == 'json':
        # Format our message as a Python dict, which gets us almost to
        # proper JSON format
        data = m.to_dict()

        # Remove the mavpackettype value as we specify that later.
        del data['mavpackettype']

        # Also, if it's a BAD_DATA message, make it JSON-compatible by
        # removing array objects
        if 'data' in data and type(data['data']) is not dict:
            data['data'] = list(data['data'])

        # Prepare the message as a single object with 'meta' and 'data'
        # keys holding the message's metadata and actual data respectively.
        meta = {"type": m.get_type(), "timestamp": timestamp}
        if args.show_source:
            meta["srcSystem"] = m.get_srcSystem()
            meta["srcComponent"] = m.get_srcComponent()
        outMsg = {"meta": meta, "data": data}

        # Now print out this object with stringified properly.
        print(json.dumps(outMsg) + '\n')

        if json_output is not None:
            json_output.write((json.dumps(outMsg) + '\n'))`
Peter Barker
@peterbarker
@JessicaBlunt Are you aware that mavlogdump.py can convert to JSON? I don't immediately see any issues wth your code there. How is that "json_output" thingy created?
Jessica Blunt
@JessicaBlunt
@peterbarker This is my version of mavlogdump.py - the workflow this is part of needs a specific type of JSON that the default mavlogdump won't do. json_output is a file, created as
json_output = open(os.path.join(args.json_out_dir, dt.strftime("%Y%m%d_%H%M_{}.json".format(args.log.split('/')[-1].split('.')[0]))), mode='w')
Peter Barker
@peterbarker
OK, not seeing a problem via inspection there. Note that BAD_DATA isn't the only place you'll find arrays in mavlink, BTW.
I've just knocked up a quick hack based on your snippets here and it appears to work as intended.
Peter Barker
@peterbarker
@JessicaBlunt
#!/usr/bin/python

import json
from pymavlink import mavutil

fh = open("/tmp/out.json", mode='w')

mlog = mavutil.mavlink_connection("/home/pbarker/rc/flight-data/bixler/logs/2017-10-29/flight4/flight.tlog")

while True:
    m = mlog.recv_match()
    data = m.to_dict()
    del data['mavpackettype']
    if 'data' in data and type(data['data']) is not dict:
        data['data'] = list(data['data'])
    timestamp = 16
    meta = {"type": m.get_type(), "timestamp": timestamp}
    if False:
        meta["srcSystem"] = m.get_srcSystem()
        meta["srcComponent"] = m.get_srcComponent()
    outMsg = {"meta": meta, "data": data}
    print(json.dumps(outMsg) + '\n')
    fh.write((json.dumps(outMsg) + '\n'))

fh.close()
meher1087
@meher1087
Is there any resource to implement pymavlink with cleanflight?
Jessica Blunt
@JessicaBlunt
@peterbarker I can't claim to understand how, but it works! Thank you so much! Are you okay with that fix appearing in some open source code (with citation)?
Peter Barker
@peterbarker
@JessicaBlunt Yep, no worries. No citation required - it's basically your code with the comments removed (for compactness' sake for posting here).
@meher1087 Not really sure what you're after there. Does cleanflight itself do mavlink?