Skip to content

Commit

Permalink
modify the app control contents
Browse files Browse the repository at this point in the history
  • Loading branch information
xiemeiping committed Oct 18, 2023
1 parent 9dbc4aa commit d1e9bd4
Show file tree
Hide file tree
Showing 17 changed files with 116 additions and 55 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Additionally, we offer three programming languages. MicroPython, C/C++ (Arduino)

<a id="update"></a>
## Update:
2023-10-11:
- Primarily revising the app control content.
- Enhancing some descriptions.

2023-10-11:
- Optimize some of the content in the quick guide on Python.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@
.. |link_code_11_keyboard_control| raw:: html
<a href="https://github.com/sunfounder/pidog/blob/master/examples/11_keyboard_control.py" target="_blank">11_keyboard_control.py.py - Github</a>
<a href="https://github.com/sunfounder/pidog/blob/master/examples/11_keyboard_control.py" target="_blank">11_keyboard_control.py - Github</a>
"""
6 changes: 3 additions & 3 deletions docs/source/hardware/cpn_battery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This is a custom battery pack made by SunFounder consisting of two 18650 batteri

* Battery charge: 5V/2A
* Battery output: 5V/3A
* Battery capacity: 3.7V 2000mAh x 2
* Battery life: 90min
* Battery charge time: 130min
* Battery capacity: 3.7V 2200mAh x 2
* Battery life: <90min
* Battery charge time: >130min
* Connector: PH2.0, 5P
40 changes: 20 additions & 20 deletions docs/source/hardware/cpn_camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,39 +47,39 @@ If the FFC wire is installed correctly, it will be straight and will not pull ou

Do not install the camera with the power on, it may damage your camera.

**Enable the Camera Interface**
.. **Enable the Camera Interface**
Run the following command to enable the camera interface of your Raspberry Pi. If you have enabled it, skip this; if you do not know whether you have done that or not, please continue.
.. Run the following command to enable the camera interface of your Raspberry Pi. If you have enabled it, skip this; if you do not know whether you have done that or not, please continue.
.. raw:: html
.. .. raw:: html
<run></run>
.. <run></run>
.. code-block::
.. .. code-block::
sudo raspi-config
.. sudo raspi-config
**3 Interfacing options**
.. **3 Interfacing options**
.. image:: img/image282.png
:align: center
.. .. image:: img/image282.png
.. :align: center
**P1 Camera**
.. **P1 Camera**
.. image:: img/camera_config1.png
:align: center
.. .. image:: img/camera_config1.png
.. :align: center
**<Yes>, then <Ok> -> <Finish>**
.. **<Yes>, then <Ok> -> <Finish>**
.. image:: img/camera_config2.png
:align: center
.. .. image:: img/camera_config2.png
.. :align: center
After the configuration is complete, it is recommended to reboot the Raspberry Pi.
.. After the configuration is complete, it is recommended to reboot the Raspberry Pi.
.. raw:: html
.. .. raw:: html
<run></run>
.. <run></run>
.. code-block::
.. .. code-block::
sudo reboot
.. sudo reboot
Binary file modified docs/source/python/img/app_auto_connect.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/python/img/app_preset.jpg
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/python/img/auto_start.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/python/img/connect_success.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/source/python/play_with_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ As soon as the assembly is completed, you need to calibrate the PiDog to prevent

py_0_calibrate

Once calibrated, you can follow the tutorial to play PiDog with the APP.
.. Once calibrated, you can follow the tutorial to play PiDog with the APP.
.. toctree::
:maxdepth: 2
.. .. toctree::
.. :maxdepth: 2
auto_run_app
.. auto_run_app
You can also have PiDog achieve the following project effects.

Expand Down
92 changes: 76 additions & 16 deletions docs/source/python/py_12_app_control.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,27 @@ In this example, we will use SunFounder Controller APP to control PiDog.

You need to download the APP on your phone/tablet first, then connect to the hotspot sent by PiDog, and finally create your own remote control on SunFounder Controller to control PiDog.

**How to do?**
Control Pidog with app
----------------------------


#. Install `SunFounder Controller <https://docs.sunfounder.com/projects/sf-controller/en/latest/>`_ from **APP Store(iOS)** or **Google Play(Android)**.

#. Install ``sunfounder-controller`` module.

The ``robot-hat``, ``vilib``, and ``picar-x`` modules need to be installed first, for details see: :ref:`install_all_modules`.

.. raw:: html

<run></run>

.. code-block::
cd ~
git clone https://github.com/sunfounder/sunfounder-controller.git
cd ~/sunfounder-controller
sudo python3 setup.py install
#. Run the Code.

.. raw:: html
Expand All @@ -38,32 +54,25 @@ You need to download the APP on your phone/tablet first, then connect to the hot

* Connect your tablet/phone to the WLAN where PiDog is located.

* Open the ``Sunfounder Controller`` APP. Click the + icon to add a remote.
* Open the ``Sunfounder Controller`` APP. Click the + icon to add a controller.

.. image:: img/app1.png

* There are preset controllers for some products in the Preset section. Here we choose PiDog.

.. image:: img/app_preset-1.png
* Preset controllers are available for some products, here we choose **PiDog**. Give it a name, or simply tap **Confirm**.

* Give it a name, then click Confirm.
.. image:: img/app_preset.jpg

.. image:: img/app_preset-2.png

* Now you have entered the inside of the remote control, which has several components for setting. Click the save button in the upper right corner.
* Once inside, the app will automatically search for the **Mydog**. After a moment, you will see a prompt saying “Connected Successfully.”

.. image:: img/app_preset-3.png
.. image:: img/app_auto_connect.jpg

* Next you need to connect PiDog with your device by pressing the connect button.

.. image:: img/sc_connect.jpg
.. note::

* Wait a few seconds, MyDog(IP) will appear, click it to connect.
* You can also manually click the |app_connect| button. Wait a few seconds, MyDog(IP) will appear, click it to connect.

.. image:: img/sc_mydog.jpg

.. note::
If the automatic connection cannot find the device, please click Scan to search again, or click Manual to input PiDog's IP manually.
.. image:: img/sc_mydog.jpg

#. Run the Controller.

Expand Down Expand Up @@ -113,3 +122,54 @@ Here are the functions of the widgets.
* ``handshake``
* ``high five``

Autostart on Boot
-----------------
When controlling Pidog via the APP, you wouldn't want to first log into the Raspberry Pi and keep ``12_app_control.py`` running before connecting with the APP.

There's a more streamlined approach. You can set Pidog to automatically run ``12_app_control.py`` every time it's powered on. After this, you can directly connect to Pidog using the APP and control your robotic dog with ease.

How to set this up?

#. Execute the following commands to install and configure the ``pidog_app`` application and set up WiFi for Pidog.

.. raw:: html

<run></run>

.. code-block::
cd ~/pidog/bin
sudo bash pidog_app_install.sh
#. At the end, input ``y`` to reboot Pidog.

.. image:: img/auto_start.png

#. From then on, you can simply power on Pidog and control it directly using the APP.

.. warning::

If you wish to run other scripts, first execute ``pidog_app disable`` to turn off the autostart feature.


APP Program Configuration
-----------------------------

You can input the following commands to modify the APP mode's settings.

.. code-block::
pidog_app <OPTION> [input]
**OPTION**
* ``-h`` ``help`` : help, show this message
* ``start`` ``restart`` : restart ``pidog_app`` service
* ``stop`` : stop ``pidog_app`` service
* ``disable`` : disable auto-start ``app_controller`` program on bootstrap
* ``enable`` : enable auto-start ``app_controller`` program on bootstrap
* ``close_ap`` : close hotspot, disable auto-start hotspot on boot and switch to sta mode
* ``open_ap`` : open hotspot, enable auto-start hotspot on boot
* ``ssid`` : set the ssid (network name) of the hotspot
* ``psk`` : set the password of the hotspot
* ``country`` : set the country code of the hotspot

6 changes: 5 additions & 1 deletion docs/source/python/py_easy_coding.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
5. Easy Coding
4. Easy Coding
======================
Here, we delve into various functions, breaking them down for a comprehensive understanding.
Each sub-topic is dedicated to a specific function, making it easier for you to grasp and implement them.
Whether it's initiating parameters, controlling specific movements, or incorporating sensory inputs, we've covered them all.
Navigate through the sub-topics below to kickstart your coding journey with Pidog.


.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/python/py_fun_project.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
4. Fun Python Projects
3. Fun Python Projects
=========================


Expand Down
12 changes: 3 additions & 9 deletions docs/source/python/python_start/enable_i2c_spi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Here we are using the Raspberry Pi's I2C and Camera interfaces, but by default t
sudo raspi-config
#. Choose **3** **Interfacing Options** by press the down arrow key on your keyboard, then press the **Enter** key.
#. Choose **Interfacing Options** by press the down arrow key on your keyboard, then press the **Enter** key.

.. image:: img/image282.png
:align: center

#. Then **P5 I2C**.
#. Then **I2C**.

.. image:: img/image283.png
:align: center
Expand All @@ -30,16 +30,10 @@ Here we are using the Raspberry Pi's I2C and Camera interfaces, but by default t
.. image:: img/image284.png
:align: center

#. Go to **3 Interfacing Options** again and select **P4 SPI**.
#. Go to **Interfacing Options** again and select **SPI**.

.. image:: img/image-spi1.png

#. Use the arrow keys on the keyboard to select **<Yes>** -> **<OK>** to complete the setup of the SPI.

.. image:: img/image-spi2.png


#. After you select **<Finish>**, a pop-up will remind you that you need to reboot for the settings to take effect, select **<Yes>**.

.. image:: img/camera_enable2.png
:align: center
Binary file modified docs/source/python/python_start/img/image-spi1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/python/python_start/img/image-spi2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/python/python_start/img/image282.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/python/python_start/img/image283.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d1e9bd4

Please sign in to comment.