rofunc.devices.xsens.record#

1.  Module Contents#

1.1.  Classes#

Header

Datagram

XsensInterface

1.2.  Functions#

byte_to_str

byte_to_float

byte_to_uint32

byte_to_uint16

byte_to_uint8

on_press

record

record xsens motion data :param root_dir: root directory :param exp_name: npy file location :param ip: ip address of server computer :param port: port number of optitrack server :param ref_frame: reference frame :return:

1.3.  Data#

event

1.4.  API#

rofunc.devices.xsens.record.event = None#
rofunc.devices.xsens.record.byte_to_str(data, n)[source]#
rofunc.devices.xsens.record.byte_to_float(data)[source]#
rofunc.devices.xsens.record.byte_to_uint32(data)[source]#
rofunc.devices.xsens.record.byte_to_uint16(data)[source]#
rofunc.devices.xsens.record.byte_to_uint8(data)[source]#
class rofunc.devices.xsens.record.Header(header)[source]#

Initialization

property is_valid#
property is_object#

External tracked object’s datagram have less segments than body datagram.

property item_num#
property item_size#

Define how many bytes in a item

class rofunc.devices.xsens.record.Datagram(header, payload)[source]#

Bases: object

Initialization

property is_object#
decode_to_pose_array_msg(ref_frame, ref_frame_id=None, scaling_factor=1.0)[source]#

Decode the bytes in the streaming data to pose array message. Args:

ref_frame: str Reference frame name of the generated pose array message. ref_frame_id: None/int If not None, all poses will be shifted subject to

the frame with this ID. This frame should belong to the human.

scaling_factor: float Scale the position of the pose if src_frame_id is not None.

Its value equals to the robot/human body dimension ratio

Returns:

pose_array_msg:

class rofunc.devices.xsens.record.XsensInterface(udp_ip, udp_port, ref_frame, scaling=1.0, buffer_size=4096, **kwargs)[source]#

Bases: object

Initialization

get_datagram()[source]#

[Main entrance function] Get poses from the datagram.

save_file_thread(root_dir: str, exp_name: str) None[source]#

save xsens motion data to the file Args:

root_dir: root dictionary exp_name: dictionary saving the npy file, named according to time

Returns:

None

rofunc.devices.xsens.record.on_press(key)[source]#
rofunc.devices.xsens.record.record(root_dir: str, exp_name: str, ip: str, port: int, ref_frame: str = None) None[source]#

record xsens motion data :param root_dir: root directory :param exp_name: npy file location :param ip: ip address of server computer :param port: port number of optitrack server :param ref_frame: reference frame :return: