ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
So I see a few issues here.
I don't see any rospy.spin()
or rospy.spinOnce()
calls. In order for your joint_callback
to be processed, you need to spin the node.
while not rospy.is_shutdown():
self.give_force()
self.rate.sleep()
rospy.spinOnce()
This is one place to add that.
Second, I don't see a definition of reset_simulation()
in the code you provided. You'll need to write a function that invokes your service there.
def robotcontrolloop():
if RobotControl() is not None:
reset_simulation()
In this function, you construct a RobotControl()
instance, check it is not None
, and call the reset_simulation
function. I would double check the layout of your functions. The flow of the program seems quite unclear to me. Hopefully the spin call fixes whatever issues you were having, but, if not, please update your question with the result, and a more clear explanation of what you are expecting to achieve with this node.
2 | No.2 Revision |
So I see a few issues here.
I don't see any rospy.spin()
or rospy.spinOnce()
calls. In order for your joint_callback
to be processed, you need to spin the node.
while not rospy.is_shutdown():
self.give_force()
self.rate.sleep()
rospy.spinOnce()
This is one place to add that.
Second, I don't see a definition of reset_simulation()
in the code you provided. You'll need to write a function that invokes your service there.
def robotcontrolloop():
if RobotControl() is not None:
reset_simulation()
In this function, you construct a RobotControl()
instance, check it is not None
, and call the reset_simulation
function. Since you have an infinite loop in the constructor, the reset_simulation()
function will never be called.
I would double check the layout of your functions. The flow of the program seems quite unclear to me. Hopefully the spin call fixes whatever issues you were having, but, if not, please update your question with the result, and a more clear explanation of what you are expecting to achieve with this node.