Augmentations
=============

Quadruped B1 can be upgraded with different sensros and some other
accessories. These upgradations require some modifications in the robot
software which is detailed below.

Z1 Installation
---------------

.. image:: media/accessories/b1.png

The B1 can be combined with the Z1 manipulator which is a  robotic manipulator arm that has three degree-of-freedom (DOF) arm,
which means it has three joints that allow it to move and manipulate objects in three-dimensional space. 
The arm is attached to the robot's body via a rotating joint that allows it to move independently of the robot's locomotion. 
This enables the B1 to walk on four legs while using its arm to manipulate objects or perform other tasks. 
Furthermore, the end effector on the Z1's robotic manipulator arm is a gripper, which can open and close to grasp objects. 
The gripper is capable of exerting a maximum force of 30N, which is sufficient to lift and manipulate objects weighing up to 1kg. 
The arm can also rotate around its base to adjust the orientation of the gripper, allowing the Z1 to grasp objects from different angles. 

.. note::

   For more information please contact info@mybotshop.de

Ouster Installation
-------------------

.. image:: media/accessories/ouster.png

For the ouster attachment, the following package has to be installed in
the current workspace. The following
`tutorial <https://github.com/ouster-lidar/ouster_example>`__ can be
followed or the provided description.

**Note: This tutorial is to only be followed if the ouster software is
not already pre-installed.**

1. Install dependencies:

.. code:: bash

   sudo apt install -y build-essential libeigen3-dev libjsoncpp-dev  cmake

.. code:: bash
   
   sudo apt install -y ros-$ROS_DISTRO-pcl-ros ros-$ROS_DISTRO-rviz ros-$ROS_DISTRO-tf2-geometry-msgs

2. Create a new folder in your catkin workspace ``src`` folder named ``third_party``:

.. code:: bash

   cd ~/catkin_ws/src
   mkdir third_party
   cd third_party

3. Clone the repository into ``utils``:

.. code:: bash

   git clone --recurse-submodules https://github.com/ouster-lidar/ouster-ros.git

4. Create your workspace afterwhich you can start configuring the Ouster:

.. code:: bash

   cd ..
   catkin build 
   source devel/setup.bash

5. Connect the ouster with an ethernet cable, and follow the
   instructions provided in the `software user
   manual <https://data.ouster.io/downloads/software-user-manual/software-user-manual-v2.1.x.pdf?__hstc=34987006.cb1de7ee767f439860550afae9546056.1627541605983.1629103940919.1629980722413.3&__hssc=34987006.2.1629980722413&__hsfp=1054944347>`__
   chapter 2.

   -  It may take ~5 mins for it to be detected.

6. Next navigate to the ``utils`` (if the ouster pkg is provided by us) and in there open a terminal and run:

.. code:: bash

   chmod +x set_static_ip.py
   python3 set_static_ip.py

7. Then make open up your ethernet connection that is in the settings
   and add a new connection. Give your desired name and then navigate to
   the ``IPv4`` tab. In it change the connection to ``Manual``. In the
   ``Addressess``, give the address as ``192.168.123.2`` and the net
   mask as ``255.255.255.0``, and save. Then connect to this ip.

-  Verify that the computer is receiving data from ouster via:

   catkin build
   source devel/setup.bash

8. Add a new launch file called ``ouster.launch`` to the ouster-ros package in the launch directory, and
   configure the Lidar to your IP and your specifications:

.. code:: bash

   <?xml version="1.0"?>
   <launch>
   
   <arg name="ouster_ns" default="ouster"/>
   <arg name="sensor_hostname" default="192.168.123.35"/>
   <arg name="udp_dest" default="192.168.123.6"/>
   <arg name="lidar_port" default="46481"/>
   <arg name="imu_port" default="45352"/>
   <arg name="udp_profile_lidar" default=""/>
   <arg name="lidar_mode" default="512x10" />
   <arg name="timestamp_mode" default="TIME_FROM_ROS_TIME"/>
   <arg name="metadata" default=""/>
   <arg name="viz" default="false"/>
   <arg name="rviz_config" default="$(find ouster_ros)/config/viz.rviz"/>
   <arg name="tf_prefix" default=""/>
   <include file="$(find ouster_ros)/launch/sensor.launch" pass_all_args="true"/>

   <node pkg="tf" type="static_transform_publisher" name="lidar_to_robot" args="0 0 0.55 0 0 0 /base /os_sensor 100" />

   </launch>


9.  Verify installation via:

.. code:: bash

   roslaunch ouster_ros ouster.launch viz:=true