Speed commands don't respect min/max position

Questions about using encoders with the Roboclaw product line
Post Reply
cengh
Posts: 7
Joined: Tue Jun 13, 2017 11:17 am
Speed commands don't respect min/max position

Post by cengh »

I have set up the Roboclaw 2x7A with encoders to use the position commands. Everything works well and it correctly stops when it reaches the min or max position I have set. However, these limits are not respected when I use the MixedSpeedDistance command. The Roboclaw moves right past the position limits. Is this by design? Are there any commands that I can use to control the Roboclaw using speed, accel and distance but still have it be limited by the min/max positions?
robof
Posts: 36
Joined: Tue Jun 27, 2017 11:21 pm
Re: Speed commands don't respect min/max position

Post by robof »

I could be wrong, but I believe that is the case and only position commands follow the min/max constraints.

However, you could do this with two commands right? Read your current encoder position, and add the distance you want to travel, to allow you to use a position command?
Something like this?

Code: Select all

distance_to_travel = 55000
address = 128
accel = 0
speed = 0
decel = 0
clear_buffer = 1

current_position = roboclaw.ReadEncM1(address)

new_position = current_position + distance_to_travel

roboclaw.SpeedAccelDeccelPositionM1(address, accel, speed, decel, new_position, clear_buffer)
cengh
Posts: 7
Joined: Tue Jun 13, 2017 11:17 am
Re: Speed commands don't respect min/max position

Post by cengh »

Thanks for your reply, @robof. Yes, I think you are right that using those two commands we could make it work. The down side is the latency that it would introduce to first read back the position and then set the accel/velocity/position. But I will give that a try. Thanks!
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Speed commands don't respect min/max position

Post by Basicmicro Support »

Yes, Velocity commands do not use the min and max position settings. Those are only used by the position commands(which is why the min and max position settings are only available in the Position settings screen).

If you need position limits, I recommend you use position control instead of velocity control. It takes a little more work(sometimes very little) to tune, but it will give you absolute position control which is what it sounds like you need.
cengh
Posts: 7
Joined: Tue Jun 13, 2017 11:17 am
Re: Speed commands don't respect min/max position

Post by cengh »

Thank you for your replies. One more question: is the MixedSpeedAccelDeccelPosition method considered a position command or a velocity command? It seems to accept both types of parameters.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Speed commands don't respect min/max position

Post by Basicmicro Support »

Yes, that is a position command. There are only three position commands. One for M1, one for M2 and one for both at once.

Post Reply