Difference between revisions of "Simulation"

From cogniteam
Jump to: navigation, search
m (Cogniteam moved page Hamster/V5/Install/Simulation to Simulation)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:HamsterProKit]]
 +
{{DISPLAYTITLE:Hamster Simulation}}
 +
 
[[File:HamsterSimulationCTOffice.png|400px|thumb]]
 
[[File:HamsterSimulationCTOffice.png|400px|thumb]]
 
{{DISPLAYTITLE:Simulation}}
 
 
[[Category:Hamster]]
 
[[Category:Hamster]]
 
=== Hamster Simulation ===
 
=== Hamster Simulation ===
Line 11: Line 12:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== ROS::Indigo Installation ==
+
== ROS Installation ==
 
Installation guide for ROS Indigo can be found at the following link: http://wiki.ros.org/indigo/Installation/Ubuntu
 
Installation guide for ROS Indigo can be found at the following link: http://wiki.ros.org/indigo/Installation/Ubuntu
  
 
Before cloning, Some dependencies are needed if not already installed:<br />
 
Before cloning, Some dependencies are needed if not already installed:<br />
 
<syntaxhighlight lang="bash" line='line'>
 
<syntaxhighlight lang="bash" line='line'>
sudo apt-get install ros-indigo-ros-control  ros-indigo-ros-controllers ros-indigo-gazebo-ros ros-indigo-gazebo-ros-control ros-indigo-gazebo-ros-pkgs ros-indigo-controller-manager ros-indigo-gazebo-plugins ros-indigo-hector-gazebo ros-indigo-hector-gazebo-plugins ros-indigo-ackermann-msgs
+
sudo apt-get install ros-<distro>-ros-control  ros-<distro>-ros-controllers ros-<distro>-gazebo-ros ros-<distro>-gazebo-ros-control ros-<distro>-gazebo-ros-pkgs ros-<distro>-controller-manager ros-<distro>-gazebo-plugins ros-<distro>-hector-gazebo ros-<distro>-hector-gazebo-plugins ros-<distro>-ackermann-msgs ros-<distro>-costmap-2d
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 22: Line 23:
 
Next you should go ahead and create a catkin workspace:<br />
 
Next you should go ahead and create a catkin workspace:<br />
 
<syntaxhighlight lang="bash" line='line'>
 
<syntaxhighlight lang="bash" line='line'>
source /opt/ros/indigo/setup.bash
+
source /opt/ros/<distro>/setup.bash
 
mkdir -p ~/hamster_simulation/src
 
mkdir -p ~/hamster_simulation/src
 
cd ~/hamster_simulation/src
 
cd ~/hamster_simulation/src
Line 31: Line 32:
 
git clone https://github.com/cogniteam/hamster_simulation.git
 
git clone https://github.com/cogniteam/hamster_simulation.git
 
cd ~/hamster_simulation
 
cd ~/hamster_simulation
catkim_make
+
catkin_make
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 40: Line 41:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
The launch file contains hamster_vehicle.launch which runs one agent called agent1
+
The launch file contains hamster_multi_vehicle.launch which runs two agents
You can add more agents by editing the launch file.
+
You can add more agents by editing the launch file. Follow instructions in .launch file
 +
 
 +
<syntaxhighlight lang="bash" line='line'>
 +
roslaunch hamster_vehicle_gazebo hamster_multi_vehicle.launch
 +
</syntaxhighlight>
 +
 
 +
To run single robot with no-depth camera:
 +
<syntaxhighlight lang="bash" line='line'>
 +
roslaunch hamster_vehicle_gazebo hamster_V6_spawner.launch
 +
</syntaxhighlight>
  
Also, the launch file launches a joystick node if any is connected as working on /dev/js*
+
To run single robot with depth camera:
To launch Gazebo, type in the following command:<br />
 
 
<syntaxhighlight lang="bash" line='line'>
 
<syntaxhighlight lang="bash" line='line'>
roslaunch hamster_vehicle_gazebo hamster_vehicle.launch
+
roslaunch hamster_vehicle_gazebo hamster_V7_spawner.launch
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
Also wandering function available in simulation:
 +
To activate wandering mode: <syntaxhighlight>rostopic pub /agent(PUT_YOUR_AGENT_NUMBER)/commands/wandering/enable std_msgs/Bool "data: true"</syntaxhighlight>
 +
To stop wandering mode:<syntaxhighlight>rostopic pub /agent(PUT_YOUR_AGENT_NUMBER)/commands/wandering/enable std_msgs/Bool "data: false"</syntaxhighlight>
 +
 +
== AWS simulation ==
 +
 +
Also provided AWS wrapper with hamster_simulation:
 +
 +
clone simulation with wrapper:
 +
 +
<code>git clone -b aws_setup https://github.com/cogniteam/hamster_simulation.git</code>
  
==Available Topics==
+
and follow README instructions for interaction with AWS cloud
You should see something like this:
 
<agent> = agent1 on default
 
* Camera - /<agent>/image_raw/
 
* GPS - /<agent>/gps
 
* IMU - /<agent>/imu
 
* Lidar - /<agent>/scan_raw
 
* Speed Commands (Ackermann) - /<agent>/ackermann_cmd
 

Latest revision as of 11:29, 19 July 2020

HamsterSimulationCTOffice.png

Hamster Simulation

Installation

First check your current version of ROS by simply typing in the following command:
<syntaxhighlight lang="bash" line='line'> rosversion -d </syntaxhighlight>

ROS Installation

Installation guide for ROS Indigo can be found at the following link: http://wiki.ros.org/indigo/Installation/Ubuntu

Before cloning, Some dependencies are needed if not already installed:
<syntaxhighlight lang="bash" line='line'> sudo apt-get install ros-<distro>-ros-control ros-<distro>-ros-controllers ros-<distro>-gazebo-ros ros-<distro>-gazebo-ros-control ros-<distro>-gazebo-ros-pkgs ros-<distro>-controller-manager ros-<distro>-gazebo-plugins ros-<distro>-hector-gazebo ros-<distro>-hector-gazebo-plugins ros-<distro>-ackermann-msgs ros-<distro>-costmap-2d </syntaxhighlight>


Next you should go ahead and create a catkin workspace:
<syntaxhighlight lang="bash" line='line'> source /opt/ros/<distro>/setup.bash mkdir -p ~/hamster_simulation/src cd ~/hamster_simulation/src catkin_init_workspace </syntaxhighlight> Now we can clone the Hamster simulation source code into the new workspace and make it:
<syntaxhighlight lang="bash" line='line'> git clone https://github.com/cogniteam/hamster_simulation.git cd ~/hamster_simulation catkin_make </syntaxhighlight>

Launching

Before continuing, source your workspace.
<syntaxhighlight lang="bash" line='line'> source ~/hamster_simulation/devel/setup.bash </syntaxhighlight>

The launch file contains hamster_multi_vehicle.launch which runs two agents You can add more agents by editing the launch file. Follow instructions in .launch file

<syntaxhighlight lang="bash" line='line'> roslaunch hamster_vehicle_gazebo hamster_multi_vehicle.launch </syntaxhighlight>

To run single robot with no-depth camera: <syntaxhighlight lang="bash" line='line'> roslaunch hamster_vehicle_gazebo hamster_V6_spawner.launch </syntaxhighlight>

To run single robot with depth camera: <syntaxhighlight lang="bash" line='line'> roslaunch hamster_vehicle_gazebo hamster_V7_spawner.launch </syntaxhighlight>

Also wandering function available in simulation: To activate wandering mode: <syntaxhighlight>rostopic pub /agent(PUT_YOUR_AGENT_NUMBER)/commands/wandering/enable std_msgs/Bool "data: true"</syntaxhighlight> To stop wandering mode:<syntaxhighlight>rostopic pub /agent(PUT_YOUR_AGENT_NUMBER)/commands/wandering/enable std_msgs/Bool "data: false"</syntaxhighlight>

AWS simulation

Also provided AWS wrapper with hamster_simulation:

clone simulation with wrapper:

git clone -b aws_setup https://github.com/cogniteam/hamster_simulation.git

and follow README instructions for interaction with AWS cloud