socrob / acrobat_robot

Gazebo ROS Acrobat balancing 1 joint robot
2 stars 0 forks source link

Freezing Gazebo until services are called #2

Open DanielLSM opened 7 years ago

DanielLSM commented 7 years ago

We need to freeze Gazebo after calling each service, the ideia should be:

  1. Start Gazebo, Reset and Freeze Gazebo
  2. Call a Service with a certain Torque, unfreeze gazebo, let pass a certain rate
  3. Get angle, Freeze Gazebo

Details of another similar simulated environment https://github.com/openai/gym/wiki/Pendulum-v0

DanielLSM commented 7 years ago

This might solve the problem of resetting the gazebo by calling a service to reset the gazebo world:

Going to add it in the wrapper.

oscar-lima commented 7 years ago

brings the robot back to 90 degree (original) position

Imports:

    from std_srvs.srv import Empty

In constructor:

    self.srv = rospy.ServiceProxy ( '/service_name', Empty)

to call it from code:

    rospy.wait_for_service ('/service_name')
    self.srv()

I suggest to create a class out of it so that many services can be called with no code repetition.

DanielLSM commented 7 years ago

The class is the wrapper I'm doing here we still need to reset the arm under certain constraints everytime it is resetted, to prove the learning is robust.