get marvelmind data from 2 mobile beacon to 1 lego using python

Frequent questions asked online, offline, in forums are answered here
yanamuh
Posts: 1
Joined: Wed Aug 28, 2019 12:24 pm

get marvelmind data from 2 mobile beacon to 1 lego using python

Postby yanamuh » Wed Aug 28, 2019 12:36 pm

Hi. I want to use 2 mobile beacon for my lego truck trailer robot. 1 for trailer (without imu) and 1 for the head truck (with imu). Ive been using python to get marvelmind data (x,y, and orientation) and it works. However, when I tried to use 2 beacon, the output data is always zero. (x=0 and y=0). It seems like it didnt really read the marvelmind data.

this is code that i use for call the marvelmind class

Code: Select all

    hedge = MarvelmindHedge(tty = "/dev/ttyACM0", adr=8, debug=False) #create MarvelmindHedge thread
    hedge.start() # start thread
    hedge2 = MarvelmindHedge(tty = "/dev/ttyACM0", adr=2, debug=False) #create MarvelmindHedge thread
    hedge2.start() # start thread


I've already check the firmware, baudrate, channel, etc, everything is same. So is it because the address are wrong? I use device 8 and 2, so I just write that address. Or anything else? Thank you^^

smoker77
Posts: 243
Joined: Sat Feb 06, 2016 4:03 pm

Re: get marvelmind data from 2 mobile beacon to 1 lego using python

Postby smoker77 » Wed Sep 04, 2019 9:02 pm

Hello,

Do you connect two mobile beacons to two USB ports?
In this case each mobile beacon will use separate serial port and you should specify it in call.
Something like this

Code: Select all

hedge = MarvelmindHedge(tty = "/dev/ttyACM0", adr=8, debug=False) #create MarvelmindHedge thread
hedge.start() # start thread
hedge2 = MarvelmindHedge(tty = "/dev/ttyACM1", adr=2, debug=False) #create MarvelmindHedge thread
hedge2.start() # start thread

Also you can get location data (but not IMU) about all mobile beacons from one mobile beacon connected to one USB port.
In this case address should be "None":

Code: Select all

hedge = MarvelmindHedge(tty = "/dev/ttyACM0", adr=None, debug=False) #create MarvelmindHedge thread
hedge.start() # start thread


Return to “FAQ”

Who is online

Users browsing this forum: No registered users and 4 guests