Changing the speed of a "servo" from within child script
Posted: 19 Feb 2019, 16:48
I have a revolute joint in Torque/force mode, position is not cyclic and position has limits with a range of 180 degrees using -90 degrees as Pos.min.[deg] . Motor is enabeld in dynamic properties, a max torque is set and control loop is enabled. In my child script I need to set the position to move to using:
sim.setJointTargetPosition(MotorName,TargetAngle*math.pi/180)
But with my actual robotic hardware I have some control of how fast this (very slow moving, 2 degrees/sec max) joint actually moves. I can say "go there at 1.4 degrees/sec" or other such things. But I see no easy way to adjust the
Upper velocity limit [deg/s] parameter from my child script.
I cam across sim.jointfloatparam_upper_limit (2017) but found that joints need resetting whenever this is called, such a reset could end up causing my joint to experience physics engine drift over time, I'll be trying to change this upper speed limit many many times during my simulation runs. Is there any better way to set up a joint which I can command to a certain angle at a certain speed? I don't need complex control algorithms for this, my joint is very slow moving and I would expect it's turn velocity to be pretty constant throughout its motion between two positions. All I'm after is a basic "go to angle X at angular speed S (or at P% of the upper velocity limit)", ideally in a way where if, while that motion is in execution when a second "go to angle Y at speed Z" command gets sent then the joint would change direction and/or speed as necessary and head for the newly commanded position at the newly commanded speed.
Thanks
sim.setJointTargetPosition(MotorName,TargetAngle*math.pi/180)
But with my actual robotic hardware I have some control of how fast this (very slow moving, 2 degrees/sec max) joint actually moves. I can say "go there at 1.4 degrees/sec" or other such things. But I see no easy way to adjust the
Upper velocity limit [deg/s] parameter from my child script.
I cam across sim.jointfloatparam_upper_limit (2017) but found that joints need resetting whenever this is called, such a reset could end up causing my joint to experience physics engine drift over time, I'll be trying to change this upper speed limit many many times during my simulation runs. Is there any better way to set up a joint which I can command to a certain angle at a certain speed? I don't need complex control algorithms for this, my joint is very slow moving and I would expect it's turn velocity to be pretty constant throughout its motion between two positions. All I'm after is a basic "go to angle X at angular speed S (or at P% of the upper velocity limit)", ideally in a way where if, while that motion is in execution when a second "go to angle Y at speed Z" command gets sent then the joint would change direction and/or speed as necessary and head for the newly commanded position at the newly commanded speed.
Thanks