Commit 783741a2 authored by Guillermo Amorin's avatar Guillermo Amorin
Browse files

odometria

parent 7c74966b
......@@ -64,6 +64,19 @@ do
omni.max_speed = normalize(max)
end
local function odom_publicator(x,y,phi,x_dot,y_dot,phi_dot)
uart.write(uart.CONSOLE, "odometry (x,y,phi): " .. tostring(x) .. " " .. tostring(y) .. " " .. tostring(phi) .. " " .. tostring(x_dot) .. " " .. tostring(y_dot) .. " " .. tostring(phi_dot) .. "\n\r" )
end
--- The callback module for the odometry.
-- @tparam callback function name
-- @tparam integer factor that is multiplied by 0.05s to determine the odometer check period. Must be greater than 1.
-- @tparam float X_0
-- @tparam float Y_0
-- @tparam float Phi_0
device.set_odometry_callback(odom_publicator,10,0,0,0)
local cont_enables = 0
--- The native C firmware module.
......
......@@ -16,18 +16,19 @@ robot.omni.enable(true)
while true do
local data = uart.read(uart.CONSOLE, "*l", 500)
if(data ~= nil) then
print(data)
data = split(data, '*')
if data[1] == VEL_CMD then
if #data == 5 then
local xdot = data[2]
print(xdot)
local ydot = data[3]
print(ydot)
local w = data[4]
print(w)
robot.omni.drive(xdot,ydot,w)
end
end
print('LEIDO: ', data)
data = split(data, '*')
if data[1] == VEL_CMD then
if #data == 5 then
local xdot = data[2]
local ydot = data[3]
local w = data[4]
robot.omni.drive(xdot,ydot,w)
end
end
end
end
--robot.omni.drive(0.1,0,0)
--speed*0*0*0*0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment