Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
simulators [2019/02/12 13:04] mgp3212019 created |
simulators [2019/04/25 14:08] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | Simulateur Gazebo | + | {{tag> software simulator project}} |
- | Prérequis : | + | Common API for reinforcement learning using the simulators : |
- | + | ||
- | Environnement Linux : Ubuntu 18.04 | + | |
- | + | ||
- | Installation du ROS Melodic : | + | |
- | + | ||
- | Modification du “sources.list”: | + | |
- | sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' | + | |
- | + | ||
- | Mettre en place les clés : | + | |
- | sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 | + | |
- | + | ||
- | Installation : | + | |
- | sudo apt update | + | |
- | sudo apt install ros-melodic-desktop-full | + | |
- | + | ||
- | + | ||
- | Initialisation rosdep : | + | |
- | sudo rosdep init | + | |
- | rosdep update | + | |
- | + | ||
- | Configuration environnement : | + | |
- | echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc | + | |
- | source ~/.bashrc | + | |
- | + | ||
- | Installation des packages dépendants : | + | |
- | sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential | + | |
- | + | ||
- | + | ||
- | [Explication porvenant de : http://wiki.ros.org/melodic/Installation/Ubuntu] | + | |
+ | * Gym : http://wiki-robot.enstb.org/doku.php?id=simulatorGym | ||
- | Intégration Turtlebot3: | + | * Gazebo : http://wiki-robot.enstb.org/doku.php?id=simulatorGazebo |
- | Création des répertoires: | + | * Vrep : http://wiki-robot.enstb.org/doku.php?id=simulatorVrep |
- | mkdir ~/catkin_ws | + | |
- | mkdir ~/catkin_ws/src | + | |
- | + | ||
- | Télécharger des codes sources de Turtlebot3: | + | |
- | cd ~/catkin_ws/src/ | + | |
- | git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git | + | |
- | git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git | + | |
- | git clone https://github.com/ROBOTIS-GIT/turtlebot3.git | + | |
- | + | ||
- | Installation: | + | |
- | cd ~/catkin_ws && catkin_make | + | |
- | + | ||
- | Configuration environnement: | + | |
- | Ajouter les lignes suivantes dans le fichier “~/.bashrc”: | + | |
- | source ~/catkin_ws/devel/setup.bash | + | |
- | export TURTLEBOT3_MODEL=burger | + | |
- | + | ||
- | [Explication porvenant de : http://emanual.robotis.com/docs/en/platform/turtlebot3/simulation/] | + | |
- | + | ||
- | + | ||
- | Utilisation des codes sources pour la partie Gazebo : | + | |
- | + | ||
- | Les codes sources contiennent deux fichier “gazeboEntity.py” et “simGazebo.py” qui se situent dans le répertoire “program_gazebo” sur la branche “dev-Yao_ZHAO”. | + | |
- | + | ||
- | Le fichier gazeboEntity.py contient les méthodes suivantes: | + | |
- | + | ||
- | __init__ : | + | |
- | La méthode de construction, deux paramètes “model_name” et “relative_entity_name” sont nécessaires. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | + | ||
- | pre_get_model_state : | + | |
- | Initialisation des paramètres pour utiliser le service “/gazebo/get_model_state”, ceci est appelée dans les méthodes get_position,get_orientation,get_linear et get_angular. | + | |
- | + | ||
- | get_position : | + | |
- | Permet de récupérer la position d’un objet. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | model.get_position() | + | |
- | + | ||
- | get_orientation : | + | |
- | Permet de récupérer l’orientation d’un objet. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | model.get_orientation() | + | |
- | + | ||
- | get_linear : | + | |
- | Permet de récupérer la vitesse linéaire. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | model.get_linear() | + | |
- | + | ||
- | get_angular : | + | |
- | Permet de récupérer la vitesse angulaire. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | model.get_angular() | + | |
- | + | ||
- | remove_entity : | + | |
- | Permet de supprimer un objet. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | model.remove_entity() | + | |
- | + | ||
- | set_model_position : | + | |
- | Permet de modifier la position d’un objet, trois paramètres les positions x,y,z sont nécessaires. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | model.set_model_position(2,2,0) | + | |
- | + | ||
- | set_model_orientation : | + | |
- | Permet de modifier l’orientation d’un objet, trois paramètres les orientations x,y,z sont nécessaires. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | model.set_model_orientation(0,0,-1) | + | |
- | + | ||
- | move_robot : | + | |
- | Permet de faire avancer le turtlebot, une liste contenant une vitesse linéaire et une vitesse angulaire est nécessaire. | + | |
- | Exemple d’utilisation: | + | |
- | model = GazeboEntity("turtlebot3_burger","world") | + | |
- | try: | + | |
- | model.move_robot(list) | + | |
- | except rospy.ROSInterruptException: | + | |
- | pass | + | |
- | + | ||
- | + | ||
- | Le fichier simGazebo.py contient les méthodes suivantes: | + | |
- | + | ||
- | start : | + | |
- | Permet de démarrer une simulation. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.start() | + | |
- | + | ||
- | enPause : | + | |
- | Permet de mettre en pause la simulation. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.enPause() | + | |
- | + | ||
- | resetSimulation : | + | |
- | Permet de réinitialiser la simuation (timing, les positions des objets...) | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.resetSimulation() | + | |
- | + | ||
- | resetWorld : | + | |
- | Permet de réinitialiser le world. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.resetWorld() | + | |
- | + | ||
- | getListModel : | + | |
- | Permet de récupérer la liste des objet dans le world. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.getListModel() | + | |
- | + | ||
- | getSimTime : | + | |
- | Permet de récupérer le temps de simulation. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.getSimTime() | + | |
- | + | ||
- | loadWorld : | + | |
- | Permet de charger un world, une paramètre d’une liste des ficher launcher est nécessaire. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | list = ['/home/yao/catkin_ws/src/turtlebot3_simulations/turtlebot3_gazebo/launch/turtlebot3_stage_1.launch'] | + | |
- | simulateur.loadWorld(list) | + | |
- | + | ||
- | callbackAllProperties : | + | |
- | Fonction callback appelé par la fonction getAllProperties. | + | |
- | + | ||
- | callbackListModel : | + | |
- | Fonction callback appelé par la fonction getListModelBySuscriber. | + | |
- | + | ||
- | callbackPose : | + | |
- | Fonction callback appelé par la fonction getAllPose. | + | |
- | + | ||
- | callbackTwist : | + | |
- | Fonction callback appelé par la fonction getAllTwist. | + | |
- | + | ||
- | getAllProperties : | + | |
- | Permet de récupérer tous les properties de tous les objets de type Suscriber. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.getAllProperties() | + | |
- | + | ||
- | getListModelBySuscriber : | + | |
- | Permet de récupérer une liste des objets dans le world de type Suscriber. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.getListModelBySuscriber() | + | |
- | + | ||
- | getAllPose : | + | |
- | Permet de récupérer les positions et les orientations des objets dans le world de type Suscriber. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.getAllPose() | + | |
- | + | ||
- | getAllTwist : | + | |
- | Permet de récupérer les vitesse des objets dans le world de type Suscriber. | + | |
- | Exemple d’utilisation: | + | |
- | simulateur = Simulator() | + | |
- | simulateur.getAllTwist() | + | |
+ | Code is onhttps://github.com/Pikalchemist/lems/tree/livrable_FIP (branch livrable_FIP) |