H1-2 E
======

H1 Overview
-----------

ROS2 drivers for the H1 platform include:

- Domain Bridge
- Joint State publisher
- Robot Description
- Arm and Leg High-Level Control
- IMU Publisher
- Sensor Fusion
- Twist Mux
- Depth Camera driver (D435i)
- Lidar drivers (Livox / Ouster)

Drivers are managed via startup services or the webserver interface.

Auto Drivers Startup
--------------------

Check driver status:

.. code-block:: bash

   sudo service h1-platform status
   sudo service h1-webserver status

Start drivers manually:

.. code-block:: bash

   sudo service h1-platform start

Restart if required:

.. code-block:: bash

   sudo service h1-platform restart

Modify startup jobs in:

``h1_bringup/scripts/startup_installer.py``

Apply changes:

.. code-block:: bash

   ros2 run h1_bringup startup_installer.py

RViz2
-----

Visualize robot state:

.. code-block:: bash

   ros2 launch h1_viz view_robot.launch.py

Tele-Operation
--------------

Keyboard teleop:

.. code-block:: bash

   ROS_DOMAIN_ID=10 ros2 run teleop_twist_keyboard teleop_twist_keyboard \
   --ros-args --remap cmd_vel:=/h1_unit_0001/hardware/cmd_vel


Core Launch Files
-----------------

Useful launch files:

.. code-block:: bash

   ros2 launch h1_platform highlevel_ros.launch.py
   ros2 launch h1_platform domain_bridge.launch.py
   ros2 launch h1_platform h1_2_state_publisher.launch.py
   ros2 launch h1_webserver webserver.launch.py
   ros2 launch h1_control twistmux.launch.py
   ros2 launch h1_lidar ouster.launch.py
   ros2 launch h1_depth_camera realsense.launch.py

Arms (7-DoF):

.. code-block:: bash

   ros2 launch h1_description h1_2_description.launch.py
   ros2 launch h1_platform h1_2_arm_record.launch.py

SDK examples:

.. code-block:: bash

   ./h1_loco_client --network_interface=eth0 --shake_hand

Modes Selection
---------------

**Posture & State Commands**

- ``damp`` — all motors damping mode
- ``start`` — begin locomotion
- ``squat`` — transition to squat
- ``sit`` — sit down
- ``stand_up`` — stand up
- ``zero_torque`` — disable torque
- ``stop_move`` — stop motion
- ``high_stand`` — high posture
- ``low_stand`` — low posture
- ``balance_stand`` — active balance stand
- ``shake_hand`` — perform handshake

**Setter Commands**

- ``set_fsm_id=<id>``
- ``set_balance_mode=<0/1>``
- ``set_swing_height=<m>``
- ``set_stand_height=<m>``
- ``set_velocity="vx vy w dur"``
- ``move="vx vy w"``
- ``set_task_id=<id>``
- ``set_speed_mode=<mode>``

**Getter Commands**

- ``get_fsm_id``
- ``get_fsm_mode``
- ``get_balance_mode``
- ``get_swing_height``
- ``get_stand_height``
- ``get_phase``

**Example: Damp Mode**

.. code-block:: bash

   ROS_DOMAIN_ID=10 ros2 service call \
   /h1_unit_0001/hardware_modes h1_interface/srv/H1Modes \
   '{"request_data": "damp"}'


Dual Arm Control (H1-2)
-----------------------

Launch server:

.. code-block:: bash

   ros2 launch h1_platform h1_2_arm_server.launch.py

Configuration file:

``h1_platform/config/h1_2_dual_arm_controller.yaml``

Example T-pose (trajectory):

.. code-block:: none

   ros2 action send_goal /h1_unit_1789/dual_arm/follow_joint_trajectory \
   control_msgs/action/FollowJointTrajectory "{trajectory: {...}}"

(Full trajectories preserved in source document.)

Dual Arm Record (Experimental)
------------------------------

Launch:

.. code-block:: bash

   ros2 launch h1_platform h1_2_arm_record.launch.py

Start recording:

.. code-block:: bash

   ros2 service call /h1_unit_284/dual_arm/record std_srvs/srv/SetBool "data: true"

Stop:

.. code-block:: bash

   ros2 service call /h1_unit_284/dual_arm/record std_srvs/srv/SetBool "data: false"

Playback latest:

.. code-block:: bash

   ros2 service call /h1_unit_284/dual_arm/playback h1_interface/srv/H1Modes \
   "request_data: ''"

Playback specific:

.. code-block:: bash

   ros2 service call /h1_unit_284/dual_arm/playback h1_interface/srv/H1Modes \
   "request_data: '/opt/mybotshop/h1_2_trajectories/<file>.csv'"

Additional ROS2 Packages
------------------------

Located under:

``/opt/mybotshop/src/mybotshop/``


Navigation (In-Development)
---------------------------

SLAM
----

Launch SLAM:

.. code-block:: bash

   ros2 launch h1_navigation slam.launch.py

Save map:

.. code-block:: bash

   ROS_DOMAIN_ID=10 ros2 run nav2_map_server map_saver_cli \
   -f /opt/mybotshop/src/mybotshop/h1_navigation/maps/custom_map

Rebuild:

.. code-block:: bash

   colcon build --symlink-install
   source install/setup.bash


Odometric Navigation
--------------------

.. code-block:: bash

   ros2 launch h1_navigation odom_navi.launch.py


Map Navigation
--------------

.. code-block:: bash

   ros2 launch h1_navigation map_navi.launch.py

Auxiliary Sensors
-----------------

Intel Realsense D435i
---------------------

.. code-block:: bash

   ros2 launch h1_depth_camera realsense.launch.py

Config file: ``h1_depth_camera/launch/realsense.launch.py``

ZED2i
-----

.. code-block:: bash

   ros2 launch h1_depth_camera zed.launch.py

Config: ``params_zed_stereo.yaml``

Ouster Lidar
------------

.. code-block:: bash

   ros2 launch h1_lidar ouster.launch.py

Config: ``ouster_params.yaml``

GPS – Emlid M2
--------------

.. code-block:: bash

   ros2 launch h1_gps emlid_m2.launch.py

Config: ``h1_gps/config/emlid_m2.yaml``

Simulation
----------

Gazebo Fortress
---------------

.. code-block:: bash

   ros2 launch h1_gazebo h1_2_fortress_simulation.launch.py

Isaac Sim
---------

See official Unitree / MYBOTSHOP guides.