function sysCall_init()
-- Get some handles:
joint=sim.getObjectHandle('Joint')
-- Enable an image publisher and subscriber:
sub=simROS.subscribe('/joint_topic', 'std_msgs/Float64', 'joint_callback')
simROS.subscriberTreatUInt8ArrayAsString(sub) -- treat uint8 arrays as strings (much faster, tables/arrays are kind of slow in Lua)
end
function joint_callback(msg)
-- Apply the received image to the passive vision sensor that acts as an image container
print(msg.data)
--sim.setJointTargetVelocity(joint,msg.data)
sim.setJointPosition(joint,(math.pi/180) *msg.data)
end
function sysCall_cleanup()
simROS.shutdownSubscriber(sub)
end
sim.setJointPosition is not working inside the call back function but interesting thing is that sim.setJointTargetVelocity is working properly.
please help me
Thank you
second, what do you mean with it is not working? Is there a message error? What is the behaviour? Of course, if your joint is in force/torque mode with position control enabled, then you can't use sim.setJointPosition. You'll have to use sim.setJointTargetPosition.
second, what do you mean with it is not working? Is there a message error? What is the behaviour? Of course, if your joint is in force/torque mode with position control enabled, then you can't use sim.setJointPosition. You'll have to use sim.setJointTargetPosition.
Cheers
it is not working means
whenever i publish 60 to the topic it joint should move to 60 degree due to the command sim.setJointPosition but joint is not moving at all. Same problem is facing while using the sim.setJointTargetPosition and my joint is in force/torque mode with position control enabled. there is no error msg during the execution.
how can i use sim.setJointPosition in callback function???
sir i have used sim.setJointPosition in sysCall_actuation and it is working means it is going to desired position in force/torque mode with position control enabled.
If your joint doesn't move, you have research the cause in the joint mode and the resulting behaviour. Make sure to read and understand Joint types and operation.