Skip to content
This repository was archived by the owner on Feb 21, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
JdeRobotKids:
Kibotics:
Robot: pibot #pibot, mbot or gazebo

Real:
Port: /dev/ttyUSB0
Camera: PiCam
Dist_ruedas: 1
Radio_ruedas: 1

Sim:
Motors:
Expand Down
28 changes: 28 additions & 0 deletions src/drivers/PiBot/PiBot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from jderobot_config import config


def dameRobot():
cfg_file = "Kibotics.yml"
cfg = config.load(cfg_file)
bot = cfg.getProperty('Kibotics.Robot')
bot = bot.lower()

if bot == "pibot":
# Import real Pibot wrapper
from real import PiBot as pireal

robot = pireal(cfg)

if bot == "mbot":
#port = cfg.getProperty('Kibotics.Real.Port')
#robot = MBot()
None

elif bot == "gazebo":
# Import simulated Pibot wrapper
from gazebo import PiBot as pisim

robot = pisim(cfg)

return robot

28 changes: 0 additions & 28 deletions src/drivers/PiBot/PiBotHAL.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/drivers/PiBot/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .PiBotHAL import dameRobot
from .PiBot import dameRobot
25 changes: 16 additions & 9 deletions src/drivers/PiBot/gazebo/piBot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from JdeRobotKids import JdeRobotKids
from jderobot_interfaces import Kibotics
import numpy
import threading
import sys
Expand All @@ -21,23 +21,24 @@
ORANGE_MAX = numpy.array([179, 255, 255],numpy.uint8)#numpy.array([67, 177, 192],numpy.uint8)


class PiBot:
class PiBot(Kibotics):

'''
Controlador para el Robot PiBot de JdeRobot-Kids
'''
def __init__(self, cfg):

print("En constructor")
cfg = config.load(cfg)
Kibotics.__init__(self)
#cfg = config.load(cfg)

#starting comm
jdrc= comm.init(cfg, 'JdeRobotKids.Sim')
self.camera = jdrc.getCameraClient("JdeRobotKids.Sim.Camera")
self.motors = jdrc.getMotorsClient("JdeRobotKids.Sim.Motors")
self.irLeft = jdrc.getIRClient("JdeRobotKids.Sim.IRLeft")
self.irRight = jdrc.getIRClient("JdeRobotKids.Sim.IRRight")
self.us = jdrc.getSonarClient("JdeRobotKids.Sim.Sonar")
jdrc= comm.init(cfg, 'Kibotics.Sim')
self.camera = jdrc.getCameraClient("Kibotics.Sim.Camera")
self.motors = jdrc.getMotorsClient("Kibotics.Sim.Motors")
self.irLeft = jdrc.getIRClient("Kibotics.Sim.IRLeft")
self.irRight = jdrc.getIRClient("Kibotics.Sim.IRRight")
self.us = jdrc.getSonarClient("Kibotics.Sim.Sonar")


def moverServo(self, *args):
Expand Down Expand Up @@ -188,6 +189,12 @@ def dameObjeto(self, lower=ORANGE_MIN, upper=ORANGE_MAX, showImageFiltered=False

return center, area

def mostrarImagen(self):
None

def dameSonarVisual(self):
None

def quienSoy(self):
print ("Yo soy un robot simulado PiBot")

Expand Down
Loading