FOSSBot for VS Code
Program a physical FOSSBot directly from Visual Studio Code using Python or the built-in Blockly editor.
FOSSBot is an open-source, open-design educational robot developed collaboratively by Harokopio University of Athens and GFOSS. It is based on Raspberry Pi and is designed for STEAM education at multiple levels.
Features
- Connect directly to the server included in the official FOSSBot Raspberry Pi image.
- Discover FOSSBot robots on the local network.
- Run the current Python file on the physical robot.
- Stop a running program from VS Code.
- Create programs with an integrated Blockly editor.
- View robot output and sensor values in the FOSSBot Output channel.
- Browse a quick-start guide and Python API reference in the FOSSBot sidebar.
The extension uses the same Socket.IO protocol as fossbot-app, including execute_blockly, execute_blockly_result, stop_script, and trm.
Connect to the physical robot
Turn on FOSSBot.
Connect your computer to the robot's fossbot-000 Wi-Fi access point. You can also use the captive-portal wizard to connect the robot to your local network.
In VS Code, open the FOSSBot view and select Configure Robot URL.
Enter one of the standard addresses:
- Access-point mode:
http://10.41.0.1:8081
- mDNS on a local network:
http://fossbot-000.local:8081
- Local IP:
http://RASPBERRY_PI_IP:8081
Select Connect to Robot.
The official FOSSBot image already provides the compatible service on port 8081. You do not need to install a separate agent on the robot.
Program with Python
Open a Python file and run FOSSBot: Run Current Python File.
for step in range(4):
robot.move_forward_distance(20)
robot.rotate_clockwise_90()
robot.rgb_set_color("green")
transmit("Square completed")
robot.stop()
The robot runtime provides:
robot, an instance of the real FOSSBot Python hardware API.
transmit(value), which writes values to the FOSSBot Output channel.
Useful API calls include:
robot.move_forward()
robot.move_reverse()
robot.move_forward_distance(20)
robot.rotate_clockwise_90()
robot.rotate_counterclockwise_90()
robot.get_distance()
robot.get_light_sensor()
robot.get_floor_sensor(1)
robot.get_acceleration("x")
robot.get_gyroscope("z")
robot.rgb_set_color("red")
robot.wait(1)
robot.stop()
Blockly
Run FOSSBot: Open Blockly Editor to build a program graphically, inspect the generated Python, and execute it on the connected robot. The editor can also import and export Blockly XML projects.
Commands
FOSSBot: Connect to Robot
FOSSBot: Disconnect
FOSSBot: Discover Robots on Local Network
FOSSBot: Configure Robot URL
FOSSBot: Check Robot Python Version
FOSSBot: Run Current Python File
FOSSBot: Stop Program
FOSSBot: Open Blockly Editor
FOSSBot: Show Output
Settings
{
"fossbot.url": "http://fossbot-000.local:8081",
"fossbot.autoConnect": true,
"fossbot.connectionTimeoutMs": 5000
}
FOSSBot hardware
The physical robot includes an ultrasonic distance sensor, line sensors, light sensors, accelerometer, gyroscope, odometers, IR receiver, speaker, and RGB LED. Its printable body includes a Lego-compatible surface and a marker attachment for drawing activities.
FOSSBot supports manual control, Blockly programming, notebook-based Python, and direct Python programming. See the FOSSBot project repository, hardware and assembly documentation, and FOSSBot website for more information.
Safety
Run programs with the robot on the floor, keep it away from stairs and table edges, and be ready to use FOSSBot: Stop Program or the hardware power switch.
Programs execute Python on the robot. Connect only to FOSSBot devices you trust and use a trusted local network.
License
MIT