Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when configuring fieldfriend #59

Open
Johannes-Thiel opened this issue Jul 23, 2024 · 2 comments
Open

error when configuring fieldfriend #59

Johannes-Thiel opened this issue Jul 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Johannes-Thiel
Copy link
Collaborator

When the ESP is configured before configuring the ESp with a the startup, follwing error will occure:


2024-07-23 10:35:28.869 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "b"@61
2024-07-23 10:35:28.869 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: core 8416 0.000 0.000 false false 0 false false false true true false false false false 0.000 0.000 1 1 1 0 0 0 0 0 74756@6b
2024-07-23 10:35:28.869 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "b"@61
2024-07-23 10:35:28.870 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "t"@77
2024-07-23 10:35:28.870 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: core 8436 0.000 0.000 false false 0 false false false true true false false false false 0.000 0.000 1 1 1 0 0 0 0 0 74756@69
2024-07-23 10:35:28.870 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "t"@77
2024-07-23 10:35:28.870 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "t"@77
2024-07-23 10:35:28.871 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: core 8456 0.000 0.000 false false 0 false false false true true false false false false 0.000 0.000 1 1 1 0 0 0 0 0 74756@6f
2024-07-23 10:35:28.938 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "t"@77
2024-07-23 10:35:28.938 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: core 8475 0.000 0.000 false false 0 false false false true true false false false false 0.000 0.000 1 1 1 0 0 0 0 0 74756@6e
2024-07-23 10:35:28.939 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "t"@77
2024-07-23 10:35:28.939 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "t"@77
2024-07-23 10:35:28.939 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: core 8487 0.000 0.000 false false 0 false false false true true false false false false 0.000 0.000 1 1 1 0 0 0 0 0 74756@63
2024-07-23 10:35:28.940 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "v"@75
2024-07-23 10:35:28.940 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "y"@7a
2024-07-23 10:35:28.940 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: core 8506 0.000 0.000 false false 0 false false false true true false false false false 0.000 0.000 1 1 1 0 0 0 0 0 74756@6b
2024-07-23 10:35:28.940 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "y"@7a
2024-07-23 10:35:28.940 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: error: invalid token at range 0 1 "b"@61
2024-07-23 10:35:28.941 [DEBUG] rosys/hardware/communication/serial_communication.py:72: read: core 8526 0.000 0.000 false false 0 false false false true true false false false false 0.000 0.000 1 1 1 0 0 0 0 0 74756@69

This makes it impossible to comunicate with the core. It can be fixed by eraesing the flash and reflashing the ESP. When the configuration is the first configured it works.

I tried configuring a empty configuration beforehand but it still didn't work.

@Johannes-Thiel Johannes-Thiel added the bug Something isn't working label Jul 23, 2024
@Johannes-Thiel
Copy link
Collaborator Author

Johannes-Thiel commented Jul 23, 2024

When the fieldfriend config is overwritten, the new configuration works on the rb32. But when configuring the fieldfriend configuration the bug occurs again.

The fieldfriend configuration looks like this:
rdyp = Output(15)
en3 = Output(12)
bluetooth = Bluetooth("fieldfriend-ff12")
can = Can(32, 33, 1000000)
l0 = ODriveMotor(can, 0)
r0 = ODriveMotor(can, 512)
l1 = ODriveMotor(can, 256)
r1 = ODriveMotor(can, 768)
l0.m_per_tick = 0.05567092651757189
r0.m_per_tick = 0.05567092651757189
l1.m_per_tick = 0.05567092651757189
r1.m_per_tick = 0.05567092651757189
l0.reversed = true
r0.reversed = false
l1.reversed = true
r1.reversed = false
wheels = ODriveWheels(l0, r0)
wheels_front = ODriveWheels(l1, r1)
wheels.width = 0.47
wheels_front.width = 0.47
wheels.shadow(wheels_front)

serial = Serial(26, 27, 115200, 1)
p0 = Expander(serial, 25, 14)
master = CanOpenMaster(can)
master.sync_interval = 5

yaxis_motor = CanOpenMotor(can, 96)
yaxis_end_l = p0.Input(21)
yaxis_end_l.inverted = true
yaxis_end_r = p0.Input(19)
yaxis_end_r.inverted = true
yaxis = MotorAxis(yaxis_motor, yaxis_end_r, yaxis_end_l)

tornado_motor_z = ODriveMotor(can, 1280)
tornado_motor_turn = ODriveMotor(can, 1024)
tornado_motor_z.m_per_tick = 0.0019968051118210866
tornado_motor_turn.m_per_tick = 0.07987220447284345
tornado_motor_z.limits(1.5, 30)
tornado_motor_turn.limits(1.5, 30)
tornado_motor_z.reversed = true
tornado_motor_turn.reversed = true
tornado_end_top = p0.Input(32)
tornado_end_top.inverted = true;
tornado_end_bottom = p0.Input(5)
tornado_end_bottom.inverted = true;
tornado_ref_motor = p0.Input(35)
tornado_ref_motor.inverted = true;
tornado_ref_gear = p0.Input(18)
tornado_ref_gear.inverted = false;
tornado_ref_knife_stop = p0.Input(4)
tornado_ref_knife_stop.inverted = false;
tornado_ref_knife_ground = p0.Input(33)
tornado_ref_knife_ground.inverted = true;
tornado_z = MotorAxis(tornado_motor_z, tornado_end_bottom, tornado_end_top)

bool tornado_is_referencing = false;
bool tornado_ref_motor_enabled = false;
bool tornado_ref_gear_enabled = false;
when tornado_ref_motor_enabled and tornado_is_referencing and tornado_ref_motor.level == 0 then
    tornado_motor_turn.speed(0);
end
when tornado_ref_gear_enabled and tornado_is_referencing and tornado_ref_gear.level == 1 then
    tornado_motor_turn.speed(0);
end
bool tornado_knife_ground_enabled = false;
bool tornado_knife_stop_enabled = false;
when tornado_knife_ground_enabled and tornado_ref_knife_ground.level == 1 then
    tornado_motor_z.off();
end
when tornado_knife_stop_enabled and tornado_ref_knife_stop.level == 1 then
    en3.off();
    tornado_knife_stop_enabled = false;
end

flashlight = PwmOutput(5)
flashlight.duty = 255
flashlight_back = PwmOutput(4)
flashlight_back.duty = 255
flashlight.shadow(flashlight_back)

bms = p0.Serial(26, 27, 9600, 2)
bms.unmute()

estop_1 = Input(34)
estop_2 = Input(35)
battery_control_reset = p0.Output(15)
battery_control_status = p0.Input(13)

bumper_front_top = p0.Input(22)
bumper_front_bottom = p0.Input(12)
bumper_back = p0.Input(25)
rdyp_status = Input(39)
vdp_status = p0.Input(39)

let stop do wheels.speed(0, 0); yaxis.stop();tornado_z.stop();tornado_motor_turn.speed(0);end
when estop_1.level == 0 then stop(); end
when estop_2.level == 0 then stop(); end
when bumper_front_top.level == 1 or bumper_front_bottom.level == 1 or bumper_back.level == 1 then wheels.off(); end
when tornado_ref_knife_ground.active == false then wheels.speed(0, 0); yaxis.stop(); end
when core.last_message_age > 1000 then wheels.speed(0, 0); end
when core.last_message_age > 20000 then stop(); end

core.output("core.millis wheels.linear_speed:3 wheels.angular_speed:3 yaxis_end_l.active yaxis_end_r.active yaxis_motor.actual_position yaxis_motor.status_target_reached yaxis_motor.status_fault yaxis_motor.ctrl_enable tornado_end_top.active tornado_end_bottom.active tornado_ref_motor.active tornado_ref_gear.active tornado_ref_knife_stop.active tornado_ref_knife_ground.active tornado_motor_z.position:3 tornado_motor_turn.position:3 estop_1.level estop_2.level battery_control_status.level bumper_front_top.level bumper_front_bottom.level bumper_back.level rdyp_status.level vdp_status.level core.heap")
rdyp.on()
en3.on()

the same behaviour is observed on the z34 robot brain. when configuring the fieldfriend first it works. when it is configured later the bug occurs again.
While configuring the following error is thrown:

Sending: core.restart()
Sending: core.startup_checksum()
Traceback (most recent call last):
  File "./configure.py", line 48, in <module>
    raise ValueError('Checksum mismatch!')
ValueError: Checksum mismatch!

and the configuration is not succsessful.

@Johannes-Thiel
Copy link
Collaborator Author

Johannes-Thiel commented Aug 12, 2024

This issue is also occuring on the U4 with following startup
rdyp = Output(15)
en3 = Output(12)
bluetooth = Bluetooth("uckerbot-u4")
can = Can(32, 33, 1000000)
l0 = ODriveMotor(can, 0, 6)
r0 = ODriveMotor(can, 512, 6)
l1 = ODriveMotor(can, 256, 6)
r1 = ODriveMotor(can, 768, 6)
l0.m_per_tick = 0.05567092651757189
r0.m_per_tick = 0.05567092651757189
l1.m_per_tick = 0.05567092651757189
r1.m_per_tick = 0.05567092651757189
l0.reversed = false
r0.reversed = true
l1.reversed = false
r1.reversed = true
wheels = ODriveWheels(l0, r0)
wheels_front = ODriveWheels(l1, r1)
wheels.width = 0.47
wheels_front.width = 0.47
wheels.shadow(wheels_front)

serial = Serial(26, 27, 115200, 1)
p0 = Expander(serial, 25, 14)
y_axis_motor = StepperMotor(5, 4)
y_axis_alarm = Input(13)
y_axis_alarm.inverted = true
y_axis_end_l = p0.Input(21)
y_axis_end_l.inverted = true
y_axis_end_r = p0.Input(19)
y_axis_end_r.inverted = true
y_axis = MotorAxis(y_axis_motor, y_axis_end_r, y_axis_end_l)

tornado_motor_z = ODriveMotor(can, 1280, 6)
tornado_motor_turn = ODriveMotor(can, 1024, 6)
tornado_motor_z.m_per_tick = 0.0019968051118210866
tornado_motor_turn.m_per_tick = 0.07987220447284345
tornado_motor_z.limits(1.5, 30)
tornado_motor_turn.limits(1.3, 30)
tornado_motor_z.reversed = true
tornado_motor_turn.reversed = true
tornado_end_top = p0.Input(32)
tornado_end_top.inverted = true;
tornado_end_bottom = p0.Input(5)
tornado_end_bottom.inverted = true;
tornado_ref_motor = p0.Input(33)
tornado_ref_motor.inverted = true;
tornado_ref_gear = p0.Input(4)
tornado_ref_gear.inverted = false;
tornado_ref_knife_stop = p0.Input(35)
tornado_ref_knife_stop.inverted = false;
tornado_ref_knife_ground = p0.Input(18)
tornado_ref_knife_ground.inverted = true;
tornado_z = MotorAxis(tornado_motor_z, tornado_end_bottom, tornado_end_top)

bool tornado_is_referencing = false;
bool tornado_ref_motor_enabled = false;
bool tornado_ref_gear_enabled = false;
when tornado_ref_motor_enabled and tornado_is_referencing and tornado_ref_motor.level == 0 then
    tornado_motor_turn.speed(0);
end
when tornado_ref_gear_enabled and tornado_is_referencing and tornado_ref_gear.level == 1 then
    tornado_motor_turn.speed(0);
end
bool tornado_knife_ground_enabled = false;
bool tornado_knife_stop_enabled = false;
when tornado_knife_ground_enabled and tornado_ref_knife_ground.level == 1 then
    tornado_motor_z.off();
end
when tornado_knife_stop_enabled and tornado_ref_knife_stop.level == 1 then
    en3.off();
    tornado_knife_stop_enabled = false;
end

flashlight = p0.PwmOutput(2)
flashlight.duty = 204

bms = p0.Serial(26, 27, 9600, 2)
bms.unmute()

estop_1 = Input(34)
estop_2 = Input(35)
battery_control_reset = p0.Output(15)
battery_control_status = p0.Input(13)

bumper_front_top = p0.Input(12)
bumper_front_bottom = p0.Input(22)
bumper_back = p0.Input(25)
rdyp_status = Input(39)
vdp_status = p0.Input(39)

let stop do wheels.speed(0, 0); y_axis.stop();tornado_z.stop();tornado_motor_turn.speed(0);end
when estop_1.level == 0 then stop(); end
when estop_2.level == 0 then stop(); end
when bumper_front_top.level == 1 or bumper_front_bottom.level == 1 or bumper_back.level == 1 then wheels.off(); end
when tornado_ref_knife_ground.active == false then wheels.speed(0, 0); y_axis.stop(); end
when core.last_message_age > 1000 then wheels.speed(0, 0); end
when core.last_message_age > 20000 then stop(); end

core.output("core.millis wheels.linear_speed:3 wheels.angular_speed:3 l0.motor_error_flag r0.motor_error_flag l1.motor_error_flag r1.motor_error_flag y_axis_end_l.active y_axis_end_r.active y_axis_motor.idle y_axis_motor.position y_axis_alarm.active tornado_end_top.active tornado_end_bottom.active tornado_ref_motor.active tornado_ref_gear.active tornado_ref_knife_stop.active tornado_ref_knife_ground.active tornado_motor_z.position:3 tornado_motor_turn.position:3 tornado_motor_z.motor_error_flag tornado_motor_turn.motor_error_flag estop_1.level estop_2.level battery_control_status.level bumper_front_top.level bumper_front_bottom.level bumper_back.level rdyp_status.level vdp_status.level core.heap")
rdyp.on()
en3.on()
@JensOgorek and I found a startup that works
rdyp = Output(15)
en3 = Output(12)
bluetooth = Bluetooth("uckerbot-u4")
can = Can(32, 33, 1000000)
l0 = ODriveMotor(can, 0, 6)
r0 = ODriveMotor(can, 512, 6)
l1 = ODriveMotor(can, 256, 6)
r1 = ODriveMotor(can, 768, 6)
l0.m_per_tick = 0.05567092651757189
r0.m_per_tick = 0.05567092651757189
l1.m_per_tick = 0.05567092651757189
r1.m_per_tick = 0.05567092651757189
l0.reversed = false
r0.reversed = true
l1.reversed = false
r1.reversed = true
wheels = ODriveWheels(l0, r0)
wheels_front = ODriveWheels(l1, r1)
wheels.width = 0.47
wheels_front.width = 0.47
wheels.shadow(wheels_front)

serial = Serial(26, 27, 115200, 1)
p0 = Expander(serial, 25, 14)
y_axis_motor = StepperMotor(5, 4)
y_axis_alarm = Input(13)
y_axis_alarm.inverted = true
y_axis_end_l = p0.Input(21)
y_axis_end_l.inverted = true
y_axis_end_r = p0.Input(19)
y_axis_end_r.inverted = true
y_axis = MotorAxis(y_axis_motor, y_axis_end_r, y_axis_end_l)

tornado_motor_z = ODriveMotor(can, 1280, 6)
tornado_motor_turn = ODriveMotor(can, 1024, 6)
tornado_motor_z.m_per_tick = 0.0019968051118210866
tornado_motor_turn.m_per_tick = 0.07987220447284345
tornado_motor_z.limits(1.5, 30)
tornado_motor_turn.limits(1.3, 30)
tornado_motor_z.reversed = true
tornado_motor_turn.reversed = true
tornado_end_top = p0.Input(32)
tornado_end_top.inverted = true;
tornado_end_bottom = p0.Input(5)
tornado_end_bottom.inverted = true;
tornado_ref_motor = p0.Input(33)
tornado_ref_motor.inverted = true;
tornado_ref_gear = p0.Input(4)
tornado_ref_gear.inverted = false;
tornado_ref_knife_stop = p0.Input(35)
tornado_ref_knife_stop.inverted = false;
tornado_ref_knife_ground = p0.Input(18)
tornado_ref_knife_ground.inverted = true;
tornado_z = MotorAxis(tornado_motor_z, tornado_end_bottom, tornado_end_top)

bool tornado_is_referencing = false;
bool tornado_ref_motor_enabled = false;
bool tornado_ref_gear_enabled = false;
when tornado_ref_motor_enabled and tornado_is_referencing and tornado_ref_motor.level == 0 then
    tornado_motor_turn.speed(0);
end
when tornado_ref_gear_enabled and tornado_is_referencing and tornado_ref_gear.level == 1 then
    tornado_motor_turn.speed(0);
end
bool tornado_knife_ground_enabled = false;
bool tornado_knife_stop_enabled = false;
when tornado_knife_ground_enabled and tornado_ref_knife_ground.level == 1 then
    tornado_motor_z.off();
end
when tornado_knife_stop_enabled and tornado_ref_knife_stop.level == 1 then
    en3.off();
    tornado_knife_stop_enabled = false;
end

flashlight = p0.PwmOutput(2)
flashlight.duty = 204

bms = p0.Serial(26, 27, 9600, 2)
bms.unmute()

estop_1 = Input(34)
estop_2 = Input(35)
battery_control_reset = p0.Output(15)
battery_control_status = p0.Input(13)

bumper_front_top = p0.Input(12)
bumper_front_bottom = p0.Input(22)
bumper_back = p0.Input(25)
rdyp_status = Input(39)
vdp_status = p0.Input(39)

let stop do wheels.speed(0, 0); y_axis.stop();tornado_z.stop();tornado_motor_turn.speed(0);end
when estop_1.level == 0 then stop(); end
when estop_2.level == 0 then stop(); end
when bumper_front_top.level == 1 or bumper_front_bottom.level == 1 or bumper_back.level == 1 then wheels.off(); end
when tornado_ref_knife_ground.active == false then wheels.speed(0, 0); y_axis.stop(); end
when core.last_message_age > 1000 then wheels.speed(0, 0); end
when core.last_message_age > 20000 then stop(); end
core.print("................................................................tornado_ref_motor.active")
core.output("core.millis tornado_ref_gear.active tornado_ref_knife_stop.active tornado_ref_knife_ground.active tornado_motor_z.position:3 tornado_motor_turn.position:3 tornado_motor_z.motor_error_flag tornado_motor_turn.motor_error_flag estop_1.level estop_2.level battery_control_status.level bumper_front_top.level bumper_front_bottom.level bumper_back.level rdyp_status.level vdp_status.level core.heap")
rdyp.on()
en3.on()

but if one Point is added to the core.print("................................................................tornado_ref_motor.active") line the startup will break.

When the first startup is configured as the first startup after the new Lizard is flashed the startup will configure. But when the esp is enabled again(happens in rosys.on_startup(self.enable_esp) the configuration will break as described before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant