|
| 1 | +--- |
| 2 | +layout: single |
| 3 | +title: MBot Command Line Tool |
| 4 | +toc: true |
| 5 | +--- |
| 6 | + |
| 7 | +> This guide provides an overview of all command line tools in the MBot ecosystem. |
| 8 | +
|
| 9 | +Currently, there are 3 tools available: |
| 10 | +- mbot-lcm-spy: Monitors all LCM traffic on the MBot. |
| 11 | +- mbot-service: Manages and monitors MBot system services. |
| 12 | +- mbot-lcm-msg: Inspects the data structure of MBot LCM messages. |
| 13 | + |
| 14 | +The codebase for these tools is located in `mbot_lcm_base/mbot_sys_cli`. |
| 15 | + |
| 16 | +## Installation |
| 17 | +If `mbot_lcm_base` is installed correctly, all MBot CLI tools are already installed. |
| 18 | + |
| 19 | +To find them: |
| 20 | +- Enter `mbot` in the terminal and hit "Enter" key. The available tools will be printed out: |
| 21 | + ```bash |
| 22 | + mbot@mbot-pi5base-test1:~ $ mbot |
| 23 | + Usage: mbot {service|lcm-spy|lcm-msg} [args] |
| 24 | + ``` |
| 25 | +- Auto-completion is also available: type `mbot ` (with a space) and hit the "Tab" key to list available tools. |
| 26 | + ```bash |
| 27 | + mbot@mbot-pi5base-test1:~ $ mbot |
| 28 | + lcm-msg lcm-spy service |
| 29 | + ``` |
| 30 | +- If the above command doesn't work, close current terminal and open a new one. (Although this shouldn't be necessary) |
| 31 | + |
| 32 | +Demo: |
| 33 | +<iframe width="560" height="315" src="https://www.youtube.com/embed/B150ZqKUrf4?si=LJhwXcSYsiszmjU7" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> |
| 34 | + |
| 35 | +## mbot-lcm-spy |
| 36 | +### Usage |
| 37 | +```shell |
| 38 | +mbot lcm-spy [-h] [--channels CHANNELS] [--rate RATE] [--module MODULE] |
| 39 | +``` |
| 40 | + |
| 41 | +**Options** |
| 42 | +- `-h, --help`: Show this help message and exit |
| 43 | +- `--channels CHANNELS`: Comma-separated list of channel names to print decoded messages |
| 44 | +- `--rate RATE`: Rate at which data is printed in Hz (default: 1 Hz) |
| 45 | +- `--module MODULE`: Module to use for decoding messages (default: "mbot_lcm_msgs") |
| 46 | + |
| 47 | +**Press CTRL+C to quit** |
| 48 | + |
| 49 | +### When to use? |
| 50 | +When you are looking for the answers to: |
| 51 | +- Is the MBot velocity message being sent out? |
| 52 | + - `mbot lcm-spy` |
| 53 | +- What is current odometry value? |
| 54 | + - `mbot lcm-spy --channels MBOT_ODOMETRY` |
| 55 | +- Are both the MBot velocity and odometry being updated? |
| 56 | + - `mbot lcm-spy --channels MBOT_ODOMETRY,MBOT_VEL` |
| 57 | + |
| 58 | + |
| 59 | +### Demo |
| 60 | +<iframe width="560" height="315" src="https://www.youtube.com/embed/9egBSuIqhUo?si=1FX_YsQl0J3ePfa-" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> |
| 61 | + |
| 62 | +## mbot-service |
| 63 | +### Usage |
| 64 | + |
| 65 | +```bash |
| 66 | +mbot service {list|status|log|start|stop|restart|enable|disable} [service_name] |
| 67 | +``` |
| 68 | +``` |
| 69 | +Actions: |
| 70 | + list List all mbot- services |
| 71 | + status Status of all mbot- services or a specific service |
| 72 | + log Show log for the service |
| 73 | + start Start the service |
| 74 | + stop Stop the service |
| 75 | + restart Restart the service |
| 76 | + enable Enable the service (not immediate start) |
| 77 | + disable Disable the service (not immediate stop) |
| 78 | + |
| 79 | +Examples: |
| 80 | + mbot service list |
| 81 | + mbot service status |
| 82 | + mbot service status mbot-xxx.service |
| 83 | + mbot service log mbot-xxx.service |
| 84 | + mbot service start mbot-xxx.service |
| 85 | + mbot service stop mbot-xxx.service |
| 86 | + mbot service restart mbot-xxx.service |
| 87 | + mbot service enable mbot-xxx.service |
| 88 | + mbot service disable mbot-xxx.service |
| 89 | +``` |
| 90 | +### When to use? |
| 91 | +When you are looking for the answers to: |
| 92 | +- What services are installed? |
| 93 | + - `mbot service list` |
| 94 | +- What was the name of that service... motion controller something? |
| 95 | + - `mbot service list` |
| 96 | +- Is mbot-motion-controller.service running? |
| 97 | + - `mbot service status mbot-motion-controller.service` |
| 98 | +- Why did mbot-start-network.service failed? |
| 99 | + - `mbot service log mbot-start-network.service` |
| 100 | +- I need to stop mbot-motion-controller.service for now |
| 101 | + - `mbot service stop mbot-motion-controller.service` |
| 102 | +- I'm in development and want to disable mbot-motion-controller.service |
| 103 | + - `mbot service disable mbot-motion-controller.service` |
| 104 | +- Did I stop mbot-slam.service? Was it still running? |
| 105 | + - `mbot service status mbot-slam.service` |
| 106 | + - `mbot service log mbot-slam.service` |
| 107 | +
|
| 108 | +### Demo |
| 109 | +<iframe width="560" height="315" src="https://www.youtube.com/embed/KTV3hlaVQY4?si=uVJxBW5Q7-K6N-rk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> |
| 110 | +
|
| 111 | +## mbot-lcm-msg |
| 112 | +### Usage |
| 113 | +``` |
| 114 | +mbot lcm-msg [-h] [--module MODULE] {show,list} ... |
| 115 | + |
| 116 | +positional arguments: |
| 117 | + {show,list} sub-command help |
| 118 | + show Output the message definition |
| 119 | + list List all available LCM messages |
| 120 | + |
| 121 | +options: |
| 122 | + -h, --help show this help message and exit |
| 123 | + --module MODULE Module to use for decoding messages |
| 124 | +``` |
| 125 | +
|
| 126 | +### When to use? |
| 127 | +When you are looking for the answers to: |
| 128 | +- What LCM message types are available? |
| 129 | + - `mbot lcm-msg list` |
| 130 | +- What is pose3D_t? How about pose2D_t? |
| 131 | + - `mbot lcm-msg show pose3D_t` |
| 132 | + - `mbot lcm-msg show pose3D_t,pose2D_t` (this will print both pose3D_t and pose2D_t data structure) |
| 133 | +- I just added a new message type, is it installed? |
| 134 | + - `mbot lcm-msg list` |
| 135 | +
|
| 136 | +### Demo |
| 137 | +<iframe width="560" height="315" src="https://www.youtube.com/embed/zSHahiZNv_A?si=GBOBaFaTz3UKvp6r" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> |
0 commit comments