Exemplo n.º 1
0
 def cmd_start(self):
     '''start vicon'''
     vicon = pyvicon.PyVicon()
     print("Opening Vicon connection to %s" % self.vicon_settings.host)
     vicon.connect(self.vicon_settings.host)
     print("Configuring vicon")
     vicon.set_stream_mode(pyvicon.StreamMode.ClientPull)
     vicon.enable_marker_data()
     vicon.enable_segment_data()
     vicon.enable_unlabeled_marker_data()
     vicon.enable_device_data()
     print("vicon ready")
     self.vicon = vicon
Exemplo n.º 2
0
    def cmd_start(self):
        """start vicon"""
        vicon = pyvicon.PyVicon()
        print("Opening Vicon connection to %s" % self.vicon_settings.host)
        vicon.connect(self.vicon_settings.host)
        print("Configuring vicon")
        vicon.set_stream_mode(pyvicon.StreamMode.ClientPull)
        vicon.enable_marker_data()
        vicon.enable_segment_data()
        vicon.enable_unlabeled_marker_data()
        vicon.enable_device_data()

        # Set the axis mapping to the ardupilot convention (North, East, Down)
        vicon.set_axis_mapping(pyvicon.Direction.Forward,
                               pyvicon.Direction.Right, pyvicon.Direction.Down)
        print(vicon.get_axis_mapping())
        print("vicon ready")
        self.vicon = vicon
Exemplo n.º 3
0
import time
import socket
import pickle
import numpy as np
from pyvicon import pyvicon as pv


IP = "199.98.21.246"
STREAM_MODE = pv.StreamMode.ClientPull #ServerPush is an alternative (lower latency)

# instantiate client
client = pv.PyVicon()

# try to connect to Vicon running on IP
print("Connecting to DataStream",end="")
while not client.is_connected():
    client.connect(IP)
    print(".")
    time.sleep(.25)
print("Connected to DataStream on IP:",IP)

# enable data types
client.enable_segment_data()
client.enable_marker_data()
client.enable_unlabeled_marker_data()
client.enable_device_data()

# set stream mode
print("Setting StreamMode to",str(STREAM_MODE))
client.set_stream_mode(STREAM_MODE)
Exemplo n.º 4
0
                    default=False,
                    help="only send GPS data")
parser.add_argument("--send-zero",
                    action='store_true',
                    default=False,
                    help="send zero data")

args = parser.parse_args()

# create a mavlink serial instance
mav = mavutil.mavlink_connection(args.mavlink_dest,
                                 source_system=args.source_sysid,
                                 source_component=args.source_component)

# create vicon connection
vicon = pyvicon.PyVicon()

origin_parts = args.origin.split(',')
if len(origin_parts) != 4:
    print("Origin should be lat,lon,alt,yaw")
    sys.exit(1)
origin = (float(origin_parts[0]), float(origin_parts[1]),
          float(origin_parts[2]))

last_origin_send = 0


def connect_to_vicon(ip):
    '''connect to a vicon with given ip or hostname'''
    global vicon
    print("Opening connection to %s" % ip)