Skip to content

Data logging does not work #40

@laurensvalk

Description

@laurensvalk

A program such as one of the following used to produce local text files on the host, but this no longer works in the new protocol.

# Output between the begin/end commands will be saved to "control.txt".
print("_file_begin_", "control.txt")
print("57,56,2,0,2,32000,4,84,4,88,50000,0,-18000,1073898496")
print("62,61,2,0,2,54500,4,91,4,90,50000,0,4500,65")
print("67,66,2,0,2,48000,5,100,5,106,75000,0,-27000,65")
print("72,71,2,0,2,48000,5,100,5,106,75000,0,-27000,65")
print("_file_end_")
from pybricks.pupdevices import Motor
from pybricks.tools import wait
from pybricks.parameters import Port
from pybricks import version

print(version)

# Initialize the motor.
motor = Motor(Port.A)

# Allocate the data logs.
DURATION = 4000
motor.log.start(DURATION)
motor.control.log.start(DURATION)

# Run the motor.
motor.run_target(500, 360)

# Wait so we can also log the stopped behavior.
wait(500)
motor.stop()

# Transfer data logs.
print("Transferring data...")
motor.log.save("servo.txt")
motor.control.log.save("control.txt")
print("Done")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions