latest pushes
This commit is contained in:
parent
378a112ab5
commit
b3a416b2bc
@ -19,27 +19,58 @@ import argparse
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def make_bellande_particles_request(particle, movement=None, world=None, count=None):
|
def make_bellande_particle_move_request(particle_state, rotation1, translation, rotation2):
|
||||||
url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particles/bellande_particles"
|
url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/move"
|
||||||
|
|
||||||
# Convert string inputs to lists/dicts if they're strings
|
|
||||||
if isinstance(particle, str):
|
|
||||||
particle = json.loads(particle)
|
|
||||||
if isinstance(movement, str):
|
|
||||||
movement = json.loads(movement)
|
|
||||||
if isinstance(world, str):
|
|
||||||
world = json.loads(world)
|
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"particle": particle,
|
"particle": {
|
||||||
"movement": movement,
|
"x": particle_state[0],
|
||||||
"world": world,
|
"y": particle_state[1],
|
||||||
"count": count,
|
"heading": particle_state[2],
|
||||||
|
"weight": particle_state[3] if len(particle_state) > 3 else 1.0
|
||||||
|
},
|
||||||
|
"rotation1": rotation1,
|
||||||
|
"translation": translation,
|
||||||
|
"rotation2": rotation2,
|
||||||
"auth": {
|
"auth": {
|
||||||
"authorization_key": "bellande_web_api_opensource"
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return send_request(url, payload)
|
||||||
|
|
||||||
|
def make_bellande_particle_read_markers_request(particle_state, world_info):
|
||||||
|
url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/read_markers"
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"particle": {
|
||||||
|
"x": particle_state[0],
|
||||||
|
"y": particle_state[1],
|
||||||
|
"heading": particle_state[2],
|
||||||
|
"weight": particle_state[3] if len(particle_state) > 3 else 1.0
|
||||||
|
},
|
||||||
|
"world": world_info,
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return send_request(url, payload)
|
||||||
|
|
||||||
|
def make_bellande_particle_create_random_request(count, world_info):
|
||||||
|
url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/create_random"
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"count": count,
|
||||||
|
"world": world_info,
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return send_request(url, payload)
|
||||||
|
|
||||||
|
def send_request(url, payload):
|
||||||
headers = {
|
headers = {
|
||||||
'accept': 'application/json',
|
'accept': 'application/json',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@ -54,25 +85,58 @@ def make_bellande_particles_request(particle, movement=None, world=None, count=N
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Run Bellande Particles API")
|
parser = argparse.ArgumentParser(description="Run Bellande Particle API")
|
||||||
parser.add_argument("--particle", required=True,
|
subparsers = parser.add_subparsers(dest='command', required=True)
|
||||||
help="Particle state as JSON-formatted list [x, y, heading, weight]")
|
|
||||||
parser.add_argument("--movement",
|
# Move command
|
||||||
help="Movement parameters as JSON-formatted list [rotation1, translation, rotation2]")
|
move_parser = subparsers.add_parser('move', help='Move particle')
|
||||||
parser.add_argument("--world",
|
move_parser.add_argument("--particle-state", required=True,
|
||||||
help="world information as JSON object with width, height, and markers")
|
help="Particle state as JSON-formatted list [x, y, heading, weight]")
|
||||||
parser.add_argument("--count", type=int,
|
move_parser.add_argument("--rotation1", type=float, required=True,
|
||||||
help="Particle count for random generation")
|
help="First rotation angle")
|
||||||
|
move_parser.add_argument("--translation", type=float, required=True,
|
||||||
|
help="Translation distance")
|
||||||
|
move_parser.add_argument("--rotation2", type=float, required=True,
|
||||||
|
help="Second rotation angle")
|
||||||
|
|
||||||
|
# Read markers command
|
||||||
|
read_parser = subparsers.add_parser('read-markers', help='Read markers')
|
||||||
|
read_parser.add_argument("--particle-state", required=True,
|
||||||
|
help="Particle state as JSON-formatted list [x, y, heading, weight]")
|
||||||
|
read_parser.add_argument("--world", required=True,
|
||||||
|
help="World information as JSON object")
|
||||||
|
|
||||||
|
# Create random command
|
||||||
|
random_parser = subparsers.add_parser('create-random', help='Create random particles')
|
||||||
|
random_parser.add_argument("--count", type=int, required=True,
|
||||||
|
help="Number of particles to create")
|
||||||
|
random_parser.add_argument("--world", required=True,
|
||||||
|
help="World information as JSON object")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = make_bellande_particles_request(
|
if args.command == 'move':
|
||||||
args.particle,
|
particle_state = json.loads(args.particle_state)
|
||||||
args.movement,
|
result = make_bellande_particle_move_request(
|
||||||
args.world,
|
particle_state,
|
||||||
args.count
|
args.rotation1,
|
||||||
)
|
args.translation,
|
||||||
|
args.rotation2
|
||||||
|
)
|
||||||
|
elif args.command == 'read-markers':
|
||||||
|
particle_state = json.loads(args.particle_state)
|
||||||
|
world_info = json.loads(args.world)
|
||||||
|
result = make_bellande_particle_read_markers_request(
|
||||||
|
particle_state,
|
||||||
|
world_info
|
||||||
|
)
|
||||||
|
elif args.command == 'create-random':
|
||||||
|
world_info = json.loads(args.world)
|
||||||
|
result = make_bellande_particle_create_random_request(
|
||||||
|
args.count,
|
||||||
|
world_info
|
||||||
|
)
|
||||||
|
|
||||||
print(json.dumps(result, indent=2))
|
print(json.dumps(result, indent=2))
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
|
@ -19,49 +19,122 @@ use std::error::Error;
|
|||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
#[derive(StructOpt, Debug)]
|
#[derive(StructOpt, Debug)]
|
||||||
#[structopt(name = "bellande_particle", about = "Bellande Particles Tool")]
|
enum Command {
|
||||||
struct Opt {
|
#[structopt(name = "move", about = "Move particle")]
|
||||||
#[structopt(
|
Move {
|
||||||
long,
|
#[structopt(
|
||||||
help = "Particle state as JSON-formatted list [x, y, heading, weight]"
|
long,
|
||||||
)]
|
help = "Particle state as JSON-formatted list [x, y, heading, weight]"
|
||||||
particle: String,
|
)]
|
||||||
|
particle_state: String,
|
||||||
|
|
||||||
#[structopt(
|
#[structopt(long, help = "First rotation angle")]
|
||||||
long,
|
rotation1: f64,
|
||||||
help = "Movement parameters as JSON-formatted list [rotation1, translation, rotation2]"
|
|
||||||
)]
|
|
||||||
movement: Option<String>,
|
|
||||||
|
|
||||||
#[structopt(
|
#[structopt(long, help = "Translation distance")]
|
||||||
long,
|
translation: f64,
|
||||||
help = "World information as JSON object with width, height, and markers"
|
|
||||||
)]
|
|
||||||
world: Option<String>,
|
|
||||||
|
|
||||||
#[structopt(long, help = "Particle count for random generation")]
|
#[structopt(long, help = "Second rotation angle")]
|
||||||
count: Option<i32>,
|
rotation2: f64,
|
||||||
|
},
|
||||||
|
|
||||||
|
#[structopt(name = "read-markers", about = "Read markers")]
|
||||||
|
ReadMarkers {
|
||||||
|
#[structopt(
|
||||||
|
long,
|
||||||
|
help = "Particle state as JSON-formatted list [x, y, heading, weight]"
|
||||||
|
)]
|
||||||
|
particle_state: String,
|
||||||
|
|
||||||
|
#[structopt(long, help = "World information as JSON object")]
|
||||||
|
world: String,
|
||||||
|
},
|
||||||
|
|
||||||
|
#[structopt(name = "create-random", about = "Create random particles")]
|
||||||
|
CreateRandom {
|
||||||
|
#[structopt(long, help = "Number of particles to create")]
|
||||||
|
count: i32,
|
||||||
|
|
||||||
|
#[structopt(long, help = "World information as JSON object")]
|
||||||
|
world: String,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn make_bellande_particles_request(
|
#[derive(StructOpt, Debug)]
|
||||||
particle: Value,
|
#[structopt(name = "bellande_particle", about = "Bellande Particle Tool")]
|
||||||
movement: Option<Value>,
|
struct Opt {
|
||||||
world: Option<Value>,
|
#[structopt(subcommand)]
|
||||||
count: Option<i32>,
|
cmd: Command,
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn make_bellande_particle_move_request(
|
||||||
|
particle_state: Value,
|
||||||
|
rotation1: f64,
|
||||||
|
translation: f64,
|
||||||
|
rotation2: f64,
|
||||||
) -> Result<Value, Box<dyn Error>> {
|
) -> Result<Value, Box<dyn Error>> {
|
||||||
let client = reqwest::Client::new();
|
let url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/move";
|
||||||
let url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/bellande_particle";
|
|
||||||
|
|
||||||
let payload = json!({
|
let payload = json!({
|
||||||
"particle": particle,
|
"particle": {
|
||||||
"movement": movement,
|
"x": particle_state[0],
|
||||||
"world": world,
|
"y": particle_state[1],
|
||||||
"count": count,
|
"heading": particle_state[2],
|
||||||
|
"weight": particle_state.get(3).unwrap_or(&json!(1.0))
|
||||||
|
},
|
||||||
|
"rotation1": rotation1,
|
||||||
|
"translation": translation,
|
||||||
|
"rotation2": rotation2,
|
||||||
"auth": {
|
"auth": {
|
||||||
"authorization_key": "bellande_web_api_opensource"
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
send_request(url, payload).await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn make_bellande_particle_read_markers_request(
|
||||||
|
particle_state: Value,
|
||||||
|
world: Value,
|
||||||
|
) -> Result<Value, Box<dyn Error>> {
|
||||||
|
let url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/read_markers";
|
||||||
|
|
||||||
|
let payload = json!({
|
||||||
|
"particle": {
|
||||||
|
"x": particle_state[0],
|
||||||
|
"y": particle_state[1],
|
||||||
|
"heading": particle_state[2],
|
||||||
|
"weight": particle_state.get(3).unwrap_or(&json!(1.0))
|
||||||
|
},
|
||||||
|
"world": world,
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
send_request(url, payload).await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn make_bellande_particle_create_random_request(
|
||||||
|
count: i32,
|
||||||
|
world: Value,
|
||||||
|
) -> Result<Value, Box<dyn Error>> {
|
||||||
|
let url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/create_random";
|
||||||
|
|
||||||
|
let payload = json!({
|
||||||
|
"count": count,
|
||||||
|
"world": world,
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
send_request(url, payload).await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn send_request(url: &str, payload: Value) -> Result<Value, Box<dyn Error>> {
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.post(url)
|
.post(url)
|
||||||
.header("accept", "application/json")
|
.header("accept", "application/json")
|
||||||
@ -79,36 +152,38 @@ async fn make_bellande_particles_request(
|
|||||||
async fn main() -> Result<(), Box<dyn Error>> {
|
async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let opt = Opt::from_args();
|
let opt = Opt::from_args();
|
||||||
|
|
||||||
// Parse JSON strings to Values for validation
|
let result = match opt.cmd {
|
||||||
let particle: Value = serde_json::from_str(&opt.particle)
|
Command::Move {
|
||||||
.map_err(|e| format!("Error parsing particle: {}", e))?;
|
particle_state,
|
||||||
|
rotation1,
|
||||||
|
translation,
|
||||||
|
rotation2,
|
||||||
|
} => {
|
||||||
|
let particle_state: Value = serde_json::from_str(&particle_state)
|
||||||
|
.map_err(|e| format!("Error parsing particle state: {}", e))?;
|
||||||
|
|
||||||
// Parse optional movement
|
make_bellande_particle_move_request(particle_state, rotation1, translation, rotation2)
|
||||||
let movement: Option<Value> = match opt.movement {
|
.await?
|
||||||
Some(ref m) => {
|
}
|
||||||
Some(serde_json::from_str(m).map_err(|e| format!("Error parsing movement: {}", e))?)
|
Command::ReadMarkers {
|
||||||
|
particle_state,
|
||||||
|
world,
|
||||||
|
} => {
|
||||||
|
let particle_state: Value = serde_json::from_str(&particle_state)
|
||||||
|
.map_err(|e| format!("Error parsing particle state: {}", e))?;
|
||||||
|
let world: Value = serde_json::from_str(&world)
|
||||||
|
.map_err(|e| format!("Error parsing world info: {}", e))?;
|
||||||
|
|
||||||
|
make_bellande_particle_read_markers_request(particle_state, world).await?
|
||||||
|
}
|
||||||
|
Command::CreateRandom { count, world } => {
|
||||||
|
let world: Value = serde_json::from_str(&world)
|
||||||
|
.map_err(|e| format!("Error parsing world info: {}", e))?;
|
||||||
|
|
||||||
|
make_bellande_particle_create_random_request(count, world).await?
|
||||||
}
|
}
|
||||||
None => None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse optional world
|
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||||
let world: Option<Value> = match opt.world {
|
|
||||||
Some(ref w) => {
|
|
||||||
Some(serde_json::from_str(w).map_err(|e| format!("Error parsing world: {}", e))?)
|
|
||||||
}
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Run using API
|
|
||||||
match make_bellande_particles_request(particle, movement, world, opt.count).await {
|
|
||||||
Ok(result) => {
|
|
||||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
eprintln!("Error: {}", e);
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
166
README.md
166
README.md
@ -1,4 +1,4 @@
|
|||||||
# 📦 Bellande Particles
|
# 📦 Bellande Particle
|
||||||
|
|
||||||
## 🧙 Organization Website
|
## 🧙 Organization Website
|
||||||
- [![Organization Website](https://img.shields.io/badge/Explore%20Our-Website-0099cc?style=for-the-badge)](https://robotics-sensors.github.io)
|
- [![Organization Website](https://img.shields.io/badge/Explore%20Our-Website-0099cc?style=for-the-badge)](https://robotics-sensors.github.io)
|
||||||
@ -28,14 +28,16 @@
|
|||||||
|
|
||||||
url: https://bellande-robotics-sensors-research-innovation-center.org
|
url: https://bellande-robotics-sensors-research-innovation-center.org
|
||||||
|
|
||||||
endpoint_path:
|
endpoint_paths:
|
||||||
bellande_particle: /api/Bellande_Particle/bellande_particle
|
move: /api/Bellande_Particle/move
|
||||||
|
read_markers: /api/Bellande_Particle/read_markers
|
||||||
|
create_random: /api/Bellande_Particle/create_random
|
||||||
|
|
||||||
Bellande_Framework_Access_Key: bellande_web_api_opensource
|
Bellande_Framework_Access_Key: bellande_web_api_opensource
|
||||||
```
|
```
|
||||||
|
|
||||||
# API HTTP Usability (JSON FORMAT)
|
# API HTTP Usability (JSON FORMAT)
|
||||||
```
|
```json
|
||||||
{
|
{
|
||||||
"license": [
|
"license": [
|
||||||
"Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande",
|
"Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande",
|
||||||
@ -54,28 +56,64 @@ Bellande_Framework_Access_Key: bellande_web_api_opensource
|
|||||||
"GNU General Public License v3.0 or later"
|
"GNU General Public License v3.0 or later"
|
||||||
],
|
],
|
||||||
"url": "https://bellande-robotics-sensors-research-innovation-center.org",
|
"url": "https://bellande-robotics-sensors-research-innovation-center.org",
|
||||||
"endpoint_path": {
|
"endpoint_paths": {
|
||||||
"bellande_particle": "/api/Bellande_Particle/bellande_particle"
|
"move": "/api/Bellande_Particle/move",
|
||||||
|
"read_markers": "/api/Bellande_Particle/read_markers",
|
||||||
|
"create_random": "/api/Bellande_Particle/create_random"
|
||||||
},
|
},
|
||||||
"Bellande_Framework_Access_Key": "bellande_web_api_opensource"
|
"Bellande_Framework_Access_Key": "bellande_web_api_opensource"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# API Payload Example
|
# API Payload Examples
|
||||||
```
|
|
||||||
|
## Move Particle
|
||||||
|
```json
|
||||||
{
|
{
|
||||||
"particle": [0, 0, 0, 1.0],
|
"particle": {
|
||||||
"movement": {
|
"x": 0,
|
||||||
"rotation1": 45.0,
|
"y": 0,
|
||||||
"translation": 1.0,
|
"heading": 0,
|
||||||
"rotation2": -45.0
|
"weight": 1.0
|
||||||
|
},
|
||||||
|
"rotation1": 45.0,
|
||||||
|
"translation": 1.0,
|
||||||
|
"rotation2": -45.0,
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Read Markers
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"particle": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"heading": 0,
|
||||||
|
"weight": 1.0
|
||||||
},
|
},
|
||||||
"world": {
|
"world": {
|
||||||
"width": 10.0,
|
"width": 10.0,
|
||||||
"height": 10.0,
|
"height": 10.0,
|
||||||
"markers": [[1.0, 1.0]]
|
"markers": [[1.0, 1.0]]
|
||||||
},
|
},
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Create Random
|
||||||
|
```json
|
||||||
|
{
|
||||||
"count": 10,
|
"count": 10,
|
||||||
|
"world": {
|
||||||
|
"width": 10.0,
|
||||||
|
"height": 10.0,
|
||||||
|
"markers": [[1.0, 1.0]]
|
||||||
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"authorization_key": "bellande_web_api_opensource"
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
}
|
}
|
||||||
@ -83,34 +121,76 @@ Bellande_Framework_Access_Key: bellande_web_api_opensource
|
|||||||
```
|
```
|
||||||
|
|
||||||
# 🧙 Website Bellande API Testing
|
# 🧙 Website Bellande API Testing
|
||||||
- [![Website API Testing](https://img.shields.io/badge/Bellande%20API-Testing-0099cc?style=for-the-badge)](https://bellande-robotics-sensors-research-innovation-center.org/api/bellande_particles_experiment)
|
- [![Website API Testing](https://img.shields.io/badge/Bellande%20API-Testing-0099cc?style=for-the-badge)](https://bellande-robotics-sensors-research-innovation-center.org/api/bellande_particle_experiment)
|
||||||
|
|
||||||
# Quick Bellande API Testing
|
# Quick Bellande API Testing Examples
|
||||||
```
|
|
||||||
|
## Move Particle
|
||||||
|
```bash
|
||||||
curl -X 'POST' \
|
curl -X 'POST' \
|
||||||
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/bellande_particle' \
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/move' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"particle": [0, 0, 0, 1.0],
|
"particle": {
|
||||||
"movement": {
|
"x": 0,
|
||||||
"rotation1": 45.0,
|
"y": 0,
|
||||||
"translation": 1.0,
|
"heading": 0,
|
||||||
"rotation2": -45.0
|
"weight": 1.0
|
||||||
},
|
},
|
||||||
"world": {
|
"rotation1": 45.0,
|
||||||
"width": 10.0,
|
"translation": 1.0,
|
||||||
"height": 10.0,
|
"rotation2": -45.0,
|
||||||
"markers": [[1.0, 1.0]]
|
|
||||||
},
|
|
||||||
"count": 10,
|
|
||||||
"auth": {
|
"auth": {
|
||||||
"authorization_key": "bellande_web_api_opensource"
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
# Bellande Particles Usage
|
## Read Markers
|
||||||
|
```bash
|
||||||
|
curl -X 'POST' \
|
||||||
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/read_markers' \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"particle": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"heading": 0,
|
||||||
|
"weight": 1.0
|
||||||
|
},
|
||||||
|
"world": {
|
||||||
|
"width": 10.0,
|
||||||
|
"height": 10.0,
|
||||||
|
"markers": [[1.0, 1.0]]
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Create Random
|
||||||
|
```bash
|
||||||
|
curl -X 'POST' \
|
||||||
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/create_random' \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"count": 10,
|
||||||
|
"world": {
|
||||||
|
"width": 10.0,
|
||||||
|
"height": 10.0,
|
||||||
|
"markers": [[1.0, 1.0]]
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
# Bellande Particle Usage
|
||||||
|
|
||||||
## Website Crates
|
## Website Crates
|
||||||
- https://crates.io/crates/bellande_particle
|
- https://crates.io/crates/bellande_particle
|
||||||
@ -124,16 +204,28 @@ curl -X 'POST' \
|
|||||||
### Installation
|
### Installation
|
||||||
- `$ pip install bellande_particle`
|
- `$ pip install bellande_particle`
|
||||||
|
|
||||||
### Usage
|
### Command Line Usage Examples
|
||||||
```
|
|
||||||
bellande_particle \
|
```bash
|
||||||
--particle "[0, 0, 0, 1.0]" \
|
# Move particle
|
||||||
--movement '{"rotation1": 45.0, "translation": 1.0, "rotation2": -45.0}' \
|
bellande_particle move \
|
||||||
--world '{"width": 10.0, "height": 10.0, "markers": [[1.0, 1.0]]}' \
|
--particle-state "[0,0,0,1.0]" \
|
||||||
--count 10
|
--rotation1 45.0 \
|
||||||
|
--translation 1.0 \
|
||||||
|
--rotation2 -45.0
|
||||||
|
|
||||||
|
# Read markers
|
||||||
|
bellande_particle read-markers \
|
||||||
|
--particle-state "[0,0,0,1.0]" \
|
||||||
|
--world '{"width":10.0,"height":10.0,"markers":[[1.0,1.0]]}'
|
||||||
|
|
||||||
|
# Create random particles
|
||||||
|
bellande_particle create-random \
|
||||||
|
--count 10 \
|
||||||
|
--world '{"width":10.0,"height":10.0,"markers":[[1.0,1.0]]}'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Upgrade (if not upgraded)
|
### Upgrade
|
||||||
- `$ pip install --upgrade bellande_particle`
|
- `$ pip install --upgrade bellande_particle`
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -1,22 +1,57 @@
|
|||||||
curl -X 'POST' \
|
curl -X 'POST' \
|
||||||
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/bellande_particle' \
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/move' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"particle": [0, 0, 0, 1.0],
|
"particle": {
|
||||||
"movement": {
|
"x": 0,
|
||||||
"rotation1": 45.0,
|
"y": 0,
|
||||||
"translation": 1.0,
|
"heading": 0,
|
||||||
"rotation2": -45.0
|
"weight": 1.0
|
||||||
|
},
|
||||||
|
"rotation1": 45.0,
|
||||||
|
"translation": 1.0,
|
||||||
|
"rotation2": -45.0,
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
|
||||||
|
curl -X 'POST' \
|
||||||
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/read_markers' \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"particle": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"heading": 0,
|
||||||
|
"weight": 1.0
|
||||||
},
|
},
|
||||||
"world": {
|
"world": {
|
||||||
"width": 10.0,
|
"width": 10.0,
|
||||||
"height": 10.0,
|
"height": 10.0,
|
||||||
"markers": [[1.0, 1.0]]
|
"markers": [[1.0, 1.0]]
|
||||||
},
|
},
|
||||||
"count": 10,
|
|
||||||
"auth": {
|
"auth": {
|
||||||
"authorization_key": "bellande_web_api_opensource"
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
|
|
||||||
|
curl -X 'POST' \
|
||||||
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/create_random' \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"count": 10,
|
||||||
|
"world": {
|
||||||
|
"width": 10.0,
|
||||||
|
"height": 10.0,
|
||||||
|
"markers": [[1.0, 1.0]]
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
49
run_api.sh
49
run_api.sh
@ -1,22 +1,57 @@
|
|||||||
curl -X 'POST' \
|
curl -X 'POST' \
|
||||||
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/bellande_particle' \
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/move' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"particle": [0, 0, 0, 1.0],
|
"particle": {
|
||||||
"movement": {
|
"x": 0,
|
||||||
"rotation1": 45.0,
|
"y": 0,
|
||||||
"translation": 1.0,
|
"heading": 0,
|
||||||
"rotation2": -45.0
|
"weight": 1.0
|
||||||
|
},
|
||||||
|
"rotation1": 45.0,
|
||||||
|
"translation": 1.0,
|
||||||
|
"rotation2": -45.0,
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
|
||||||
|
curl -X 'POST' \
|
||||||
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/read_markers' \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"particle": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"heading": 0,
|
||||||
|
"weight": 1.0
|
||||||
},
|
},
|
||||||
"world": {
|
"world": {
|
||||||
"width": 10.0,
|
"width": 10.0,
|
||||||
"height": 10.0,
|
"height": 10.0,
|
||||||
"markers": [[1.0, 1.0]]
|
"markers": [[1.0, 1.0]]
|
||||||
},
|
},
|
||||||
"count": 10,
|
|
||||||
"auth": {
|
"auth": {
|
||||||
"authorization_key": "bellande_web_api_opensource"
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
|
|
||||||
|
curl -X 'POST' \
|
||||||
|
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Particle/create_random' \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"count": 10,
|
||||||
|
"world": {
|
||||||
|
"width": 10.0,
|
||||||
|
"height": 10.0,
|
||||||
|
"markers": [[1.0, 1.0]]
|
||||||
|
},
|
||||||
|
"auth": {
|
||||||
|
"authorization_key": "bellande_web_api_opensource"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
Loading…
Reference in New Issue
Block a user