17 lines
633 B
Python
17 lines
633 B
Python
"""Read an in-memory motor; no SocketCAN or hardware connection."""
|
|
from a7_can_sdk import MotorBus
|
|
from a7_can_sdk.fake import FakeCan
|
|
from a7_can_sdk.protocol import PARAMETERS, read_parameter
|
|
|
|
motors = [dict(motor_id=61, host_id=253, uid='000000000000003d', raw_limits=[-2., 2.])]
|
|
frame = read_parameter(61, PARAMETERS['position'])
|
|
print('Position query:', hex(frame.can_id), frame.data.hex())
|
|
peer = FakeCan(motors, [.1])
|
|
bus = MotorBus(peer, motors, allow_control=False)
|
|
try:
|
|
bus.start()
|
|
print('Fake UID:', bus.identify(61))
|
|
print('Fake position (rad):', bus.read_parameter(61, 'position'))
|
|
finally:
|
|
bus.close()
|