Close

Software

A project log for 8BitRobots Module

A common hardware, software and 3D printed module to enable fun, educational robots anyone can print and program.

tim-wilkinsonTim Wilkinson 04/22/2018 at 06:200 Comments

The software is written in Javascript running on NodeJS. I've always had a soft spot for Javascript, but here it was particularly appropriate as I have software running on hardware nodes and in web browsers. Javascript runs on both.

The actively developed iteration of the software can be found on GitHub at https://github.com/aanon4/8bitrobots

There are a few older versions of this software kicking about on my GitHub account (notably the version for my first ROV) and even this new version contains some legacy (and probably non-functional) parts. As this project evolves so will the software.

The 8BitRobots software is very ROS in its API style (though not in much else). Hardware and software makes itself available to the system as a set of services and topics. Services allow things to be controlled, topics provide information; and everything is named in a global namespace. The software runs under Linux on the Pi. Because I do most of the development on a Mac, it also runs there although the hardware is simulated or not supported.

The "config" directory in the main distribution contains some configuration setups for a few simple robots. Each named robot starts up a set to hardware and software services.

There are a few tools to allow the robot state to be observed, and these can be found in the "utils" directory. The "8bit-list.js' tool is probably the easiest to use and simply discovers all the services and topics the robots supports.

If I were to run the robot software on a Mac:

sudo ./8bitrobot.js bot

You'd see something like the following:

bash$ sudo ./8bitrobot.js bot

*** Starting 8BitRobot: bot
Loading Globals.
Loading 8-Bit API.
Loading Server.
Loading 8-Bit Master.
Loading Console.
Loading I2C
Loading RaspberryPi I2C controllers.
Loading RaspberryPi board.
Loading GPIO
Loading RaspberryPi GPIO/PWM controllers.
Loading Motion Planner.
Loading SPI
Loading RaspberryPi SPI controllers.
Loading PCA9685 controllers.
Loading Config Manager
Loading State Manager.
 +/pwm-i2c/3/66/config
 +/pwm-i2c/3/66/4/current_pulse
 +/pwm-i2c/3/66/4/set_pulse
 +/pwm-i2c/3/66/4/wait_for_pulse
Loading DRV8833 H-Bridge controllers.
Loading BNO055 I2C/UART IMU sensors.
Loading BMP280 Environmental sensors.
Loading INA219 power monitors.
Loading GPIO Encoders.
 +/encoder/0/config
 +/encoder/1/config
Loading Kinematics.
 +/kinematics/config
Loading Environment.
Loading Health Monitor.
 +/health/config
Loading Networking.
Loading Tank Axle.
Loading 108mm wheels.
Loading FT90R continuous digital servos.
Loading Car.
Loading UI.
Starting /server/node.
 +/server/add_pages
Starting /master/node.
 +/list
Starting /console/node.
 +/console/log
Starting /imu/node.
 +/imu/orientation
 +/imu/acceleration
 +/imu/calibration
 +/imu/temperature
Starting /atmos/node.
 +/atmos/temperature
 +/atmos/pressure
Starting /power/node.
 +/power/status
Starting /encoder/0/node.
 +/encoder/0/rate
Starting /encoder/1/node.
 +/encoder/1/rate
Starting /kinematics/node.
 +/kinematics/orientation
 +/kinematics/acceleration
 +/kinematics/calibration
 +/kinematics/position
 +/kinematics/reset_level
Starting /environment/node.
 +/environment/external/temperature
 +/environment/external/pressure
 +/environment/external/humidity
Starting /health/node.
 +/health/compute
 +/health/battery
 +/health/status
Starting /networking/node.
 +/networking/config
Starting /car/drive/node.
 +/pwm-i2c/3/66/0/current_pulse
 +/pwm-i2c/3/66/0/set_pulse
 +/pwm-i2c/3/66/0/wait_for_pulse
 +/car/drive/wheel/left/current_velocity
 +/car/drive/wheel/left/set_velocity
 +/car/drive/wheel/left/wait_for_velocity
 +/pwm-i2c/3/66/7/current_pulse
 +/pwm-i2c/3/66/7/set_pulse
 +/pwm-i2c/3/66/7/wait_for_pulse
 +/car/drive/wheel/right/current_velocity
 +/car/drive/wheel/right/set_velocity
 +/car/drive/wheel/right/wait_for_velocity
 +/car/drive/current_angle
 +/car/drive/set_angle
 +/car/drive/wait_for_angle
 +/car/drive/current_velocity
 +/car/drive/set_velocity
 +/car/drive/wait_for_velocity
Starting /car/node.
 +/car/set_movement
 +/car/execute_gesture
 +/car/shutdown
Starting /ui/node.
Starting /activity/node.

  You can then use the tools to query the robot:

bash$ ./8bit-list.js

Topics:
  /pwm-i2c/3/66/4/current_pulse
  /console/log
  /imu/orientation
  /imu/acceleration
  /imu/calibration
  /imu/temperature
  /atmos/temperature
  /atmos/pressure
  /power/status
  /encoder/0/rate
  /encoder/1/rate
  /kinematics/orientation
  /kinematics/acceleration
  /kinematics/calibration
  /kinematics/position
  /environment/external/temperature
  /environment/external/pressure
  /environment/external/humidity
  /health/compute
  /health/battery
  /health/status
  /pwm-i2c/3/66/0/current_pulse
  /car/drive/wheel/left/current_velocity
  /pwm-i2c/3/66/7/current_pulse
  /car/drive/wheel/right/current_velocity
  /car/drive/current_angle
  /car/drive/current_velocity
  /car/shutdown
Services:
  /pwm-i2c/3/66/config
  /pwm-i2c/3/66/4/set_pulse
  /pwm-i2c/3/66/4/wait_for_pulse
  /encoder/0/config
  /encoder/1/config
  /kinematics/config
  /health/config
  /server/add_pages
  /list
  /kinematics/reset_level
  /networking/config
  /pwm-i2c/3/66/0/set_pulse
  /pwm-i2c/3/66/0/wait_for_pulse
  /car/drive/wheel/left/set_velocity
  /car/drive/wheel/left/wait_for_velocity
  /pwm-i2c/3/66/7/set_pulse
  /pwm-i2c/3/66/7/wait_for_pulse
  /car/drive/wheel/right/set_velocity
  /car/drive/wheel/right/wait_for_velocity
  /car/drive/set_angle
  /car/drive/wait_for_angle
  /car/drive/set_velocity
  /car/drive/wait_for_velocity
  /car/set_movement
  /car/execute_gesture

 Want to monitor the compute health of the system, just use the 8bit-monitor.js command:

bash$ ./8bit-monitor.js /health/compute
{"cpu%":1.2,"mem%":82.50692915301106}
{"cpu%":1.6,"mem%":79.3459231616141}
{"cpu%":2.1,"mem%":80.18690310067595}
....

Discussions