serial command interface def api_setup_start write(128) end # Enables user control of Roomba, puts SCI in safe mode def api_setup_control write(130) end # Starts a normal cleaning cycle. def api_clean write(135) end Friday, April 27, 2012
is in mm/s (-500 to 500) def move(distance, degree=0, velocity=200) distance = distance.to_i.abs #distance can never be negative if distance == 0 #not moving, just spinning on axis # time = wheelbase * PI / 360degrees * degrees / velocity ABS time_in_seconds = calculate_spin_time(velocity, degree) else time_in_seconds = (distance.to_f / velocity.to_f).abs end Friday, April 27, 2012
velocity is in mm/s (-500 to 500) def move(distance, degree=0, velocity=200) distance = distance.to_i.abs #distance can never be negative if distance == 0 #not moving, just spinning on axis # time = wheelbase * PI / 360degrees * degrees / velocity ABS # wheelbase might be different for different roombas time_in_seconds = calculate_spin_time(velocity, degree) # now that we know how long to spin, set degree to 1 so it will spin roomba instead of put it on an arc degree = 1 else time_in_seconds = (distance.to_f / velocity.to_f).abs end set_velocity(velocity) set_degree(degree) Friday, April 27, 2012
to 169.254.1.1. Escape character is '^]'. *HELLO* $$$ CMD set comm close 0 AOK <2.23>set comm open 0 <2.23>set sys printlvl 0 <2.23> save Storing in config <2.23> reboot Friday, April 27, 2012
Socket to listen on roomba = Roomba.new(location) Thread.abort_on_exception = true loop do puts "Roomba Socket Server Running! (15 second timeout)" Thread.start(server.accept) do |client| # => Read the incoming TCP Socket request # => Pass the command to the roomba client.close # Disconnect from the client end end Pseudocode Hurdle 2 & 3 Friday, April 27, 2012
devices per capita. That year, there will be over 10 billion mobile- connected devices, including machine-to-machine (M2M) modules.” Friday, April 27, 2012