neurali:gazebo_connessione_ros
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
neurali:gazebo_connessione_ros [2016/02/26 03:05] – profpro | neurali:gazebo_connessione_ros [2020/06/08 22:20] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Connessione con ROS ====== | ||
+ | Gazebo **non è** più un [[neurali: | ||
+ | |||
+ | http:// | ||
+ | |||
+ | |||
+ | ===== rosurun e roslaunch ===== | ||
+ | |||
+ | [[neurali: | ||
+ | |||
+ | roslaunch è un comando che evita (con un piccolo file di testo.launch) | ||
+ | |||
+ | ;;; | ||
+ | |||
+ | ;;;; | ||
+ | |||
+ | - dopo aver inizializzato la shell (potrebbe essere necessario inizializzare le var. di ambiente) | ||
+ | - < | ||
+ | - (eventualmente) dopo aver avviato roscore | ||
+ | - < | ||
+ | roscore</ | ||
+ | - si può avviare con roslaunch il pacchetto gazebo_ros (di ros) contenente l' | ||
+ | - < | ||
+ | - e poi depositare il robot dentro | ||
+ | - < | ||
+ | - oppure, meglio ancora, si può avviare direttamente un file.launch che contiene tutto: world e robot | ||
+ | |||
+ | |||
+ | In merito a questo ultimo caso, bisogna ricordare che il pacchetto gazebo_ros contiene uno script python (spawm_model) che si raccomanda di usare quando si deve inserire in simulazione un nuovo robot basato su modello URDF. | ||
+ | | ||
+ | * dove si deve trovare il file MYROBOT.urdf | ||
+ | * | ||
+ | * di aggiungere questo testo in ~/ | ||
+ | * < | ||
+ | |||
+ | ;;;Si avvierà sia world che robot;;; | ||
+ | |||
+ | NOTA: se lavorassi solo con Gazebo potrei mettere il file.urdf nella cartella ~/.gazebo ma ciò non è bene se voglio lavorare dentro ROS: lo metto nel package | ||
+ | |||
+ | ====Editing the World File Within Gazebo===== | ||
+ | |||
+ | You can insert additional models into your robot' | ||
+ | ---- | ||
+ | |||
+ | http:// | ||
+ | |||
+ | |||
+ | The best way to use Gazebo launch files is to simply inherent/ | ||
+ | an example: | ||
+ | - package.xml < | ||
+ | - CMakeLists.txt | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | < | ||
+ | cmake_minimum_required(VERSION 2.8.3) | ||
+ | project(YOURROBOT_gazebo_plugins) | ||
+ | |||
+ | find_package(catkin REQUIRED COMPONENTS | ||
+ | gazebo_ros | ||
+ | ) | ||
+ | |||
+ | # Depend on system install of Gazebo | ||
+ | find_package(gazebo REQUIRED) | ||
+ | |||
+ | include_directories(include ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS} ${SDFormat_INCLUDE_DIRS}) | ||
+ | |||
+ | # Build whatever you need here | ||
+ | add_library(...) # TODO | ||
+ | |||
+ | catkin_package( | ||
+ | DEPENDS | ||
+ | gazebo_ros | ||
+ | CATKIN_DEPENDS | ||
+ | INCLUDE_DIRS | ||
+ | LIBRARIES | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | ===== rosrun ===== | ||
+ | |||
+ | http:// | ||
+ | |||
+ | dopo aver inizializzato la shell (potrebbe essere necessario inizializzare le var. di ambiente) | ||
+ | source / | ||
+ | |||
+ | (eventualmente) dopo aver avviato roscore | ||
+ | |||
+ | source ~/ | ||
+ | roscore | ||
+ | |||
+ | si può avviare Gazebo usando il pacchetto gazebo_ros in ros | ||
+ | |||
+ | < | ||
+ | rosrun gazebo_ros gazebo | ||
+ | rosrun gazebo_ros gzserver | ||
+ | rosrun gazebo_ros gzclient | ||
+ | rosrun gazebo_ros spawn_model | ||
+ | rosrun gazebo_ros perf | ||
+ | rosrun gazebo_ros debug | ||
+ | roslaunch gazebo_ros empty_world.launch | ||
+ | </ | ||
+ | |||
+ | e si può testare | ||
+ | |||
+ | rostopic list | ||
+ | |||
+ | rosservice list |
neurali/gazebo_connessione_ros.txt · Last modified: 2020/06/08 22:20 by 127.0.0.1