[[Tutorial]] If you have any question, please contact yoann.dutel@outlook.fr #contents *Introduction [#l64cca14] This sample consist at different function to control a robot in SIGVerse. You can : - Move the robot with a position control and speed just with destination coordinates. There are an option to move the robot with obstacle avoidance. - Move the two arm with a position control for each joint just with final value of joints. - Function to grasp and release an object. - Determine a new coordinate to grasp an object on a table. - Function to change of basis (world coordinate to robot coordinate) *Requirements [#f3d604ef] - Ubuntu 32/64 bit PC. (Ubuntu installed on virtual machine is also file) - SIGServer 2.2.2 or later - SIGViewer 2.2.0 or later *Robot controller [#xc8790c9] *** Download the source code from GitHub [#a58bb3c2] Download the template from the Github using the link here *** Build the project [#q07862eb] Build the source code in your working directory. $ make *** Run the program [#k54b69fc] Chooze your <xml> file for the environment. Include in the package, the <xml> of EGPSR environment. If you would change the environment, specify the ControlRobot.so and its location within workspace directory. #highlight(xml){{ <?xml version="1.0" encoding="utf8"?> <instanciate class="WheelRobot-nii-v1.xml" type="Robot"> <set-attr-value name="name" value="robot_000"/> <set-attr-value name="language" value="c++"/> <set-attr-value name="implementation" value="./ControlRobot.so"/> <set-attr-value name="dynamics" value="false"/> <set-attr-value name="x" value="0.0"/> <set-attr-value name="y" value="30.0"/> <set-attr-value name="z" value="0.0"/> <set-attr-value name="collision" value="true"/> <!--stereo camera right--> <camera id="1" link="REYE_LINK" direction="0.0 0.0 1.0" position="0.0 0.0 3.0"/> <!--stereo camera left--> <camera id="2" link="LEYE_LINK" direction="0.0 0.0 1.0" position="0.0 0.0 3.0"/> <!--distance sensor--> <camera id="3" link="WAIST_LINK0" direction="0.0 0.0 1.0" position="0.0 -5.0 20.0"/> <!--monitoring camera--> <camera id="4" link="WAIST_LINK2" direction="0 0 1" quaternion="0.0 0.0 -0.966 0.259" position="0.0 40.0 120.0"/> </instanciate> }} *** Starting the simulation [#bcbb7188] In your working directory : $ sigserver.sh -w ./house_example.xml *How use the template [#k54b69fc] You can use a demonstrator for each function in this template. You must send a specific command for each function. -To move the robot without obstacle avoidance --1) In SIGViewer, send the message "move" to the robot --2) In SIGServer, indicate the destination coordinate --3) In SIGServer, indicate "2" for avoidance -To move the robot with obstacle avoidance --1) In SIGViewer, send the message "move" to the robot --2) In SIGServer, indicate the destination coordinate --3) In SIGServer, indicate "1" for avoidance --Caution : the distance sensor is not completly operational -To move the arm --1) In SIGViewer, send the message "move_left_arm" or "move_right_arm" to the robot --2) In SIGServer, indicate the angle for each joints (refer to [[JointDefinition]] for the names) -To grasp an object on a table automatically --1) In SIGViewer, send the message "grasp_planning" to the robot --2) In SIGServer, indicate the name of the table and the object that you would grasp --This function is a little demonstration how we can use all functions -To get hand coordinates in robot basis --1) In SIGViewer, send the message "get_LeftHand" or "get_RightHand" to the robot --2) In SIGServer, you can see the coordinate of the hand. -To grasp an object --1) In SIGViewer, send the message "grasp_left" or "grasp_right" to the robot --2) In SIGServer, indicate the object name. -To release an object --1) In SIGViewer, send the message "release_left" or "release_right" to the robot * How use the different function in others task [#k54b69fc] *** goTo(Vector3d pos, double rangeToPoint=0, double Robot_speed=3) [#k54b69fc] This function is to move the robot in his environment. The robot go in straight line and his trajectory is automatically corrected during the movement. -This function has need : --getAngularXonVect --getDist2D --getRoll -Parameters --pos : the destination coordinates --rangeToPoint : the distance between coordinates and real position --Robot_speed : speed of the robot (initially : 3) -Return true if the position is reached -This function must be used only in OnAction *** goTo_AvoidObstacle(Vector3d pos, double rangeToPoint=0, double Robot_speed=3) [#k54b69fc] This function is to move the robot in his environment too but the trajectory is corrected if there is an obstacle in the front of the robot. Caution : this function is not totally finish. There are a bug with the distance sensor. -This function has need : --goTo --distance_sensor -Parameters --pos : the destination coordinates --rangeToPoint : the distance between coordinates and real position --Robot_speed : speed of the robot (initially : 3) -Return true if the position is reached -This function must be used only in OnAction *** distance_sensor() [#k54b69fc] This function return the distance between the camera and an obstacle. For more informations, refer to the tutorial [[Distance sensor]] -This function has need to be connect at SIGViewer with a ViewService -Return : the distance *** moveLeftArm() or moveRightArm() [#k54b69fc] These functions move the arm with a velocity in each joint. -These functions don't need others to run properly -Write the value of each joint in the global variable <m_joint_left[7]> or <m_joint_right[7]> -Return true if the angles value are reached -This function must be used only in OnAction ***grasp_left_hand(std::string &object) or grasp_left_hand(std::string &object)[#k54b69fc] These functions grasp an object in the robot hand. -These functions don't need others to run properly -Parameter : the name of the object to be grasped -Writes in a global variable if an object is grasped or not -It's possible to use these functions when we want ***release_left_hand() or release_right_hand() [#r948e68a] These functions release an object. -These functions don't need others to run properly -It's possible to use these functions when we want ***changeBasis_WorldToRobot(Vector3d pos) [#gb3837e2] This function transform a coordinate in world basis to a coordinate in robot basis. -This function has need only getRoll -Parameter : coordinate in world basis -Return : coordinate in robot basis #counter