diff --git a/README.md b/README.md index e31a1f21..6f5cae30 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ # create3_docs -Documentation for the iRobot Create3 robot + +Documentation for the iRobot Create3 robot. + +### Build the docs locally + +Install required dependencies: + +```bash +pip3 install mkdocs +pip3 install mkdocs-material +``` + +Build the documentation locally: + +```bash +mkdocs serve +``` + +Open `http://127.0.0.1:8000/` in a browser to visualize the docs. diff --git a/docs/api/data/create3_dock_codes.png b/docs/api/data/create3_dock_codes.png new file mode 100644 index 00000000..a088dc24 Binary files /dev/null and b/docs/api/data/create3_dock_codes.png differ diff --git a/docs/api/docking.md b/docs/api/docking.md new file mode 100644 index 00000000..b515bb31 --- /dev/null +++ b/docs/api/docking.md @@ -0,0 +1,57 @@ +# Create3 Docking + +The Create3 robot is equipped with a docking station to recharge it between experiments. + +Through the ROS 2 APIs users can command docking and undocking autonomous behaviors. + +Note that, in order for the robot to detect the dock, determine its location and understand when it is succesfully docked, it is necessary that the docking station is connected to a power source. + +## Built-in docking behaviors + +#### Undocking + +You can command the robot to undock using the following ROS 2 action. + +```bash +ros2 action send_goal /undock irobot_create_msgs/action/Undock "{}" +``` + +The robot will move backward out of the dock and then it will rotate 180 degrees. + +This action will fail if the robot is already undocked. + +#### Docking + +You can command the robot to dock using the following ROS 2 action. + +```bash +ros2 action send_goal /dock irobot_create_msgs/action/DockServo "{}" +``` + +The robot will first search for the dock in its immediate surroundings. +Note that the action will fail if the robot is too far from the dock. +You can check if the dock is visible by subscribing to the `/dock` ROS 2 topic. + +Then the robot will align with the dock and carefully drive onto it. + +This action will fail if the robot is already docked. + +## Docking sensor data + +The Create3 robot exposes several docking-related information through its ROS 2 publications. +These should allow users to write their own algorithms taking into account the presence of the dock in the environment and even to write their own docking and undocking procedures. + +#### IR opcodes + +The Create3 docking station transmit several IR signals. +The Create3 robot is equipped with two different sensors that are capable of detecting them. + +![Docking signals](data/create3_dock_codes.png) + +The robot will publish these signals in the `/ir_opcode` ROS 2 topic. +Each message will contain a time-stamped detection of one of those signals, including the identifier of the sensor that detected it. + +#### Dock information + +More high-level information is produced by the robot in the `/dock` ROS 2 topic. +Here it's possible to quickly know if the robot is able to see the dock from its current location and whether it is currently docked or not. diff --git a/docs/api/reflexes.md b/docs/api/reflexes.md new file mode 100644 index 00000000..ea916f0e --- /dev/null +++ b/docs/api/reflexes.md @@ -0,0 +1,85 @@ +# Reflexes + +With the word "reflex" we denote a set of autonomous reactive behaviors that the Create3 robot will trigger when it detects obstacles or hazards. + +Reflexes are high-priority behaviors and will temporarily override any user-provided command for their short duration. + +Reflexes can be enabled or disabled on the Create3 using the corresponding ROS 2 parameters exposed by the `motion_control` ROS 2 node. + +## Reflex parameters + +The `reflexes_enabled` parameter controls whether reflexes should be executed or not. It accepts boolean values. +When this parameter is set to `false`, no reflexes will be enabled, regardless of their specific parameters values. + +Reflexes are enabled by default. + +### Bumps reflex + +The `reflex.REFLEX_BUMP` ROS 2 parameter enables (`true`) or disables (`false`) the bump reflex. +It will trigger as soon as the robot bumps into an obstacle and it will move the robot away from it. +The reflex will continue until the robot has cleared the bump. + +This reflex is enabled by default. + +### Cliffs reflex + +The `reflex.REFLEX_CLIFF` ROS 2 parameter enables (`true`) or disables (`false`) the cliff reflex. +It will trigger as soon as the robot detects a cliff and it will move the robot away from it. +The reflex will continue until the robot has cleared the cliff. + +This reflex is enabled by default. + +### Dock avoidance reflex + +The `reflex.REFLEX_DOCK_AVOID` ROS 2 parameter enables (`true`) or disables (`false`) the dock avoidance reflex. +It will trigger as soon as the robot gets close to the dock and tries to move towards it. +The reflex will stop forward movements. + +This reflex is disabled by default. + +### Gyro calibration reflex + +The `reflex.REFLEX_GYRO_CAL` ROS 2 parameter enables (`true`) or disables (`false`) the gyro calibration reflex. +It will trigger while the robot is stationary and will try to recalibrate the internal gyroscope. + +This reflex is enabled by default. + +### Panic reflex + +The `reflex.REFLEX_PANIC` ROS 2 parameter enables (`true`) or disables (`false`) the dock avoidance reflex. +It will trigger when the robot is trapped and unable to clear obstacles or hazards. +The reflex will try more aggressive maneuvers to allow the robot to recover from this situation + +This reflex is enabled by default. + +### Proximity slowdown reflex + +The `reflex.REFLEX_PROXIMITY_SLOWDOWN` ROS 2 parameter enables (`true`) or disables (`false`) the dock avoidance reflex. +It will trigger when the robot's IR sensors detect an obstacle in close proximity. +The reflex will reduce the robot movement speed in order to better prepare for an eventual impact. + +This reflex is enabled by default. + +### Stuck reflex + +The `reflex.REFLEX_STUCK` ROS 2 parameter enables (`true`) or disables (`false`) the dock avoidance reflex. +It will trigger when the robot is stuck, i.e. it's pushing against an obstacle and its wheels are losing traction. +The reflex will try aggressive maneuvers to allow the robot to recover from this situation + +This reflex is enabled by default. + +### Virtual Wall reflex + +The `reflex.REFLEX_VIRTUAL_WALL` ROS 2 parameter enables (`true`) or disables (`false`) the cliff reflex. +It will trigger as soon as the robot detects an iRobot virtual wall it will move the robot away from it. +The reflex will continue until the robot has cleared the virtual wall. + +This reflex is enabled by default. + +### Wheel drop reflex + +The `reflex.REFLEX_WHEEL_DROP` ROS 2 parameter enables (`true`) or disables (`false`) the cliff reflex. +It will trigger as soon as the robot detects that one of its wheels is fully extended (dropped). +The robot will drive the other wheel in order to return to a flat surface. + +This reflex is enabled by default. diff --git a/docs/api/ros2.md b/docs/api/ros2.md new file mode 100644 index 00000000..5253dcb0 --- /dev/null +++ b/docs/api/ros2.md @@ -0,0 +1,105 @@ +# ROS 2 APIs + +The Create3 robot is based on ROS 2 and, as such, it exposes all its user-facing APIs through ROS 2 entities (topics, services, actions and parameters). + +The purpose of this page is to give a quick overview of these ROS 2 APIs. +If you are interested in more details, have a look at the other pages in this section. + +## ROS 2 Topics + +You can see the ROS 2 topics exposed by the robot running the `ros2 topic list` command. + +```bash +$ ros2 topic list +/battery_state +/cmd_lightring +/cmd_vel +/dock +/hazard_detection +/imu +/interface_buttons +/ir_intensity +/ir_opcode +/kidnap_status +/mouse +/odom +/parameter_events +/rosout +/slip_status +/stop_status +/tf +/tf_static +/wheel_ticks +/wheel_vels +``` + +## ROS 2 Services + +You can see the ROS 2 services exposed by the robot running the `ros2 service list` command. + +```bash +$ ros2 service list +/e_stop +/motion_control/describe_parameters +/motion_control/get_parameter_types +/motion_control/get_parameters +/motion_control/list_parameters +/motion_control/set_parameters +/motion_control/set_parameters_atomically +/robot_power +/static_transform/describe_parameters +/static_transform/get_parameter_types +/static_transform/get_parameters +/static_transform/list_parameters +/static_transform/set_parameters +/static_transform/set_parameters_atomically +``` + +## ROS 2 Actions + +You can see the ROS 2 actions exposed by the robot running the `ros2 action list` command. + +```bash +$ ros2 action list +/dock +/undock +/wall_follow +``` + +## ROS 2 Parameters + +You can see the ROS 2 parameters exposed by the robot running the `ros2 param list` command. + +```bash +$ ros2 param list +/motion_control: + max_speed + qos_overrides./parameter_events.publisher.depth + qos_overrides./parameter_events.publisher.durability + qos_overrides./parameter_events.publisher.history + qos_overrides./parameter_events.publisher.reliability + reflexes.REFLEX_BUMP + reflexes.REFLEX_CLIFF + reflexes.REFLEX_DOCK_AVOID + reflexes.REFLEX_GYRO_CAL + reflexes.REFLEX_PANIC + reflexes.REFLEX_PROXIMITY_SLOWDOWN + reflexes.REFLEX_STUCK + reflexes.REFLEX_VIRTUAL_WALL + reflexes.REFLEX_WHEEL_DROP + reflexes_enabled + safety_override + use_sim_time +/static_transform: + qos_overrides./parameter_events.publisher.depth + qos_overrides./parameter_events.publisher.durability + qos_overrides./parameter_events.publisher.history + qos_overrides./parameter_events.publisher.reliability + qos_overrides./tf_static.publisher.depth + qos_overrides./tf_static.publisher.history + qos_overrides./tf_static.publisher.reliability + use_sim_time + wheel_base + wheels_encoder_resolution + wheels_radius +``` diff --git a/docs/api/safety.md b/docs/api/safety.md new file mode 100644 index 00000000..c45263e7 --- /dev/null +++ b/docs/api/safety.md @@ -0,0 +1,64 @@ +# Create3 Safety Overrides + +By default, the Create3 robot has some safety features enabled. +Their purpose is to make sure that the robot does not get into dangerous sitations and it is able to detect and react properly to cliff hazards. + +Safety features are configurable by the user through a ROS 2 parameter. +This will allow the more adventurous users to have full control over the robot. + +!!! important + The robot will temporarily re-enable safety features whenever it is commanded to execute any of the built-in autonomous behaviors. + +The `safety_override` parameter exposed by the `motion_control` ROS 2 node should be used to control and override safety features. +It's a `string` parameter and it accepts 3 possible values: + + - `none` Safety features are fully enabled. This is the default value. + - `backup_only` Overrides the robot backup limit safety feature, disabling it. + - `full` Safety features are fully disabled. + +Note that the parameter server will reject changes if there are typos in the new safety value set by the users. + +The following sections briefly describe what the safety features do. + +## Backup Limit + +The Create3 robot is equipped with cliff sensors, but they are located only in the front of the robot. +This means that the robot is not able to detect cliff hazards while driving backward. + +In order to make the robot safe, thus we need to make sure that the robot never moves backward more than what it's safe to do. +Under standard circumstances, the robot is allowed to briefly move backward only if it has first traveled forward (i.e. if it has "explored" the space making sure that it does not present cliff hazards). + +If the robot is kidnapped (i.e. first lifted by the user and then placed somewhere), the backup limit will immediately trigger. + +The Create3 robot signals to the user when the backup limit is about to be triggered in multiple ways: + + - Through the `HazardDetectionsVector` ROS 2 message: an hazard of type `BACKUP_LIMIT` will be published in the vector. + - By logging a warning message. + - By changing the color of the lights to orange. + +If the user ignores these alerts and keeps driving the robot backward, the robot will suddenly break and stop. +From this point, the robot will refuse any backward movement. +The user will have to drive the robot forward in order to re-enable backward movements. +As soon as the user will drive the robot forward, the lights will go back to the default white color. +Safe backward movements will not be immediately re-allowed, but rather the robot will have to keep driving forward for a little while. +This moment will be identified by the `BACKUP_LIMIT` hazard disappearing from the `HazardDetectionsVector` message. + +The backup limit and its related alerts are active only when `safety_override = none`. + +!!! attention + The robot will not stop if there are cliffs when driving backward! + + +## Maximum speed + +In order to stop when a cliff hazards is detected, it is also necessary to make sure that the robot is not driving too fast. +Safety features will thus limit the robot speed. + +You can check the current maximum robot speed through the read-only parameter `max_speed` exposed by the `motion_control` ROS 2 node. + +When `safety_override = none` or `safety_override = backup_only` the maximum speed will be limited to 0.306 m/s. + +By fully disabling safety features, i.e. setting `safety_override = full` the robot will be allowed to drive at its true maximum speed of 0.460 m/s. + +!!! attention + The robot may not be able to stop in time if driving at full speed if a cliff is detected! diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..56ef7f0d --- /dev/null +++ b/docs/index.md @@ -0,0 +1,15 @@ +# Welcome to iRobot Create3 + +TODO: add pictures and videos + +### Overview + +What is Create3? + +### Useful links + +Here you can find additional content on the iRobot Create3: + + - [Create ROS 2 Messages Definitions](https://github.com/iRobotEducation/irobot_create_msgs) + - [Create3 Gazebo Simulator](https://github.com/iRobotEducation/create3_sim) + - [Create3 Examples](https://github.com/iRobotEducation/create3_examples) diff --git a/docs/robot-setup/data/provcreate.jpg b/docs/robot-setup/data/provcreate.jpg new file mode 100644 index 00000000..7cc7ef6b Binary files /dev/null and b/docs/robot-setup/data/provcreate.jpg differ diff --git a/docs/robot-setup/robot.md b/docs/robot-setup/robot.md new file mode 100644 index 00000000..d3d0e326 --- /dev/null +++ b/docs/robot-setup/robot.md @@ -0,0 +1,3 @@ +# The Robot + +This page describes the Create3 robot. diff --git a/docs/robot-setup/start.md b/docs/robot-setup/start.md new file mode 100644 index 00000000..f16bde5a --- /dev/null +++ b/docs/robot-setup/start.md @@ -0,0 +1,3 @@ +# Start Your Robot + +This page describes the steps required to start your robot for the first time. diff --git a/docs/robot-setup/webserver.md b/docs/robot-setup/webserver.md new file mode 100644 index 00000000..2f691a46 --- /dev/null +++ b/docs/robot-setup/webserver.md @@ -0,0 +1,51 @@ +# Webserver + +The Create3 webserver is a web interface for debugging an setting up your robot. + +If the robot is on the same WiFi network as your laptop, then you can access the webserver opening a browser at the following address: `http://irobot-701c264ad869434e8e11deace38d2bb8.local/`. +Here the string `irobot-701c264ad869434e8e11deace38d2bb8` is the hostname of your robot. +You can read it while doing the provisioning step. + +If the robot is not connected to your network, then you should follow the provisioning procedure. +Provisioning is also required for WiFi ROS 2 connectivity and to have UTC synchronized robot timestamps. + +## Provisioning + +Provisioning is the procedure that will connect the Create3 robot to your WiFi network. + +Press and hold the left ( · ) and right ( · · ) buttons for six seconds. +The light ring should go cyan. + +![Start provisioning](data/provcreate.jpg) + +The robot is now broadcasting on an SSID of the form Roomba-####, where #### is some UID. +Connect your computer to it. +Your computer may complain about a lack of Internet access (you can ignore this). + +Check the IP address of your computer after you connected to this new WiFi network. +For example, on a Linux machine, you can use the `ifconfig` command and check for your WiFi connection there. +The IP address will be in the form `192.168.10.x`. + +Open a web browser to `192.168.10.1` to start the webserver and connect to your robot. + +At the welcom screen, click "Provision". + +Enter the SSID and password of the WiFi network you want to connect your robot to and click "Connect". + +Provisioning is now complete! + +!!! important + While you are still connected to the webserver for provisioning, you should write down the hostname of your Create3 robot. This will be needed for future connections to the webserver outside of provisioning mode. You can find it in the `Application` -> `System Info` tab (wait for a while until the provision information are printed). + +## Configuring + +The webserver allows users to configure their Create3 robot. +This can be done from the `Application` -> `Configuration` tab. + +Here you can choose to set a namespace for your ROS 2 application and which RMW implementation the robot should use. + +Moreover, you can set some default ROS 2 parameters through a YAML configuration file. + +Note that any of the changes in this tab requires to reboot the robot before being applied. + +## Debugging diff --git a/docs/sim/setup.md b/docs/sim/setup.md new file mode 100644 index 00000000..fe17fcc9 --- /dev/null +++ b/docs/sim/setup.md @@ -0,0 +1,2 @@ +# Using the Create3 Simulator + diff --git a/docs/stylesheets/irobot-palette.css b/docs/stylesheets/irobot-palette.css new file mode 100644 index 00000000..f40237d6 --- /dev/null +++ b/docs/stylesheets/irobot-palette.css @@ -0,0 +1,63 @@ +:root { + --md-default-fg-color: hsla(0, 0%, 0%, 0.87); + --md-default-fg-color--light: hsla(0, 0%, 0%, 0.54); + --md-default-fg-color--lighter: hsla(0, 0%, 0%, 0.32); + --md-default-fg-color--lightest: hsla(0, 0%, 0%, 0.07); + --md-default-bg-color: hsla(0, 0%, 100%, 1); + --md-default-bg-color--light: hsla(0, 0%, 100%, 0.7); + --md-default-bg-color--lighter: hsla(0, 0%, 100%, 0.3); + --md-default-bg-color--lightest: hsla(0, 0%, 100%, 0.12); + + --md-primary-fg-color: #6CB86A; + --md-primary-fg-color--light: #ECB7B7; + --md-primary-fg-color--dark: #90030C; + --md-primary-bg-color: hsla(0, 0%, 100%, 1); + --md-primary-bg-color--light: hsla(0, 0%, 100%, 0.7); + + --md-accent-fg-color: hsla(#{hex2hsl($clr-indigo-a200)}, 1); + --md-accent-fg-color--transparent: hsla(#{hex2hsl($clr-indigo-a200)}, 0.1); + --md-accent-bg-color: hsla(0, 0%, 100%, 1); + --md-accent-bg-color--light: hsla(0, 0%, 100%, 0.7); + + + --md-code-fg-color: hsla(200, 18%, 26%, 1); + --md-code-bg-color: hsla(0, 0%, 96%, 1); + + --md-code-hl-color: hsla(#{hex2hsl($clr-yellow-a200)}, 0.5); + --md-code-hl-number-color: hsla(0, 67%, 50%, 1); + --md-code-hl-special-color: hsla(340, 83%, 47%, 1); + --md-code-hl-function-color: hsla(291, 45%, 50%, 1); + --md-code-hl-constant-color: hsla(250, 63%, 60%, 1); + --md-code-hl-keyword-color: hsla(219, 54%, 51%, 1); + --md-code-hl-string-color: hsla(150, 63%, 30%, 1); + --md-code-hl-name-color: var(--md-code-fg-color); + --md-code-hl-operator-color: var(--md-default-fg-color--light); + --md-code-hl-punctuation-color: var(--md-default-fg-color--light); + --md-code-hl-comment-color: var(--md-default-fg-color--light); + --md-code-hl-generic-color: var(--md-default-fg-color--light); + --md-code-hl-variable-color: var(--md-default-fg-color--light); + + --md-typeset-color: var(--md-default-fg-color); + + --md-typeset-a-color: var(--md-primary-fg-color); + + --md-typeset-mark-color: hsla(#{hex2hsl($clr-yellow-a200)}, 0.5); + + --md-typeset-del-color: hsla(6, 90%, 60%, 0.15); + --md-typeset-ins-color: hsla(150, 90%, 44%, 0.15); + + --md-typeset-kbd-color: hsla(0, 0%, 98%, 1); + --md-typeset-kbd-accent-color: hsla(0, 100%, 100%, 1); + --md-typeset-kbd-border-color: hsla(0, 0%, 72%, 1); + + --md-typeset-table-color: hsla(0, 0%, 0%, 0.12); + + --md-admonition-fg-color: var(--md-default-fg-color); + --md-admonition-bg-color: var(--md-default-bg-color); + + --md-footer-fg-color: hsla(0, 0%, 100%, 1); + --md-footer-fg-color--light: hsla(0, 0%, 100%, 0.7); + --md-footer-fg-color--lighter: hsla(0, 0%, 100%, 0.3); + --md-footer-bg-color: hsla(0, 0%, 0%, 0.87); + --md-footer-bg-color--dark: hsla(0, 0%, 0%, 0.32); + } \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 00000000..6e833d4f --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,33 @@ +site_name: Create3 Docs +site_description: 'Documentation for the iRobot Create3 robot' +site_author: 'iRobot' +#site_url: TODO + +repo_name: 'iRobotEducation/create3_docs' +repo_url: 'https://github.com/iRobotEducation/create3_docs' + +docs_dir: docs/ + +theme: + name: material + custom_dir: theme_overrides + +extra_css: + - stylesheets/irobot-palette.css + +markdown_extensions: + - admonition + +nav: + - Home: index.md + - Robot Setup: + - Robot: robot-setup/robot.md + - Webserver: robot-setup/webserver.md + - Start your robot: robot-setup/start.md + - Create3 APIs: + - ROS 2 Interface: api/ros2.md + - Docking: api/docking.md + - Reflexes: api/reflexes.md + - Safety: api/safety.md + - Create3 Simulator: + - Using the Simulator: sim/setup.md diff --git a/theme_overrides/partials/footer.html b/theme_overrides/partials/footer.html new file mode 100644 index 00000000..524fad24 --- /dev/null +++ b/theme_overrides/partials/footer.html @@ -0,0 +1,22 @@ +{% import "partials/language.html" as lang with context %} + \ No newline at end of file