<commit_before>#!/usr/bin/env python
import serial
import struct

import sys, getopt, time, glob, math, pdb, numpy

from mtdef import MID, MTException, Baudrates, XDIGroup, getName, getMIDName, XDIMessage, XDIProductMask

# Verbose flag for debugging
verbose = False

################################################################
# MTDevice class
################################################################
## Xsens MT device communication object.
class MTDevice(object):
	"""Xsens MT device communication object."""

	def __init__(self, port, baudrate=115200, timeout=0.1, autoconf=True,
			config_mode=False):
		"""Open device."""
		self.device = serial.Serial(port, baudrate, timeout=timeout,
				writeTimeout=timeout)
		self.device.flushInput()	# flush to make sure the port is ready TODO
		self.device.flushOutput()	# flush to make sure the port is ready TODO
		## timeout for communication
		self.timeout = timeout
		if autoconf:
			self.auto_config()
		else:
			## mode parameter of the IMU
			self.mode = None
			## settings parameter of the IMU<commit_msg>iodevice error fix for xsens for kinetic (#941)<commit_after>#!/usr/bin/env python
import serial
import struct

import sys, getopt, time, glob, math, pdb, numpy

from mtdef import MID, MTException, Baudrates, XDIGroup, getName, getMIDName, XDIMessage, XDIProductMask

# Verbose flag for debugging
verbose = False

################################################################
# MTDevice class
################################################################
## Xsens MT device communication object.
class MTDevice(object):
	"""Xsens MT device communication object."""

	def __init__(self, port, baudrate=115200, timeout=0.1, autoconf=True,
			config_mode=False):
		"""Open device."""
#		self.device = serial.Serial(port, baudrate, timeout=timeout,
#				writeTimeout=timeout)
                self.device = serial.Serial(port, baudrate, timeout=timeout,
                                           writeTimeout=timeout, rtscts=True, dsrdtr=True)
		self.device.flushInput()	# flush to make sure the port is ready TODO
		self.device.flushOutput()	# flush to make sure the port is ready TODO
		## timeout for communication
		self.timeout = timeout
		if autoconf:
			self.auto_config()
		else:
			## mode parameter of the IMU
			self.mode = None
			## settings parameter of the IMU
{'fraction_non_alphanumeric': 0.19531914893617022, 'fraction_numerical': 0.008085106382978723, 'mean_word_length': 4.610978520286396, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1091335', 'n_tokens_mistral': 722, 'n_tokens_neox': 652, 'n_words': 213}