Documentation SDK du châssis de navigation 3D Tbot
Basé sur rosbridge WebSocket — aucun environnement ROS requis, contrôle de châssis multilingue. Ce document liste chaque champ de requête/réponse Topic / Service (type + description).
ws://192.168.1.151:9090Enveloppe de réponse courante : Après chaque appel de Service, rosbridge répond avec service_response. Le JSON dans « Response » ci-dessous est le contenu des valeurs.
Ressources développeur
1. Aperçu du protocole
| Direction | Nombre | Nom |
|---|---|---|
| S'abonner aux Topics (châssis → app) | 5 | /fast_lio_localization、/aft_pgo_path、/map_list_kitty、/ebot_goal_status_local_planner、/ebot_work_state |
| Appeler les services (app → châssis) | 9 | /start_mapping_kitty、/save_map_kitty、/select_map_and_start_kitty、/delete_map_kitty、/docking_kitty、/navigate_to_pose(navigate + cancel)、/add_goal_kitty、/delete_goal_kitty |
2. Abonnement aux Topics (châssis → app)
Abonnement. Le message reçu est dans le champ msg.
3. Résumé des services
| Service | Type de service | Champs principaux |
|---|---|---|
| /start_mapping_kitty | std_srvs/Trigger | requête vide → succès,message |
| /save_map_kitty | kitty_runtime_manager/SaveMap | filepath → success,message |
| /select_map_and_start_kitty | kitty_runtime_manager/SaveMap | filepath → success,message |
| /delete_map_kitty | kitty_runtime_manager/DeleteMap | map_name → success,message |
| /docking_kitty | std_srvs/Trigger | requête vide → succès,message |
| /navigate_to_pose | nav_msgs/GetPlan | goal.pose.position.x/y/z → plan.poses[] |
| /add_goal_kitty | kitty_runtime_manager/AddGoal | map_name,goal_name,x,y,theta → success,message |
| /delete_goal_kitty | kitty_runtime_manager/DeleteGoal | map_name,goal_name → success,message |
2.1 Pose du robot nav_msgs/Odometry
Le châssis pousse périodiquement la pose courante.
{
"pose": { "pose": {
"position": {"x": 1.23, "y": 4.56, "z": 0.0},
"orientation": {"x": 0, "y": 0, "z": 0.5, "w": 0.866}
}}
}| Champ | Type | Description |
|---|---|---|
| pose.pose.position.x | float64 | Position x du robot (m) |
| pose.pose.position.y | float64 | Position y du robot (m) |
| pose.pose.position.z | float64 | Position z du robot (m, châssis fixé à 0) |
| pose.pose.orientation.x/y/z/w | float64 | Orientation quaternion ; le frontend calcule le lacet = atan2(2*(w*z+x*y), 1-2*(z*z+y*y)) |
2.2 Chemin global nav_msgs/Path
Envoyé ~5 s après le début de la navigation, 5 fois au total (~30 s).
{ "poses": [
{"pose":{"position":{"x":0,"y":0,"z":0}}},
{"pose":{"position":{"x":1,"y":2,"z":0}}}
]}| Champ | Type | Description |
|---|---|---|
| poses | array[PoseStamped] | Tableau de poses de chemin planifié |
| poses[].pose.position.x | float64 | Point de chemin x (m) |
| poses[].pose.position.y | float64 | Point de chemin y (m) |
| poses[].pose.position.z | float64 | Point de chemin z (toujours 0) |
2.3 Liste des cartes kitty_runtime_manager/MapList
Renvoie toutes les cartes et leurs points de passage enregistrés après abonnement.
{ "maps": [
{"map_name":"Lobby","map_path":"/maps/floor1",
"goals":[
{"name":"Reception","x":1.0,"y":2.0,"theta":0.5},
{"name":"Elevator","x":3.0,"y":4.0,"theta":1.2}
]}
]}| Champ | Type | Description |
|---|---|---|
| maps | array[Map] | Tableau de cartes |
| maps[].map_name | string | Nom d'affichage de la carte |
| maps[].map_path | string | Chemin du fichier de carte (interne) |
| maps[].goals | array[Goal] | Points de passage enregistrés sous cette carte |
| maps[].goals[].name | string | Nom du point de passage |
| maps[].goals[].x | float64 | Position x du point de passage (m) |
| maps[].goals[].y | float64 | Position y du point de passage (m) |
| maps[].goals[].theta | float64 | Cap du point de passage (rad) |
2.4 État de navigation std_msgs/Float64MultiArray
Topic : /ebot_goal_status_local_planner.
{"data": [1]}| Champ | Type | Description |
|---|---|---|
| data[0] | float64 | 1 = arrivé au but ; 0 = pas arrivé. En mode docking, 1 n'est envoyé que lors de la charge effective |
2.5 Batterie et charge std_msgs/Float64MultiArray
Topic : /ebot_work_state.
{"data": [2, 75.5]}| Champ | Type | Description |
|---|---|---|
| data[0] | float64 | Charge : 1=en charge 2=pas en charge |
| data[1] | float64 | Pourcentage de batterie (0-100) |
3.1 Démarrer la cartographie std_srvs/Trigger
Service :/start_mapping_kitty
{}(requête vide){ "success": true, "message": "Mapping started" }| Champ | Type | Direction | Description |
|---|---|---|---|
| success | bool | Réponse | Si l'opération a réussi |
| message | string | Réponse | Message de résultat (raison de l'erreur en cas d'échec) |
3.2 Enregistrer la carte kitty_runtime_manager/SaveMap
Service :/save_map_kitty
{ "filepath": "map_name" }{ "success": true, "message": "Map saved" }| Champ | Type | Direction | Description |
|---|---|---|---|
| filepath | string | Requête | map_name (sans chemin) |
| success | bool | Réponse | Si l'opération a réussi |
| message | string | Réponse | Message de résultat |
3.3 Sélectionner la carte et démarrer la navigation kitty_runtime_manager/SaveMap
Service :/select_map_and_start_kitty
{ "filepath": "map_name" }{ "success": true, "message": "Map selected and navigation started" }| Champ | Type | Direction | Description |
|---|---|---|---|
| filepath | string | Requête | map_name (sans chemin) |
| success | bool | Réponse | Si l'opération a réussi |
| message | string | Réponse | Message de résultat |
3.4 Supprimer la carte kitty_runtime_manager/DeleteMap
Service :/delete_map_kitty
{ "map_name": "map_name" }{ "success": true, "message": "Deleted successfully" }| Champ | Type | Direction | Description |
|---|---|---|---|
| map_name | string | Requête | map_name à supprimer |
| success | bool | Réponse | Si l'opération a réussi |
| message | string | Réponse | Message de résultat |
3.5 Docking std_srvs/Trigger
Service :/docking_kitty
{}{ "success": true, "message": "Docking started" }| Champ | Type | Direction | Description |
|---|---|---|---|
| success | bool | Réponse | Docking démarré (ne signifie pas encore la charge) |
| message | string | Réponse | Message de résultat |
3.6 Naviguer vers une pose nav_msgs/GetPlan
Service :/navigate_to_pose
{
"goal": { "pose": { "position": { "x": 1.0, "y": 2.0, "z": 0.0 } } }
}{ "plan": { "poses": [
{"pose":{"position":{"x":0,"y":0,"z":0}}},
{"pose":{"position":{"x":1,"y":2,"z":0}}}
]}}| Champ | Type | Direction | Description |
|---|---|---|---|
| goal.pose.position.x | float64 | Requête | Position x du point de passage (m) |
| goal.pose.position.y | float64 | Requête | Position y du point de passage (m) |
| goal.pose.position.z | float64 | Requête | Position z du point de passage (toujours 0) |
| plan.poses | array[PoseStamped] | Réponse | Tableau du chemin planifié (le frontend peut dessiner) |
3.7 Annuler la navigation nav_msgs/GetPlan
Service :/navigate_to_pose((même service que la navigation, utilisez des coordonnées spéciales pour annuler))
{
"goal": { "pose": { "position": { "x": 999999, "y": 888888, "z": 0 } } }
}{ "plan": { "poses": [] } }| Champ | Type | Direction | Description |
|---|---|---|---|
| goal.pose.position.x | float64 | Requête | Fixe 999999 (indicateur d'annulation) |
| goal.pose.position.y | float64 | Requête | Fixe 888888 (indicateur d'annulation) |
| goal.pose.position.z | float64 | Requête | Fixe 0 |
| plan.poses | array | Réponse | Chemin vide ou tronqué |
3.8 Ajouter un point de passage kitty_runtime_manager/AddGoal
Service :/add_goal_kitty
{
"map_name": "Lobby",
"goal_name": "Reception",
"x": 1.0, "y": 2.0, "theta": 0.5
}{ "success": true, "message": "Added successfully" }| Champ | Type | Direction | Description |
|---|---|---|---|
| map_name | string | Requête | map_name |
| goal_name | string | Requête | Nom du point de passage |
| x | float64 | Requête | Position x du point de passage (m) |
| y | float64 | Requête | Position y du point de passage (m) |
| theta | float64 | Requête | Angle de cap (rad) |
| success | bool | Réponse | Si l'opération a réussi |
| message | string | Réponse | Message de résultat |
3.9 Supprimer un point de passage kitty_runtime_manager/DeleteGoal
Service :/delete_goal_kitty
{ "map_name": "Lobby", "goal_name": "Reception" }{ "success": true, "message": "Deleted successfully" }| Champ | Type | Direction | Description |
|---|---|---|---|
| map_name | string | Requête | map_name |
| goal_name | string | Requête | Nom du point de passage |
| success | bool | Réponse | Si l'opération a réussi |
| message | string | Réponse | Message de résultat |
4. Exemples multilingues
Chaque langue affiche un exemple rapide par défaut. Cliquez sur « Voir le code complet » pour développer les 5 Topics + 9 Services.
4.1 Python(roslibpy)
Dépendances :pip install roslibpy
import roslibpy, time
client = roslibpy.Ros(host='192.168.1.151', port=9090)
client.run()
# Subscribe to battery state
roslibpy.Topic(client,'/ebot_work_state','std_msgs/Float64MultiArray').subscribe(
lambda m: print(f"Battery {m['data'][1]}% charging={m['data'][0]==1}"))
# Dock to charger
roslibpy.Service(client,'/docking_kitty','std_srvs/Trigger').call(roslibpy.ServiceRequest(),
callback=lambda r: print("Docking:", r['message']))
try:
while True: time.sleep(1)
except KeyboardInterrupt: client.terminate()
import roslibpy, time, math
client = roslibpy.Ros(host='192.168.1.151', port=9090)
client.run()
# ===== Subscribe to all 5 Topics =====
# 1) Localization
def on_odom(m):
p = m['pose']['pose']['position']; o = m['pose']['pose']['orientation']
yaw = math.atan2(2*(o['w']*o['z']+o['x']*o['y']), 1-2*(o['z']**2+o['y']**2))
print(f"[Pose] x={p['x']:.2f} y={p['y']:.2f} yaw={math.degrees(yaw):.1f}°")
roslibpy.Topic(client,'/fast_lio_localization','nav_msgs/Odometry').subscribe(on_odom)
# 2) Global path
roslibpy.Topic(client,'/aft_pgo_path','nav_msgs/Path').subscribe(
lambda m: print(f"[Path] {len(m['poses'])} points"))
# 3) Map list
roslibpy.Topic(client,'/map_list_kitty','kitty_runtime_manager/MapList').subscribe(
lambda m: [print(f"[Map] {mp['map_name']} goals:{[g['name'] for g in mp['goals']]}") for mp in m['maps']])
# 4) Navigation status
roslibpy.Topic(client,'/ebot_goal_status_local_planner','std_msgs/Float64MultiArray').subscribe(
lambda m: m['data'][0]==1 and print("✅ Arrived"))
# 5) Battery
roslibpy.Topic(client,'/ebot_work_state','std_msgs/Float64MultiArray').subscribe(
lambda m: print(f"[Battery] {m['data'][1]:.0f}% {'Charging' if m['data'][0]==1 else 'Not charging'}"))
# ===== Call all 9 Services =====
def call(svc, args, srv):
r = roslibpy.Service(client, svc, srv).call(roslibpy.ServiceRequest(args))
print(f"[SVC] {svc} → {dict(r)}")
time.sleep(1)
call('/start_mapping_kitty', {}, 'std_srvs/Trigger')
call('/save_map_kitty', {'filepath':'test_map'}, 'kitty_runtime_manager/SaveMap')
call('/select_map_and_start_kitty', {'filepath':'test_map'}, 'kitty_runtime_manager/SaveMap')
call('/navigate_to_pose', {'goal':{'pose':{'position':{'x':1.0,'y':2.0,'z':0.0}}}}, 'nav_msgs/GetPlan')
call('/navigate_to_pose', {'goal':{'pose':{'position':{'x':999999,'y':888888,'z':0}}}}, 'nav_msgs/GetPlan')
call('/add_goal_kitty', {'map_name':'test_map','goal_name':'Reception','x':1.0,'y':2.0,'theta':0.5}, 'kitty_runtime_manager/AddGoal')
call('/delete_goal_kitty', {'map_name':'test_map','goal_name':'Reception'}, 'kitty_runtime_manager/DeleteGoal')
call('/docking_kitty', {}, 'std_srvs/Trigger')
call('/delete_map_kitty', {'map_name':'test_map'}, 'kitty_runtime_manager/DeleteMap')
try:
while True: time.sleep(1)
except KeyboardInterrupt: client.terminate()
4.2 JavaScript / HTML
Aucune dépendance, collez dans
