End switches an interrupts


split this topic #26

2 posts were split to a new topic: How to use github?


How to use github?
#27

Yes, I am having the same result. All parameter configuration settings gone.

Thanks


#28

Hi,
other values like “odrv0.axis0.config.startup_closed_loop_control = False”
where also not saved.

@hbtousa
I think we have to wait till Wetmelon has finished the Trajectory Planner.

Greetings / Zennix


#29

Yes. The wait is worth it. I handled to make it work without it ;but, the switch and ramp features will be excellent improvements.My project

Thanks


#30

@hbtousa I think you can use the “echo” effect in after-effects (or premiere pro maybe) to properly show off the POV trails:


#31

@Zennix @hbtousa Please pull the most recent Endstops branch to test with. I was able to fix the saving issue on my end, but I don’t have a good way to test the other settings. I also updated this branch to the most recent devel version, so it has other fixes.


#32

@Wetmelon
Thank you for the new version. Here is what I found:

  1. Saving is working now
  2. Homing is not working

In [88]: odrv0.axis0.requested_state = 9
In [89]: odrv0.axis0.current_state
Out[89]: 8

The motor is not going to search the home position. It stands in closed_loop.

  1. emergency stop
    During a pos_setpoint command, pressing an endstop switch has no effect.

My config:

In [101]: odrv0.axis0.min_endstop
Out[101]:
config:
gpio_num = 5 (int)
enabled = True (bool)
offset = -1000 (int)
is_active_high = False (bool)
debounce_ms = 100.0 (float)

In [102]: odrv0.axis0.max_endstop
Out[102]:
config:
gpio_num = 6 (int)
enabled = True (bool)
offset = 0 (int)
is_active_high = False (bool)
debounce_ms = 100.0 (float)

In a previous version was a min_endstop_state and max_endstop_state. Could you please add it again?

I added the

make_protocol_property(“endstop_state”, &endstop_state_)

in endstop.hpp.
If I press a switch it will not be shown in

In [16]: odrv0.axis0.max_endstop
Out[16]:
config:
gpio_num = 0 (int)
enabled = False (bool)
offset = 0 (int)
is_active_high = False (bool)
debounce_ms = 100.0 (float)
endstop_state = False (bool)

Greetings / Zennix


#33

New version available.

  • Tested and working at startup
  • Tested and working with requested_state = 9
  • Offset tested and working
  • Tested and working. Commanded large 3,000,000 count move, and pressed home switch, which immediately stopped the motor and threw error 0x801

All tests completed on both axis0 and axis1. Active High and Active Low settings both tested


#34

Hi Zennix, does this mean we will see the actuators in action very soon?

Jerry.:grinning:


#35

@Jerry, yes hopefully, that’s the missing thing. :crossed_fingers:

@Wetmelon
Thanks for your work. Here are my findings:

  1. GPIOs
    are correct.

  2. Homing

In [36]: odrv0.axis0.max_endstop.config
Out[36]:
gpio_num = 6 (int)
enabled = True (bool)
offset = 0 (int)
is_active_high = False (bool)
debounce_ms = 100.0 (float)

In [37]: odrv0.axis0.min_endstop.config
Out[37]:
gpio_num = 5 (int)
enabled = True (bool)
offset = -500 (int)
is_active_high = False (bool)
debounce_ms = 100.0 (float)

I double checked that the correct states are shown. Thank for integrating the states again.

In [44]: odrv0.axis0.min_endstop.endstop_state_
Out[44]: False

In [45]: odrv0.axis0.min_endstop.endstop_state_
Out[45]: True

After giving a:

odrv0.axis0.requested_state = AXIS_STATE_HOMING

The motor is spinning, but no reaction to the min or max switch.

  1. Emergency stop
    Want to test the moving but the commands didn’t move the motor anymore.
    AXIS_STATE_CLOSED_LOOP_CONTROL seems to be working, the motor holds it’s position.
    But no move.

Reconnected to ODrive 375F365A3137 as odrv0
In [54]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL

In [55]: odrv0.axis0.controller.set_pos_setpoint = 0

In [56]: odrv0.axis0.controller.set_pos_setpoint = 1000

Seems that my version from 22th September isn’t the same as yours.

Greetings / Zennix


#36

I did some additional testing.

GPIO 5 is my min_switch
GPIO 6 is my max_switch

Both GPIO states are shown correct.

pressed min_switch
In [28]: odrv0.axis0.min_endstop.endstop_state_
Out[28]: True
released min_switch
In [29]: odrv0.axis0.min_endstop.endstop_state_
Out[29]: False

pressed max_switch
In [30]: odrv0.axis0.max_endstop.endstop_state_
Out[30]: True
released max_switch
In [31]: odrv0.axis0.max_endstop.endstop_state_
Out[31]: False

  1. Homing
    GPIO5 is not recognised. Motor didn’t stop by pressing the min_switch

  2. Emergency stop

Reconnected to ODrive 375F365A3137 as odrv0
In [52]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
In [53]: odrv0.axis0.controller.set_pos_setpoint = 1000

has no effect. Motor is not spinning.

With an ASCII command the motor is spinning. The max_switch stops the motor. The min_switch has no effect.

Greetings / Zennix


#37

odrv0.axis0.controller.set_pos_setpoint = 1000 does nothing

odrv0.axis0.controller.set_pos_setpoint(1000, 0, 0) or odrv0.axis0.controller.pos_setpoint = 1000 are the correct commands

I specifically tested GPIO5, so that’s weird. I will check the differences with ASCII commands but I don’t think that should have any difference from USB (just your incorrect command)


#38

Oh Sorry :relaxed: You are right, thats the wrong command. I’m testing mostly with the ASCII interface.

Homing and emergency stop is working with GPIO 6 - 8. -> Great work!!! :clap:
GPIO 5 and 4 are recognised in AXIS_STATE_IDLE only. In AXIS_STATE_HOMING they have no effect.

For debouncing I had to add two caps 47nF between the GPIOs and GND.

I checked also if I can use one GPIO for both max_switches. That works. That stops both axis. :+1:

Thanks / Greetings / Zennix


#39

Just updated to firmware 4.6, was hoping this would be in it, but I can’t seem to find odrv0.axis0.max_endstop. Any news on when this branch will be merged into the main branch?


#40

Hi,

there is still a problem with GPIO less than 6. Could you verify that?
If you only need 3 switches your are fine. But some applications will need four switches and I can’t get these GPIOs to work.

Greetings / Zennix


#41

I’m not really sure how to install the end-stop branch to my odrive with the DFU tool, since I don’t have an ST-Link.


6 DOF racesimulator
#42

My suggestion is to have ST-Link. Sometimes my ODrive wasn’t accessible after a shutdown. The only way to get it working again was to flash it with the ST-Link.
On the other hand, if you want to send ASCII commands, there is already the serial timeout bug. To do the workaround like described here: Serial Timeout Issue
you have to modify the firmware. With a ST-Link it’s much easier.

Greetings Zennix


#43

I would really like to use this feature, but it still hasn’t been included in the main release. Can I help out with testing without an ST-Link, or is it too risky? If so, how? I have the hardware setup necessary to test end switches.


#44

Please do help out! You’ll just have to pull the Endstops branch. I’m not 100% sure how to flash the firmware without an ST-Link, you can probably do some sort of DFU once you build the firmware though.


#45

An STlink clone is stupid cheap. Like cheaper than the screw terminals on the ODrive.
$2.02 (US) free shipping on AliExpress


Less than $10 on amazon
I consider it pretty much a requirement to work with the ODrive.