Cbstat
From CajunBot Wiki
CBStat is the GUI frontend for managing the CajunBot software while running in the bot. It manages the startup and running programs across the bot computers, displays queue information, error messages, and allows viewing of realtime visualization using cbviz. Additionally, with cbstat, configurations can be set and synchronized across all the bot machines, log data copied from the data logger, and RNDF files can be created. This document is a guide to using cbstat.
Contents |
[edit] Startup
To start cbstat, the CajunBot software cbsystem must be compiled on the current machine. Typically before you compiled the code on the current machine, you make a tar file of it.
cd ~ tar -cf cbsystem.tar cbsystem/
This is used for the automatic compile on the bot machines. The environmental variable CBBOTNAME must be set to "raginbot" (aka CajunBot-II), since the software is used while in the bot. On the CajunBot laptops, this is usually already set up for you in your ~/.bashrc file, however you can always set it manually by typing:
export CBBOTNAME=raginbot
The bot machines need to be powered on, the local machine needs to have its IP set appropriately as well as routing information. See the Bot Operating Procedures for help in setting your IP address and the appropriate routing information. The section "Putting the code on the bot" has relevant information about setting IP address and routing information. The troubleshooting section has information about the following error:
- After running cbstat_startup.sh, the terminal prints: "setsockopt: No such device" and "cb_remote: Unable to open remote socket".
When cbstat is started successfully, the first window you should see will be like the image at the right:
A quick description of this window (more description to follow):
- Top left corner has connection status. Click the "Refresh" button to ping the bot computers to make sure they are turned on and you can reach them through the network.
- Below that is the code compilation button "Execute", which will prompt you to select the tar file for cbsystem (from the above steps) so that the code will automatically be compiled on the bot machines.
- Below the code compilation button is the button for the log data copy dialog, which will allow you to copy the log data off of the data logger machine onto the local computer in the location of your choosing.
The photo at the right is from an older version of cbstat but shows what the connection information may look like (the red highlighted text):
If you haven't set routing information, you will see something like the following (at the right):
To fix it, setup your routing information:
# route add -net 224.0.0.0/24 dev eth0 # route
[edit] Compiling code on the bot machines
- Note: Before you do this, you may want to check that the date on the bot computers is correct (using the cbstat widget to set and check the date) or else the compilation process might not go so smooth.
Click the "Execute" button in the code compilation area of the setup window:
If you have not set the IP address of the laptop to be on the right subnet, or one of the bot machines is not turned on, you may see a message like the following (after which cbstat will close):
After clicking the execute button you will be prompted with a dialog:
Valid file types are *tar, *tar.gz, and *tgz. Select the file and choose "Open". If you click "Cancel", then you will go back to the setup screen.
After clicking "Open", you will be updated as to the status of the code compilation process (Note, the following screen shots are old, but the process is the same):
It is possible that the date may have been reset on one or more of the bot machines, and you will notice a lot of error messages being repeated in the terminal, similar to the following:
If this happens, you can click the "x" on the status window to proceed back to the setup window. The code will attempt to keep compiling in the background, so you will need to use the setup window to either set the date on the machines and/or restart NTP on some or all machines.
[edit] The Setup window
The setup window will initially load default options:
Currently most of the options are just a single choice, but others allow you to choose from a list of items, such as obstacle detection method.
A note about survey mode: If you are doing a survey for data collection, make sure you choose the "survey" obstacle detection option:
To see the connection status of the bot machines, click on the "Refresh" button at the bottom of the connections status area. There will be some text labels highlighted green or red depending on if the specified computer could be reached or not.
To see the NTP synchronization status, click on the "Refresh" button at the bottom of the NTP status area. This is the same as running date and ntpq -p on the bot machines.
(This image is from the previous layout of cbstat, but the functionality is the same)
To set the date, use the field in the Date & NTP Management area to input the date. Note which computer is selected in the "Computer" dropdown. Click on "Set Date" or "Set Date (All)" to change the date on the specified machine.
To reboot one of the selected computers, click the "reboot" button in the Date & NTP Management area. Note which computer is selected in the "Computer" dropdown. When you click this button, a dialog will pop up asking you to confirm your intentions:
If you click "Yes", the computer will be restarted. Clicking "No" or the "x" has no effect on the selected computer.
If you were to click "Ok" on the setup window without choosing an RNDF and/or an MDF, then the following dialog will be displayed:
(This image is from the previous layout of cbstat, but the functionality is the same)
Additionally, the "Route and Mission" area of the setup window will have highlighted the RNDF and/or MDF labels if you have forgotten to choose it. If you indeed have forgotten to choose an RNDF or MDF, then click "Ok" to return to the setup window. If instead you want to proceed to the main cbstat window (perhaps you accidentally quit cbstat and the software is still running), then click on "Continue Anyways" in the dialog. No settings will be synchronized, and the main cbstat window will be shown.
The following images illustrate choosing an RNDF and MDF, and checking the connection information before clicking the "Ok" button of the setup window:
Choose an MDF by clicking the "Choose MDF" button, which will automatically load a file chooser dialog in the $CBCONF/mdf folder:
Choose an RNDF by clicking the "Choose RNDF" button, which will automatically load a file chooser dialog in the $CBCONF/rndf folder:
Returning to the main setup window after choosing RNDF & MDF, checking connection status, and preparing to press the "Ok" button:
(This image is from the previous layout of cbstat, but the functionality is the same)
[edit] Broadcasting Data to the Lab or elsewhere
To enable the broadcasting of data to the lab or some other address, using the drop down for enabling export of CB_REMOTE_NET. You may also want to modify where the data is sent. Typically, the port is 6000, so be certain to retain the colon with the port number. See also the following document: Remote Data Broadcast.
(This image is from the previous layout of cbstat, but the functionality is the same)
Once the "Ok" button on the setup window is clicked, the setup window will close and a progress bar will pop up showing the status of the synchronization process:
Once the files have been synchronized, the main cbstat window will be shown.
[edit] CBStat Main window
Notice the following on the main cbstat window, which will be discussed in more detail to follow:
- Toolbar buttons:
- Quit
- Setup
- Visualizer
- Launch
- Kill
- Save Log
- Copy Data
- Create RNDF
- Help
- Notebook for cbmesg output and run description input.
- Treeview for queue names, status, and data rate.
[edit] Quit
When the "Quit" toolbar button is clicked, the cbstat window "x" button, the setup window "Quit" button, or the setup window "x" button is clicked, the following dialog will be shown before cbstat is closed:
Clicking "Cancel" will return you to the previous window. Clicking "No" will shut down cbstat and leave the bot machines unchanged. Clicking "Yes" will shut down all of the bot machines including the NTP computer.
Output in the terminal as "Yes" is clicked for shutting down bot machines is chosen and cbstat closes:
[edit] Setup
Clicking the "Setup" toolbar button will show the setup window. See the section above titled "The Setup window".
[edit] Visualizer
Clicking the "Visualizer" toolbar button will attempt to launch the cbviz program for realtime visualization. If the software hasn't been started yet and there is no nav data in the queue, then cbviz will fail to launch.
[edit] Launch
Clicking the "Launch" button will start up the cbsystem software on the bot machines. Within a few moments, you should notice some activity in both the terminal and the main cbstat window. CBMessages will populate the notebook area of the cbstat window (the left side with the tab "Messages"), and most of the queues should be populated with data. The queues display is on the right side of the cbstat window, with a coloured circle next to the queue name. A color of red means no data has been received. A color of yellow means the queue received data before, but is currently not receiving data. A color of green means the queue is actively being populated with data.
[edit] Kill
When you press the "Kill" toolbar button, the first thing that happens is a script in the background goes on each bot machine and stops the software from running. If you filled some text into the "Run Description" tab, then it will be written to the log folder. Choosing "No" from the dialog will return you back to the cbstat window. Choosing "Yes" will SCP (secure copy) the previous log folder from the data logger machine (and the vision machine if images were captured) onto the local machine to the HOME folder of the user.
Choosing "Yes" will display this message while the data is copied:
The terminal will show what is happening with the background scripts:
If you click on the "Kill" toolbar button before starting a run and then click "Yes" to the dialog, there is not previous log folder so the terminal will show this error:
[edit] Save Log
If there is text in the "Run Description" tab textarea, then a run description file will be saved to the current (or previous) log data folder.
[edit] Copy Data
Clicking on the "Copy Data" toolbar button will show the following window:
(This image is from the previous layout of cbstat, but the functionality is the same except there is a button that has been added to choose the destination location for the log data)
The program gets a listing of all the folders in the log directory of the data logger machine. You can select the folders you want to copy the same way you would use any other selection box: use the control button to toggle specific selections, or use the shift button to select a range. Once you have made your selection, click on the "Start Copy" button:
(This image is from the previous layout of cbstat, but the functionality is the same except there is a button that has been added to choose the destination location for the log data)
A progress bar and a status bar will show you what is happening while the data is being copied. The data is copied to the user's home directory or the location you have selected. Click "Ok" to return to the main cbstat window.
[edit] Create RNDF
Clicking on the "Create RNDF" toolbar button will close the cbstat main window and show the RNDF creator window which looks like the following:
Before going to this window, the software should be running (or at the very least the nav queue on the local machine should be populated).
This window allows the dynamic creation of an RNDF by letting the user pick which waypoint of which segment and lane to collect, not necessarily in order, then to check the status of the RNDF and build the file.
In the first field "RNDF Name", type in the appropriate name for the rndf. This will be a file in the $CBCONF/rndf folder, and if the file already exists then the saved points will be appended to the file (so it is a good idea to pick something unique).
The next field specifies the segment and lane that you currently are on. The format is given in an example, such as "2.3" for segment 2, lane 3.
The field following the segment and lane field is the waypoint field, which specifies the number of the current waypoint that you are about to save. This field is auto-incremented by 1 each time the user saves a waypoint.
The label "RNDF Status" is updated whenever the user clicks on "Check RNDF Status" or "Build RNDF", more on this later.
Below is the area "Collected Points" which contains a textarea for showing the file contents. When the user clicks on the button "Refresh", the contents of the file will be loaded into this text area. The user can edit the text, and optionally save the text back to the file using the "Save Text" button.
The following image shows the user collecting 16 waypoints then clicking "Refresh" to show the collected points (as you can see there was no valid nav data at the time of collecting the points, but this is simply an example):
Suppose the user made some edit to the textarea and wanted to save the information back to the file. Clicking the "Save Text" button will display the following dialog:
Clicking "Yes" will save the contents of the textarea back to the file.
The following image shows that the user collected some waypoints and wants to see if the RNDF is complete. Clicking the "Check RNDF Status" will show the following:
As you can see, the error is because there is a waypoint 1.2.17 that is in the file, but waypoints 1.2.1 through 1.2.16 have not been saved. If the user corrects the waypoint 1.2.17 to read 1.1.17, saves the file, and then clicks on "Check RNDF Status" again, then the following is displayed:
The green "Complete" label indicates that the RNDF is ready for build. Click the "Build RNDF" button to generate the RNDF file, which will update the "RNDF Status" label and load the contents into the textarea automatically. Also, you can see the output in the terminal from the script working in the background.
Let's say we've just built the RNDF and click on the "Build RNDF" button again. In the terminal, a warning from the background script will be displayed, as it checks if the file has "RNDF_name" as the first field on the first line of the file:
[edit] Help
Clicking on the "Help" toolbar button will pop up the following dialog, which displays the text from the cbsystem documentation:






































