Skip to content

Commit

Permalink
- update documentation: add "How to run suricate robot" tutorial
Browse files Browse the repository at this point in the history
- fix PID controller interface: Now it uses wrench command
- add default rviz config for testing real robot
  • Loading branch information
francisc0garcia committed Apr 15, 2017
1 parent 053a87e commit 6f1957b
Show file tree
Hide file tree
Showing 12 changed files with 371 additions and 37 deletions.
3 changes: 3 additions & 0 deletions docs/source/description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Source code was written in Python and C++​
Integrate external libraries such as OpenCV, NodeJS and MongoDB​.

- Main task distribution:

.. image:: media/suricate_hardware_tasks.png

- Electronics:
Expand All @@ -17,11 +18,13 @@ The following figure shows how components are connected and which protocols were
.. image:: media/suricate_electronics.png

- ROS nodes:

The following figure shows the ROS nodes which were developed for this project and which device execute each of them.

.. image:: media/suricate_nodes.png

- PID controller:

The following figure shows a basic structure that represent the controller that we have developed.

.. image:: media/dina_pwm1.png
Binary file added docs/source/media/IMU_checking.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/media/RVIZ_working.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/media/web_interface_working.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion docs/source/questions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ then you can compile using GCC 5.
ROS related problems
^^^^^^^^^^^^^^^^^^^^

under development...
* When I relaunch Raspberry PI2 nodes, sad face is showed by LED matrix.

Answer: sometimes, when you relaunch nodes, an instance of PIGPIO remain active and generate conflicts, you can stop
nodes and wait for couple of minutes before everything is closed by ubuntu, and then start again ros nodes.

Interface problems
^^^^^^^^^^^^^^^^^^
Expand All @@ -42,6 +45,17 @@ Answer: You can use pigpio scope [http://abyz.co.uk/rpi/pigpio/piscope.html], in
export PIGPIO_ADDR=IP_OF_RASPBERRY
piscope
* I get error: initInitialise: bind to port 8888 failed (Address already in use)

Answer: This is caused by PIGPIO's daemon, you can stop all ros process, and kill its process using

.. code-block:: none
sudo killall -9 pigpiod
sudo rm /var/run/pigpio.pid
then wait some seconds before it is closed by ubuntu. After thath, you should be able to execute normally.


Other questions
^^^^^^^^^^^^^^^
Expand All @@ -56,6 +70,12 @@ terminal windows and run:
watch -n 5 free -m
htop
* How can I change router configuration?

Answer: You can connect to router, and open a web browser. Type **http://tplinklogin.net**, credentials are:
user **admin** and password **admin**.

You can, for instance, change static IP address assigned to RPI2, ODROID or PC (*DHCP/Address Reservation*). As well as checking if all devices are properly connected (*DHCP/DHCP Client List*)



Expand Down
104 changes: 90 additions & 14 deletions docs/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,109 @@ Suricate robot tutorials
This section explain some examples of how to use the gazebo simulation and ROS in order to play
with the suricate robot and develop some extensions.

Getting started
^^^^^^^^^^^^^^^
Initial considerations
^^^^^^^^^^^^^^^^^^^^^^

* Use a LQR controller in order to stabilize the robot:
- Credentials for Raspberri PI 2: user **ubuntu** - Password **ubuntu**

- Credentials for ODROID: user **odroid** - Password **odroid**

- Suricate robot is pre-configured for connecting to WiFi network **suricate** and password **suricate2015**, router should assign automatically static IP address

Raspberry PI2- *192.168.0.201*

ODROID - *192.168.0.203*

PC - *192.168.0.105*

this is important for following steps.

- If you want to change WiFi network configuration on Raspberry or ODROID, please modify config file (you can connect MicroSD on external PC with linux):

.. code-block:: none
sudo nano /etc/network/interfaces
- You can change I2C and SPI parameters modifying file:

.. code-block:: none
sudo nano /boot/config.txt
How to start suricate robot
^^^^^^^^^^^^^^^^^^^^^^^^^^^

To run suricate robot, you need a working ROS project (explained on installation section).
Once it is working, you can execute the following steps:

1. Turn on robot and wait for WiFi connection (default network **suricate** and static IP **192.168.0.201**).

2. By default, ODROID is configured to act as ROS Master using static IP *192.168.0.203*, and it will start automatically as soon
as you power it on.

3. Use console to connect using SSH to raspberry PI2 (example: ssh user@IP_address):

.. code-block:: none
cd ~/catkin_ws
ssh ubuntu@192.168.0.201
4. Start ROS nodes on RPI2 using the following commands:

.. code-block:: none
cd ~/Documents/code/suricate_micro/
source devel/setup.bash
export ROS_IP=192.168.0.201
export ROS_MASTER_URI=http://192.168.0.203:11311
roslaunch robot_starter robot_starter.launch
By default, robot uses LQR controller that will start automatically, meaning that robot will stand up as soon as you execute robot_starter.launch,
you might also try PID controlled that requires an initial velocity command given by **/robot/cmd_vel** (usually provided if you connect a gamepad).

5. Now, if everything is correct, LED matrix should show a happy face. If does not do it, please check Frequent Questions section.

6. Open a new console and start PC ROS nodes for visualization and control, using following commands:

.. code-block:: none
cd ~/catkin_ws/
source devel/setup.bash
roslaunch suricate_robot PC_launcher_simulation.launch
export ROS_IP=192.168.0.105
export ROS_MASTER_URI=http://192.168.0.203:11311
roslaunch suricate_robot PC_launcher.launch
Recommendations:

It is possible that your ROS project is place on different location.

Connect a gamepad before running this nodes, if you want to control robot with it.

7. Previous command will open a RQT instance (graphical interface), you can check robot state by clicking tab "Topic monitor", and select a topic, for instance **/robot/imu**.
If Hz shows something between 80 to 130 HZ IMU is properly sensed and robot work OK.

Modify robot controller
^^^^^^^^^^^^^^^^^^^^^^^
.. image:: media/IMU_checking.png

You should also get a RVIZ 3D graph, which, as soon as you move the robot, shows a computed position and pose.

.. image:: media/RVIZ_working.png

8. It is also possible to use web interface, please open a web browser (tested on Google Chrome and Opera) and write this address:

.. code-block:: none
under development...
http://192.168.0.203:3000
you must create a new user with password in order to get access to robot interface

Define your own controller
^^^^^^^^^^^^^^^^^^^^^^^^^^
.. image:: media/web_interface_working.png

under development...
It is possible to check camera image, battery status and 3D computed pose.
If you use PID controller (select on raspberry_init.launch), you can also control robot using arrows on display.


Extend the project and add new features
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

under development...


15 changes: 2 additions & 13 deletions launch/PC_launcher.launch
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@
<node name="custom_rqt_perspective" pkg="rqt_gui" type="rqt_gui"
args="--perspective-file $(find suricate_robot)/simulation/robot_micro.perspective" required="false" />

<!--
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find robot_micro)/simulation/rviz_config.rviz" required="false" />
-->

<!--
<include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch" >
<arg name="port" value="9090"/>
</include>
-->

<!--
<node pkg="suricate_robot" type="visual_odometry" name="visual_odometry"/>
-->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find suricate_robot)/simulation/rviz_robot_test.rviz"
required="false" />
</launch>
16 changes: 16 additions & 0 deletions launch/PID_controller_init.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<launch>
<node pkg="suricate_robot" type="robot_controller.py" name="robot_controller" required="true" >
<param name="S_kp" type="double" value="0.1" />
<param name="S_kd" type="double" value="0.02" />
<param name="S_ki" type="double" value="0.04" />
<param name="S_windup" type="double" value="0.8" />

<param name="P_kp" type="double" value="0.1" />
<param name="P_kd" type="double" value="0" />
<param name="P_ki" type="double" value="0.02" />
<param name="P_windup" type="double" value="0.2" />

<param name="scaling_joy" type="double" value="3.0" />
</node>
</launch>

29 changes: 26 additions & 3 deletions launch/raspberry_init.launch
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
<!--
<node pkg="suricate_robot" type="robot_visualization.py" name="robot_visualization" required="true" />
-->

<!--
<!--
<node pkg="suricate_robot" type="robot_controller.py" name="robot_controller" required="true" >
<param name="S_kp" type="double" value="0.25" />
<param name="S_kd" type="double" value="0.03" />
Expand All @@ -43,7 +42,31 @@
<param name="scaling_joy" type="double" value="1" />
</node>
-->
-->

<!--
<node pkg="suricate_robot" type="robot_controller.py" name="robot_controller" required="true" >
<param name="S_kp" type="double" value="0.1" />
<param name="S_kd" type="double" value="0.02" />
<param name="S_ki" type="double" value="0.04" />
<param name="S_windup" type="double" value="0.8" />
<param name="P_kp" type="double" value="0.1" />
<param name="P_kd" type="double" value="0" />
<param name="P_ki" type="double" value="0.02" />
<param name="P_windup" type="double" value="0.2" />
<param name="scaling_joy" type="double" value="3.0" />
</node>
-->


<node pkg="suricate_robot" type="robot_controller_LQR_V1.py" name="robot_controller" required="true" >
<param name="scaling_joy" type="double" value="2.1" />
<param name="rate" type="double" value="150" />
<param name="gain_LQR" type="double" value="0.0019" />
<param name="environment" type="string" value="robot" />
</node>

<!--
<node pkg="robot_micro" type="robot_controller_LQR.py" name="robot_controller" required="true" ></node>
Expand Down

0 comments on commit 6f1957b

Please sign in to comment.