ros_control - a proper position initialization approach?
I'm setting up MoveIt! to drive a position-controlled "hobby arm" as a learning exercise. I can interface with controller_manager successfully in my main() routine that invokes a hardware_interface implementation with read() and write() calls. Currently I am loading my URDF, launching the controllers & controller_manager, and launching robot_state_publisher from one launch file, and some time later, starting up MoveIt! using a launch file I derived from demo.launch.
The problem is, with no one commanding ros_control at startup, when I launch the first launch file, it tends to initialize the robot in an undesirable pose (a few days ago by initializing all joints to zero, yesterday by initializing all joints to 1.57...). What is the proper bring-up procedure is for a robot that is controlled using ros_control? Where is the right time and place to set the robot's desired initial pose?
I've looked at the ROScon 2014 presentation, I've written the URDF, a ros_control hardware_interface implementation that works, MoveIt! can drive robot arm trajectories on my measly AL5D robot. (As a ROS newbie, getting this far has not been as trivial as it sounds...). So it's not that it doesn't work once everything's up. It's that I want this thing to be predictable when it is being initialized, and equally predictable when it is being brought offline. Right now it has the "left hand of God" preventing it from taking chunks out of my table when I start the first launch file.
I'm not sure how much specific XML/code you need to see, so I thought I'd stop here and see if someone can point me somewhere for the info I have yet to find to guide me.
I'm sure @Adolfo Rodriguez T will be able to give you some pointers, but in the mean time, providing access to your hardware interface implementation and surrounding infrastructure would probably help remove some guesswork from potential answers.