RIVeR-Lab / epos_hardware

Other
12 stars 39 forks source link

Changing velocity in "profile position" mode #15

Open VahidAminZ opened 7 years ago

VahidAminZ commented 7 years ago

I would like to change the velocity in the profile position mode. I can set it in the yaml but I would like to change it dynamically. I could not find a service (or dynamic reconfigure, etc.) to do so. Is it possible to do that with the existing package? If not, is there a reason why I cannot have a service to update the velocity?

JimmyDaSilva commented 7 years ago

So far it is not possible! operation_mode_ is set only in the constructor of the Epos class: https://github.com/RIVeR-Lab/epos_hardware/blob/indigo-devel/epos_hardware/src/util/epos.cpp#L39-L47

VahidAminZ commented 7 years ago

@JimmyDaSilva That is correct but I do not want to change the operationmode but change velocity in the "Profile position" mode. If I am not mistaken it is set here: https://github.com/RIVeR-Lab/epos_hardware/blob/indigo-devel/epos_hardware/src/util/epos.cpp#L411-L413

JimmyDaSilva commented 7 years ago

@VahidAminZ My bad ! That's it exactly. It's not coded anywhere in the ROS package, but in theory you could just call VCS(SetPositionProfile, velocity, acceleration, deceleration); any time to switch dynamically. You should try reading a param and calling this function inside Epos::write

That could be a great addition to this epos_hardware pacakge!

VahidAminZ commented 7 years ago

@JimmyDaSilva I am a bit hesitant to poll the parameter server in case core is on a remote machine. It may create a delay in the control loop. What do you think about a rosservice that gets motor serial number and new velocity and sets it?

JimmyDaSilva commented 7 years ago

@VahidAminZ Yes, a service seems to be more appropriate because the velocity should not change at each step of the control loop. You should try to see how the library responds to a sudden change of velocity.

VahidAminZ commented 7 years ago

@JimmyDaSilva I will give it a try. If it was reasonable I will do a pull request.

VahidAminZ commented 7 years ago

I added a service to change the velocity and submitted PR #19. I would appreciate any feedback.