Hello dear!
I need help!
I am trying to set the velocity of the robot "Pioneer" as 1m/s ,in this way I should set the angular velocity of both motor as 10.56 rad/s(radius = 0.095), but the robot will slip on the floor because the velocity is so large and the trajectory will be influenced, I have searched the forum but I can't find the solution,so what should I do if I want to set the robot's velocity as 1m/s?
Thank you very much!
the Problem about set the velocity of Pioneer
-
- Posts: 4
- Joined: 10 Jun 2022, 09:52
Re: the Problem about set the velocity of Pioneer
Hello,
you will have to slowly accelerate the joint's velocity. You have many different approaches for that. One a little bit sofisticated way would be to use sim.ruckigVel together with sim.ruckigStep to compute the new velocity in each simulation step, and to apply it with sim.setJointTargetVelocity.
cheers
you will have to slowly accelerate the joint's velocity. You have many different approaches for that. One a little bit sofisticated way would be to use sim.ruckigVel together with sim.ruckigStep to compute the new velocity in each simulation step, and to apply it with sim.setJointTargetVelocity.
cheers
-
- Posts: 4
- Joined: 10 Jun 2022, 09:52
Re: the Problem about set the velocity of Pioneer
and it there any simple way? or is there any discuss about this topic?
Re: the Problem about set the velocity of Pioneer
If you want to perfectly control the velocity profile, then do something like:
maxAccelJerk is the maximum allowed acceleration and jerk value for each one of the two wheels. And targetVel is simply the desired target velocity for the left and right wheel.
Cheers
Code: Select all
function sysCall_init()
model=sim.getObject('.')
leftJointHandle=sim.getObject("./leftJoint_")
rightJointHandle=sim.getObject("./rightJoint_")
maxAccelJerk={1*math.pi/180,1*math.pi/180,1*math.pi/180,1*math.pi/180}
targetVel={90*math.pi/180,90*math.pi/180}
currentVel={0,0}
currentAccel={0,0}
end
function sysCall_actuation()
local dt=sim.getSimulationTimeStep()
local obj=sim.ruckigVel(2,dt,-1,{0,0,currentVel[1],currentVel[2],currentAccel[1],currentAccel[2]},maxAccelJerk,{1,1},targetVel)
local r,newPosVelAccel=sim.ruckigStep(obj,dt)
if r>=0 then
currentVel[1]=newPosVelAccel[3]
currentVel[2]=newPosVelAccel[4]
currentAccel[1]=newPosVelAccel[5]
currentAccel[2]=newPosVelAccel[6]
sim.setJointTargetVelocity(leftJointHandle,currentVel[1])
sim.setJointTargetVelocity(rightJointHandle,currentVel[2])
end
end
Cheers
-
- Posts: 4
- Joined: 10 Jun 2022, 09:52
Re: the Problem about set the velocity of Pioneer
Thank you for your detailed sharing!I will have a try!