Programming example of a joint (position control) | CoppeliaSim (V-REP)
ฝัง
- เผยแพร่เมื่อ 8 ก.พ. 2025
- This video explains how to control a joint in position using CoppeliaSim (V-REP).
If you want to contribute to these tutorials, please buy me a coffee:
www.paypal.me/...
This video is part of a set of video tutorials on learning how to simulate robots using CoppeliaSim (V-REP) software used in lab sessions in undergraduate robotic courses at the Universitat Poitècnica de València.
• A Complete CoppeliaSim...
Sir u r teaching method is very handy and great....
amazing!!!
In each simulation step, the software uses the last target value for the joint position. Writing several instructions to modify the position value has no effect, the last one will be the one used
For those who want to add position values one by one, use a threaded child script instead with the following code :
function sysCall_threadmain()
j = sim.getObjectHandle("Revolute_joint")
tolerance = 0.00001
targets = {-90*math.pi/180, 45*math.pi/180, 60*math.pi/180, 90*math.pi/180}
for i=1,#targets,1 do
sim.setJointTargetPosition(j,targets[i])
while math.abs(sim.getJointPosition(j)-targets[i])>=tolerance do
end
print("Target "..i.." reached")
end
end
Thank you very much for this Video!
Can you please tell me why did you give a rotation of 90 degrees as the joint is rotating 180 degrees?
hello sir, its abul , can u explain variables used in program ccw=false and ccw==true /false by giving another example to get better under stand
Hello friend Thank you very much for your videos. how can i send variable from matlab and get it in coppeliasim.
please make a video on servo motor simulation. i really need it.love from india
What do you need?
just make it, how is it difficult?
@@LeoArmesto i got my answer from your another video..thaankyou for these tutorials.
thank you sr but the only problem in this code is at the first operation the joint will need 10 seconds to rotate then it will need 5 seconds can you please tell us how we could use for loop instead? something like
for (L
Use a threaded scriptand just copy-paste the following code. Sit back, press the play button and have fun :)
function sysCall_threadmain()
j = sim.getObjectHandle("Revolute_joint")
tolerance = 0.00001
targets = {-90*math.pi/180, 45*math.pi/180, 60*math.pi/180, 90*math.pi/180}
for i=1,#targets,1 do
sim.setJointTargetPosition(j,targets[i])
while math.abs(sim.getJointPosition(j)-targets[i])>=tolerance do
end
print("Target "..i.." reached")
end
end
@@rithu02 thank you very much sr
if (sim.getSimultionTime % 5 === 0 and ccw=true) then ccw = false /n sim.setJointTargetPosition(joint,90*math.pi/180) elseif (sim.getSimultionTime % 5 === 0 and ccw=flase) then ccw = true /n sim.setJointTargetPosition(joint,-90*math.pi/180
sim.getObjectHandle is not working...what can i do???
These videos were created with a previous version of CoppeliaSim and that’s probably why you say that this function does not work. Check CoppeliaSim documentation for any update in the API