Connecting to Robot, Capturing Data & Obtaining Risk Scores
Before running inference with RideScan, ensure you have the correct robot connection details, collect data in a supported format, and upload it via the Python API package.
Spot Robot
Connect to Spot’s on-board PC over SSH, start a mission, record a rosbag, stop recording, transfer the file back, and send it to RideScan.
process = subprocess.Popen(
[
"python3",
"-m",
"replay_mission",
"--username", self.username,
"--password", self.password,
self.robot_ip,
"autowalk",
self.walk_filename
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
print("Mission objectives accomplished")- Install dependencies (preferably inside a virtualenv).
- Set API key in environment variables or .env (API_KEY=...).
- Set server URL (FLASK_API_BASE_URL=...).
- Import the Python package and call calculate_risk_scores().
- Use list_files(robot, mission) to view risk scores.
UR Robot
Connect via RTDE, configure the XML recipe, capture joint states and TCP data into a CSV, and then send that CSV to RideScan.
ROBOT_IP = "" # Fill in the Robot's IP here
RTDE_PORT = 30004
DASHBOARD_PORT = 29999
CONFIG_FILE = "record_config.xml"
FREQUENCY_HZ = 10Sample XML recipe
<?xml version="1.0" encoding="UTF-8"?>
<rtde_config>
<recipe key='out'>
<field name="actual_q" type="VECTOR6D"/>
<field name="target_q" type="VECTOR6D"/>
<field name="actual_TCP_pose" type="VECTOR6D"/>
<field name="speed_scaling" type="DOUBLE"/>
<field name="runtime_state" type="UINT32"/>
<field name="timestamp" type="DOUBLE"/>
</recipe>
</rtde_config>- Install dependencies (inside a virtualenv recommended).
- Set API_KEY and FLASK_API_BASE_URL in environment variables.
- Call calculate_risk_scores("YourUR", "YourMission", ["/path/to/*.csv"]).
- Use list_files(robot, mission) to view risk scores.
Important Notes
- Always have robot IP and credentials/ports ready.
- Collect data using rosbag (Spot) or RTDE (UR) or other supported methods.
- API keys must be set via environment variables. Never commit them.
- Supported upload formats: .bag, .zip, .csv
Troubleshooting
- 401 Unauthorized: Ensure API_KEY is set. Client retries once if token refresh needed.
- 404 Not Found: Verify robot/mission names. Use list_robots() and list_missions(robot).
- 400 Bad Request: Upload files first; then call /api/process.
- Invalid names: Follow regex rules (letters/digits/spaces/dashes).
- Unsupported files: Only .bag, .zip, .csv allowed.
- Spot issues: Check SSH credentials, ROS setup, rosbag availability.
- UR issues: Verify ports 29999/30004 and running program on controller.
Installing Connectors & Pipeline Integration
- Install dependencies (pip install -r requirements.txt).
- Set environment variables: API_KEY=..., FLASK_API_BASE_URL=...
- Use Python API in your pipeline:
from risk_score_calculator.calculator import RiskScoreCalculator
calc = RiskScoreCalculator(api_key="your_API_KEY")
calc.calculate_risk_scores("RobotName", "MissionName", ["/path/to/file"])ROS: record topics via rosbag (e.g., /spot/odometry, /joint_states).
UR: capture CSV via RTDE.
Pass resulting .bag or .csv to RideScan.