Forum

Set encoder directi...
 
Notifications
Clear all

[Solved] Set encoder direction using SOLOPy

3 Posts
2 Users
0 Likes
306 Views
Forum 1
(@baymax)
Eminent Member
Joined: 1 year ago
Posts: 12
Topic starter  

I am controlling a motor in POSITION mode. When sending a position command using:

 self._solo.set_position_reference(enc_position)

I noticed that, assuming I start at encoder position = 0. If I send a negative target encoder position, my system goes up and if I send a positive target encoder position, my system goes down.

For convenience, I would like the negative direction to correspond to down and the positive direction to correspond to up.

I tried to use the Uart Write command: 0x0C in both clockwise and counter clockwise mode. The direction of rotation in POSITION mode didn't seem to change.

Is there a way to change the encoder direction using the python API? I looked through it and I couldn't find a command to do that.

Can you also confirm if the method "set_motor_direction" is only valid in SPEED/TORQUE? mode.

Cheers.

self._solo.set_motor_direction(solo.DIRECTION.CLOCKWISE)

# OR

self._solo.set_motor_direction(solo.DIRECTION.COUNTERCLOCKWISE)

This topic was modified 12 months ago by baymax

   
SOLO_Francesco
(@solo_francesco)
Chief Member
Joined: 2 years ago
Posts: 37
 

as you say in POSITION mode the set_position_reference already define the direction so it's not work with set_motor_direction.

You can test se same behavior in the Motion terminal too.

 

In any case for your application if make sense to have direction as a variable you can try to create a code implementation to reach it.

A idea can be:

self._solo.set_position_reference(my_direction*my_reference)

where

my_direction is a variable similar as set_motor_direction. In this case you can assign 1 or -1

my_referemce is a variable that define how many pulses you want to move. In this case you can assign only absolute value

 


   
Forum 1
(@baymax)
Eminent Member
Joined: 1 year ago
Posts: 12
Topic starter  

Copy that,
thanks for the feedback Francesco! 👍 


   
Share: