Skip to content

Commit

Permalink
Merge pull request #7 from ThundeRatz/physics
Browse files Browse the repository at this point in the history
Atualização parâmetros físicos
  • Loading branch information
LucasHaug authored May 12, 2020
2 parents 6af3ce7 + acf0559 commit f9fc66d
Show file tree
Hide file tree
Showing 36 changed files with 303 additions and 191 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ missing
.tags*
*.save*

# Python compiled files
*.pyc

# Hidden files
..*

Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
},
"python.linting.pycodestyleEnabled": true,
"python.linting.enabled": true,
"python.linting.pep8Enabled": true,
}
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Changelog

## v2.0.0-alpha

- Quebra de compatibilidade com a v1.0.0
- Tópicos recebem o valor do **torque em Nm**
- /robotX/vss_robot_left_controller/command
- /robotX/vss_robot_right_controller/command
- Padronização da nomenclatura com o VSSVision
- Simulação do atrito seco e viscoso no movimento das rodas
- Adição do ```effort_controllers``` como dependência

### Problemas conhecidos

- Propriedades físicas da bola
- A simulação falha em iniciar ocasionalmente

## v1.0.0 - Iron Cup 2020

- Primeira versão funcional
- Projeto mecânico v1.1 - Thalles e Diego
- Controle dos motores pela **velocidade em rad/s**
- /robot_X/vss_robot_left_controller/command
- /robot_X/vss_robot_right_controller/command
- Ambientes de simulação
- Robô único
- Time de 3
- Partida 3x3
- Adição do ```velocity_controllers``` como dependência

### Problemas conhecidos

- Propriedades físicas da bola
- Comportamento dos motores ideal demais - longe da realidade
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ find_package(catkin REQUIRED)

catkin_package()

# find_package(?roslaunch)

find_package(catkin REQUIRED COMPONENTS
geometry_msgs
roscpp
Expand All @@ -16,7 +14,7 @@ find_package(catkin REQUIRED COMPONENTS
gazebo_msgs
)

foreach(dir config launch meshes urdf)
foreach(dir config launch meshes urdf media worlds models)
install(DIRECTORY ${dir}/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
endforeach(dir)
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Projeto de simulação de um time IEEE VSS em um campo oficial em ROS utilizando
- [Screenshots](#screenshots)
- [Simulação de um robô](#simula%c3%a7%c3%a3o-de-um-rob%c3%b4)
- [Simulação do time](#simula%c3%a7%c3%a3o-do-time)
- [Simulação da partida](#simula%c3%a7%c3%a3o-da-partida)
- [TODO](#todo)

## Introdução
Expand Down Expand Up @@ -65,8 +66,8 @@ geometry_msgs/Twist[] twist # desired twist in world frame

Este pacote de simulação possui um script python que se increve no tópico do Gazebo e republica a informação nos 7 tópicos esperados pelo [ThunderVolt](https://github.com/ThundeRatz/vss_thundervolt):

- **/vision/robot_[0...2]** - Tópicos para os robôs do nosso time
- **/vision/foe_[0...2]** - Tópicos para os robôs adversários
- **/vision/robot[1...3]** - Tópicos para os robôs do nosso time
- **/vision/foe[1...3]** - Tópicos para os robôs adversários
- **/vision/ball** - Tópico para a bola

Todas as unidades estão no SI, distâncias estão em metros, ângulos estão em radianos, velocidade linear está em m/s e velocidade angular estã em rad/s
Expand Down Expand Up @@ -112,10 +113,10 @@ A simulação é desenvolvida para ROS e Gazebo, é recomendável instalar ambos
sudo apt install ros-melodic-desktop-full
```

O projeto depende do pacote velocity_controllers dentro da biblioteca [ros_controllers](https://github.com/ros-controls/ros_controllers) e da biblioteca python [pygame](https://github.com/pygame/pygame). É possível instalar com ```apt-get```
O projeto depende do pacote velocity_controllers e do effort-controllers dentro da biblioteca [ros_controllers](https://github.com/ros-controls/ros_controllers) e da biblioteca python [pygame](https://github.com/pygame/pygame). É possível instalar com ```apt-get```

```bash
sudo apt install ros-melodic-velocity-controllers python-pygame
sudo apt install ros-melodic-velocity-controllers ros-melodic-effort-controllers python-pygame
```

Ou usando ```rosdep```
Expand All @@ -130,7 +131,7 @@ A simulação é construída em volta da versão 1.1 do robô de VSS do time Thu

## Cores no Gazebo

Para uma lista das cores disposníveis no Gazebo, confira o arquivo de configuração do [repo oficial](https://bitbucket.org/osrf/gazebo/src/gazebo11/media/materials/scripts/gazebo.material)
Para uma lista das cores disponíveis no Gazebo, confira o arquivo de configuração do [repo oficial](https://bitbucket.org/osrf/gazebo/src/gazebo11/media/materials/scripts/gazebo.material). Temos também um [script OGRE](./media/materials/scripts/vss.material) para a definição de cores customizadas ([ref](http://gazebosim.org/tutorials?tut=color_model) do Gazebo a respeito).

## Screenshots

Expand All @@ -148,4 +149,5 @@ Para uma lista das cores disposníveis no Gazebo, confira o arquivo de configura

## TODO

Completar documentação.
- Completar documentação.
- Atualizar screenshots
18 changes: 18 additions & 0 deletions config/motor_effort.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ref:
# https://answers.ros.org/question/326628/how-to-control-velocity-of-joints-in-gazebo-using-ros_controllers/

vss_robot_left_controller:
type: effort_controllers/JointEffortController
joint: roda_esq_joint
# pid:
# p: 100.0
# i: 0.01
# d: 10.0

vss_robot_right_controller:
type: effort_controllers/JointEffortController
joint: roda_dir_joint
# pid:
# p: 100.0
# i: 0.01
# d: 10.0
8 changes: 8 additions & 0 deletions config/vision_stat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Parameters for statistical error simulation
# See: vision_proxy.py
#
# var = data + error
# error = gaus(mu=0, ro=std_dev)

vision:
std_dev: 0
15 changes: 6 additions & 9 deletions launch/gazebo.launch
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ https://github.com/ros/urdf_sim_tutorial -->
<arg name="recording" default="false"/>
<arg name="single" default="false"/>
<arg name="match" default="false"/>
<arg name="world_name" default="$(find vss_simulation)/worlds/vss_field.world"/>
<arg name="world_name" default="vss_field.world"/>
<arg name="model" default="$(find vss_simulation)/urdf/vss_simulation.xacro"/>
<arg name="height" default="0.080"/>
<arg name="x" default="-0.25" />
Expand All @@ -28,20 +28,17 @@ https://github.com/ros/urdf_sim_tutorial -->
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="recording" value="$(arg recording)"/>
<arg name="world_name" value="$(arg world_name)"/>
<arg name="world_name" value="$(find vss_simulation)/worlds/$(arg world_name)"/>
</include>

<!-- Load tf basic node for reference frame control -->
<node
name="tf_footprint_base"
pkg="tf"
type="static_transform_publisher"
args="0 0 0 0 0 0 base_link base_footprint 40" />

<!-- Load node to re-publish the gazebo message in the sintax of
ThunderVolt project -->
<node name="vision_proxy" pkg="vss_simulation" type="vision_proxy.py"/>

<!-- Load configs to statistical error simulation -->
<rosparam command="load"
file="$(find vss_simulation)/config/vision_stat.yaml" />

<group if="$(arg single)" ns="robot1">
<!-- Load robot file -->
<include file="$(find vss_simulation)/launch/spawn_robot.launch">
Expand Down
2 changes: 2 additions & 0 deletions launch/simulation_match.launch
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<arg name="gui" default="true"/>
<arg name="paused" default="true"/>
<arg name="use_sim_time" default="true"/>
<arg name="world_name" default="vss_field.world"/>
<arg name="recording" default="false"/>

<!-- Control option -->
Expand All @@ -18,6 +19,7 @@
<arg name="gui" value="$(arg gui)"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="world_name" value="$(arg world_name)"/>
<arg name="recording" value="$(arg recording)"/>
<arg name="match" value="true"/>
</include>
Expand Down
2 changes: 2 additions & 0 deletions launch/simulation_robot.launch
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<arg name="gui" default="true"/>
<arg name="paused" default="true"/>
<arg name="use_sim_time" default="true"/>
<arg name="world_name" default="vss_field.world"/>
<arg name="recording" default="false"/>
<arg name="x" default="-0.25" />
<arg name="y" default="0" />
Expand All @@ -21,6 +22,7 @@
<arg name="gui" value="$(arg gui)"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="world_name" value="$(arg world_name)"/>
<arg name="recording" value="$(arg recording)"/>
<arg name="x" default="$(arg x)" />
<arg name="y" default="$(arg y)" />
Expand Down
2 changes: 2 additions & 0 deletions launch/simulation_team.launch
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<arg name="gui" default="true"/>
<arg name="paused" default="true"/>
<arg name="use_sim_time" default="true"/>
<arg name="world_name" default="vss_field.world"/>
<arg name="recording" default="false"/>

<!-- Control option -->
Expand All @@ -18,6 +19,7 @@
<arg name="gui" value="$(arg gui)"/>
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="world_name" value="$(arg world_name)"/>
<arg name="recording" value="$(arg recording)"/>
</include>

Expand Down
15 changes: 9 additions & 6 deletions launch/spawn_match.launch
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

<arg name="model" default="$(find vss_simulation)/urdf/vss_robot.xacro" />

<!-- NOTE: The namespace prefix for the topic name is set in the <gazebo>
inside the vss_robot.gazebo file -->

<!-- Spawn frinds team -->
<!-- Spawn robot #0 -->
<group ns="robot1">
<param name="tf_prefix" value="robot0_tf" />
<param name="tf_prefix" value="robot1_tf" />
<include file="$(find vss_simulation)/launch/spawn_robot.launch" >
<arg name="robot_number" value="1" />
<arg name="team_number" value="0" />
Expand All @@ -18,7 +21,7 @@

<!-- Spawn robot #1 -->
<group ns="robot2">
<param name="tf_prefix" value="robot1_tf" />
<param name="tf_prefix" value="robot2_tf" />
<include file="$(find vss_simulation)/launch/spawn_robot.launch" >
<arg name="robot_number" value="2" />
<arg name="team_number" value="0" />
Expand All @@ -30,7 +33,7 @@

<!-- Spawn robot #2 -->
<group ns="robot3">
<param name="tf_prefix" value="robot2_tf" />
<param name="tf_prefix" value="robot3_tf" />
<include file="$(find vss_simulation)/launch/spawn_robot.launch" >
<arg name="robot_number" value="3" />
<arg name="team_number" value="0" />
Expand All @@ -44,7 +47,7 @@
<!-- Spawn foes team -->
<!-- Spawn foe #0 -->
<group ns="foe1">
<param name="tf_prefix" value="foe0_tf" />
<param name="tf_prefix" value="foe1_tf" />
<include file="$(find vss_simulation)/launch/spawn_robot.launch" >
<arg name="robot_number" value="1" />
<arg name="team_number" value="1" />
Expand All @@ -58,7 +61,7 @@

<!-- Spawn foe #1 -->
<group ns="foe2">
<param name="tf_prefix" value="foe1_tf" />
<param name="tf_prefix" value="foe2_tf" />
<include file="$(find vss_simulation)/launch/spawn_robot.launch" >
<arg name="robot_number" value="2" />
<arg name="team_number" value="1" />
Expand All @@ -72,7 +75,7 @@

<!-- Spawn foe #2 -->
<group ns="foe3">
<param name="tf_prefix" value="foe2_tf" />
<param name="tf_prefix" value="foe3_tf" />
<include file="$(find vss_simulation)/launch/spawn_robot.launch" >
<arg name="robot_number" value="3" />
<arg name="team_number" value="1" />
Expand Down
7 changes: 1 addition & 6 deletions launch/spawn_robot.launch
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,13 @@ http://wiki.ros.org/simulator_gazebo/Tutorials/Gazebo_ROS_API-->
-urdf -model $(arg robot_name) -param robot_description"
respawn="false" output="screen" />

<!-- Start tf state publishing node -->
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
</node>

<!-- Load configs to publish the state of all joints -->
<rosparam command="load"
file="$(find vss_simulation)/config/joints.yaml" />

<!-- Load configs to control robot motors -->
<rosparam command="load"
file="$(find vss_simulation)/config/motor_drive.yaml" />
file="$(find vss_simulation)/config/motor_effort.yaml" />

<node name="vss_robot_controller" pkg="controller_manager" type="spawner"
args="vss_robot_left_controller
Expand Down
3 changes: 3 additions & 0 deletions launch/spawn_team.launch
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

<arg name="model" default="$(find vss_simulation)/urdf/vss_robot.xacro" />

<!-- NOTE: The namespace prefix for the topic name is set in the <gazebo>
inside the vss_robot.gazebo file -->

<!-- Spawn robot #0 -->
<group ns="robot1">
<param name="tf_prefix" value="robot0_tf" />
Expand Down
14 changes: 14 additions & 0 deletions media/materials/scripts/vss.material
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * from "grid.material"

material VSS/Wine
{
technique
{
pass ambient
{
ambient 0.07 0.45 0.00 1.00
diffuse 0.07 0.45 0.00 1.00
specular 0.1 0.1 0.1 1 1
}
}
}
19 changes: 19 additions & 0 deletions models/my_sun/model.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>

<model>
<name>Sun</name>
<version>1.0</version>
<sdf version="1.5">model.sdf</sdf>

<author>
<!-- <name>Nate Koenig</name>
<email>[email protected]</email> -->
<name>Felipe Gomes de Melo</name>
<email>[email protected]</email>
</author>

<description>
A directional light for the sun.
Taken from https://bitbucket.org/osrf/gazebo/src/gazebo11/models/sun/model.sdf
</description>
</model>
16 changes: 16 additions & 0 deletions models/my_sun/model.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<sdf version="1.5">
<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>2 2 10 0 0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.2 0.2 0.2 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>
</sdf>
File renamed without changes.
Loading

0 comments on commit f9fc66d

Please sign in to comment.