SMACH: SpawnSphere


#1

Hi,
I’m Marco and I’m using the online platform.
I’m new in using SMACH and I’d like to use the function SpawnSphere.
I know how to set the parameters, but i still cannot figure out the type of the “position” parameter and if I’m using well the transitions.
This is the code I’m using:

StateMachine.add( 
      "spawn_ball_1", 
      state.SpawnSphere("ball 1", radius= "0.5",position=  ("0","0","0"), gravity_factor="0"),
      transitions = {"succeeded": FINISHED,
                     "aborted": FINISHED,
                     "preempted": PREEMPTED}

Are these transitions right? How can i set the position?

Best regards,
Marco


#2

Hi, here and example:

from hbp_nrp_excontrol.nrp_states import SpawnSphere
from geometry_msgs.msg import Point

initialSpherePos = Point(0.5, -0.25, 0.05)

StateMachine.add('SPAWN_OBJECT',
                 SpawnSphere(model_name="tracked_sphere", radius=0.05,
                             position=initialSpherePos, gravity_factor=0),
                 transitions={'succeeded': 'NEXT_STATE', 'aborted': ERROR, 'preempted': PREEMPTED})ù

Cheers,

Ugo


#3

Thank you very much.