Robobuilder

From MMVLWiki
(Difference between revisions)
Jump to: navigation, search
m (Using the RBC controller)
m (Using the RBC controller)
 
(51 intermediate revisions by one user not shown)
Line 1: Line 1:
[[Image:Working.gif]]
+
{|align=right
 
+
|-
==Gallery==
+
|[[Image:Robobuilder-huno.jpg|thumb|240px|Assembled Robobuilder "Huno"]]
{|align=center
+
 
|-
 
|-
|[[Image:Robobuilder-kit.jpg|thumb|275px|The Robobuilder Kit contains components for assembling a humanoid robot]] || [[Image:Robobuilder-huno.jpg|thumb|160px|Assembled Robobuilder Huno]]
+
|<html>
 +
  <div class="thumb tright"><div style="width:320px;">
 +
    <object type="application/x-shockwave-flash" data="http://vision.eng.shu.ac.uk/jan/flv/flvplayer.swf" width="320" height="240">
 +
      <param name="flashvars"
 +
            value="file=http://vision.eng.shu.ac.uk/jan/flv/robobuilder1.flv&amp;image=http://vision.eng.shu.ac.uk/jan/flv/robobuilder1.jpg&amp;searchbar=false&amp;displayheight=240" />
 +
      <param name="movie" value="http://vision.eng.shu.ac.uk/jan/flv/flvplayer.swf" />
 +
      <param name="allowfullscreen" value="true" />
 +
    </object>
 +
    <div class="thumbcaption">One can control the Robobuilder from within an interactive Ruby session (also available as <a href="http://vision.eng.shu.ac.uk/jan/robobuilder1.avi">15.5 MByte DivX3 video</a> and available on <a href="http://www.youtube.com/watch?v=3w34KPsjQlc">Youtube</a>)</div>
 +
  </div></div>
 +
</html>
 +
|-
 +
|[[Image:Robobuilder-kit.jpg|thumb|320px|The Robobuilder Kit contains components for assembling a humanoid robot]]
 
|-
 
|-
 
|}
 
|}
 +
=Robobuilder=
 +
Currently all our Robobuilders are in disrepair (plastic gears of multiple servos are broken). We are trying to order [http://robosavvy.com/store/product_info.php/products_id/524 metal gear] replacements. According to [http://groups.csail.mit.edu/lbr/hrg/1995/mattw_ms_thesis.pdf Mark Williamson's thesis] (MIT) ideally one should replace the rigid servos with ''series elastic actuators'' to avoid the large shock loads which result from unexpected collisions which can cause the gear teeth to break. However it may be better to use a sliding clutch since introducing elasticity will limit the dynamics of the system.
 +
 +
'''Update:''' A temporary solution might be to lower the ''overload'' parameter of the wCK servos. Furthermore it is possible to specify an upper and lower limit for the joint angle.
 +
 +
[[Image:Working.gif]]
 +
==Capabilities==
 +
* main body
 +
** AVR microcontroller
 +
*** motion programs
 +
*** direct control
 +
** 16 servo controllers, serial bus
 +
*** self-running mode
 +
*** interpolation + closed-loop control
 +
** LiPo akku, DC power connector
 +
* sensors
 +
** 3-axis accelerometer (add-on)
 +
** ultrasound distance sensor
 +
* communication
 +
** RS232 interface
 +
** Bluetooth interface (add-on)
  
 
=Ruby Examples=
 
=Ruby Examples=
 
==Using the RBC controller==
 
==Using the RBC controller==
You need to make sure that your serial controller is capable of 115200 Baud!!!
+
You can get the Ruby-extension for controlling the Robobuilder with a GNU+Linux PC here:
 +
 
 +
'''[https://github.com/wedesoft/robobuilder github.com/wedesoft/robobuilder]'''
 +
 
 +
Here is a small example program which makes the robot get up if it's lying on its back or its front.
 
<pre>
 
<pre>
 
#!/usr/bin/env ruby
 
#!/usr/bin/env ruby
# http://robosavvy.com/forum/viewtopic.php?p=19030
+
require 'robobuilder'
# http://robosavvy.org/forum/viewtopic.php?p=20035
+
require 'matrix'
# http://robosavvy.com/RoboSavvyPages/Robobuilder/RBC_over_Serial_Protocol_v1.13.pdf
+
class Vector
Kernel::require 'serialport'
+
   def norm
class Array
+
     Math.sqrt inner_product( self )
   def checksum
+
     inject( 0 ) { |a,b| a ^ b }
+
 
   end
 
   end
 
end
 
end
class Robot
+
robot = Robobuilder.new '/dev/ttyUSB0'
  RATE = 115200
+
puts "Robobuilder"
  BITS = 8
+
puts "Serial number: #{robot.serial_number}"
  STOP_BITS = 1
+
acceleration = Vector[ *robot.accelerometer ]
  PARITY = SerialPort::NONE
+
if acceleration.inner_product( Vector[ 0, 0, 1 ] ) >
  GETUP_A = 1
+
     acceleration.norm * 0.97
  GETUP_B = 2
+
   robot.basic
  TURN_LEFT = 3
+
   robot.a
  MOTION_FORWARD = 4
+
elsif acceleration.inner_product( Vector[ 0, 0, 1 ] ) <
  TURN_RIGHT = 5
+
     -acceleration.norm * 0.97
  MOVE_LEFT = 6
+
   robot.basic
  MOTION_BASIC_POSTURE = 7
+
   robot.b
  MOVE_RIGHT = 8
+
  ATTACK_LEFT = 9
+
  MOVE_BACKWARD = 10
+
  ATTACK_RIGHT = 11
+
  def initialize( serial_device = '/dev/ttyUSB0' )
+
    puts "Opening port #{serial_device}"
+
    @serial = SerialPort.new serial_device, RATE, BITS, STOP_BITS, PARITY
+
    # @serial.flow_control = SerialPort::SOFT
+
    # @serial.read_timeout = 1 # milliseconds
+
    # @serial.write_timeout = 2000 # milliseconds
+
  end
+
  def header
+
    [ 0xFF, 0xFF, 0xAA, 0x55, 0xAA, 0x55, 0x37, 0xBA ].pack 'C' * 8
+
  end
+
  def synchronise
+
    x = nil
+
    begin
+
      x = @serial.read( 1 ).unpack( 'C' ).first
+
      # puts "%X" % x
+
    end until x == 0x37
+
    x = nil
+
    begin
+
      x = @serial.read( 1 ).unpack( 'C' ).first
+
      # puts "%X" % x
+
    end until x == 0xBA
+
  end
+
  def command( type, *contents )
+
    cmd = header + [ type, 0x00, contents.size ].pack( 'CCN' ) +
+
      contents.pack( 'C' * contents.size ) + [ contents.checksum ].pack( 'C' )
+
    @serial.write cmd
+
    # @serial.flush
+
    read_back( type )
+
  end
+
  def read_back( type )
+
    synchronise
+
    #if feedback[ 0 ... 8 ] != header
+
    #  puts 'Problem with header'
+
    #  raise "Error executing command 0x#{ "%X" % type }:\n" +
+
    #    "Send    : " + cmd.unpack( 'C' * cmd.size ).
+
     #    collect { |x| "%X" % x }.join( ' ' ) + "\n" +
+
    #    "Received: " + feedback.unpack( 'C' * feedback.size ).
+
    #    collect { |x| "%X" % x }.join( ' ' )
+
    # end
+
    if @serial.read( 1 ).unpack( 'C' ).first != type
+
      puts 'Problem with command feedback'
+
    end
+
    @serial.read( 1 )
+
    size = @serial.read( 4 ).unpack( 'N' ).first
+
    # puts "#{size} bytes of data"
+
    data = @serial.read size
+
    checksum = @serial.read( 1 ).unpack( 'C' ).first
+
    if data.unpack( 'C' * data.size ).checksum != checksum
+
      # puts 'Problem with checksum'
+
    end
+
    # sleep 0.2
+
    data
+
   end
+
  def motion( n )
+
    command( 0x14, n ).unpack( 'C' ).first
+
  end
+
  def a
+
    motion GETUP_A
+
  end
+
  def b
+
    motion GETUP_B
+
  end
+
  def turn_left
+
    motion TURN_LEFT
+
  end
+
  def forward
+
    motion MOTION_FORWARD
+
  end
+
  def turn_right
+
    motion TURN_RIGHT
+
  end
+
  def left
+
    motion MOVE_LEFT
+
  end
+
  def basic
+
    motion MOTION_BASIC_POSTURE
+
   end
+
  def right
+
    motion MOVE_RIGHT
+
  end
+
  def attack_left
+
    motion ATTACK_LEFT
+
  end
+
  def backward
+
    motion MOVE_BACKWARD
+
  end
+
  def attack_right
+
    motion ATTACK_RIGHT
+
  end
+
  def run( n )
+
    case n
+
    when 1 .. 10
+
      motion n + 11
+
    when 11 .. 20
+
      motion n + 22
+
    else
+
      raise "Program number must be in 1 .. 20 (was #{n})"
+
    end
+
  end
+
  def serial_number
+
    command( 0x0C, 1 ).to_i
+
  end
+
  def firmware
+
    command( 0x12, 1 ).unpack 'CC'
+
  end
+
  def voice( n )
+
     command( 0x15, n ).unpack( 'C' ).first
+
  end
+
  def distance # problem when lower than 20 cm
+
    command( 0x16, 1 ).unpack( 'n' ).first / 256.0
+
  end
+
  def sound( min )
+
    data = [ min ].pack( 'n' ).unpack 'CC'
+
    command( 0x17, *data ).unpack( 'S' ).first
+
   end
+
  def button
+
    command( 0x18, 1 ).unpack( 'S' ).first
+
   end
+
  def remote
+
    command( 0x19, 1 ).unpack( 'S' ).first
+
  end
+
  def accelerometer
+
    command( 0x1A, 1 ).unpack( 'sss' )
+
  end
+
  def direct( on )
+
    if on
+
      # Alternatively press and hold button PF2 and then turn on the RBC.
+
      command 0x10, 1
+
    else
+
      @serial.write [ 0xFF, 0xE0, 0xFB, 0x01, 0x00, 0x1A ].pack( 'C' * 6 )
+
      # @serial.flush
+
    end
+
  end
+
 
end
 
end
robot = Robot.new '/dev/ttyS1'
+
acceleration = Vector[ *robot.accelerometer ]
# robot.basic
+
if acceleration.inner_product( Vector[ 0, 1, 0 ] ) >
for i in 1 .. 1000
+
    acceleration.norm * 0.97
   puts "#{i}: #{ "%20s" % robot.accelerometer.inspect } #{ "%10d" % robot.distance}"
+
   robot.run 1
 
end
 
end
# robot.basic
+
robot.close
# robot.backward
+
# robot.direct true
+
# robot.direct false
+
 
</pre>
 
</pre>
 +
 +
=Todo=
 +
* Implement various commands of ''direct mode''
 +
* Implement commands for uploading motion sequences and action sequences
 +
* Add support for Bluetooth communication
 +
* Port wired and wireless serial communication to Windows
 +
* Computer vision feedback using (external) webcam
  
 
=External Links=
 
=External Links=
Line 187: Line 88:
 
* [http://www.robosavvy.com/ Robosavvy] (UK distributor)
 
* [http://www.robosavvy.com/ Robosavvy] (UK distributor)
 
** [http://robosavvy.com/store/product_info.php/products_id/445 Robobuilder 5710K Humanoid Kit]
 
** [http://robosavvy.com/store/product_info.php/products_id/445 Robobuilder 5710K Humanoid Kit]
** [http://robosavvy.com/store/product_info.php/products_id/517 Robobuilder Bluetooth Communication Module]
+
** [http://robosavvy.com/store/product_info.php/products_id/517 Robobuilder Bluetooth Communication Module] ([http://robosavvy.com/RoboSavvyPages/Robobuilder/Robobuilder_BluetoothInstallationInstructions.pdf installation instructions])
** [http://robosavvy.com/store/product_info.php/products_id/456 Robobuilder Triaxial Acceleration Sensor Module]
+
** [http://robosavvy.com/store/product_info.php/products_id/456 Robobuilder Triaxial Acceleration Sensor Module] ([http://robosavvy.com/RoboSavvyPages/Robobuilder/HowToEquip_AccelerationSensor.pdf installation instructions])
 +
** [http://robosavvy.com/store/product_info.php/products_id/524 Metal gear replacement (gears 1, 2, and 3)] [http://robosavvy.com/store/product_info.php/products_id/529 (gear 4)]
 +
** [http://robosavvy.com/store/product_info.php/products_id/609 Robobuilder Metal Joints Set]
 +
** [http://robosavvy.com/RoboSavvyPages/Robobuilder/robobuilder-creator-users-manual.pdf Robobuilder Creator users manual]
 +
** [http://robosavvy.com/RoboSavvyPages/Robobuilder/RBC_over_Serial_Protocol_v1.13.pdf Serial protocol to communicate with Robobuilder controller]
 +
** [http://robosavvy.com/Builders/limor/RoboBuilder_2nd_C_Source.zip Source code of Robobuilder controller]
 +
** [http://robosavvy.com/forum/viewtopic.php?t=4156 Forum post about this Ruby project]
 +
** [http://robosavvy.com/forum/viewtopic.php?p=19648#19648 RoboBuilder enhanced with RoBoard] (capable of running GNU/Linux)
 +
* [http://www.robodance.com/ Robodance] (free software to control toy robots)
 +
* [http://cafe.daum.net/robobuilder Robobuilder base dance video]
 +
* [http://www.youtube.com/watch?v=Fi7aD5AUu0s Video of Robobuilder at Roboworld 2008 (Seoul)]
 +
* [http://lasa.epfl.ch/ HOAP at the EPFL Laboratoire d'Algorithmes et Systemes d'Apprentissage]
 +
* [http://groups.csail.mit.edu/lbr/hrg/1995/mattw_ms_thesis.pdf Matt Williamson: Masters thesis on series elastic actuators]
 +
* [http://www.jo-zero.com/ JO-ZERO robot (infrared remote control)]
  
 
{{Addthis}}
 
{{Addthis}}

Latest revision as of 23:05, 16 July 2011

Assembled Robobuilder "Huno"
One can control the Robobuilder from within an interactive Ruby session (also available as 15.5 MByte DivX3 video and available on Youtube)
The Robobuilder Kit contains components for assembling a humanoid robot

Contents

[edit] Robobuilder

Currently all our Robobuilders are in disrepair (plastic gears of multiple servos are broken). We are trying to order metal gear replacements. According to Mark Williamson's thesis (MIT) ideally one should replace the rigid servos with series elastic actuators to avoid the large shock loads which result from unexpected collisions which can cause the gear teeth to break. However it may be better to use a sliding clutch since introducing elasticity will limit the dynamics of the system.

Update: A temporary solution might be to lower the overload parameter of the wCK servos. Furthermore it is possible to specify an upper and lower limit for the joint angle.

Working.gif

[edit] Capabilities

  • main body
    • AVR microcontroller
      • motion programs
      • direct control
    • 16 servo controllers, serial bus
      • self-running mode
      • interpolation + closed-loop control
    • LiPo akku, DC power connector
  • sensors
    • 3-axis accelerometer (add-on)
    • ultrasound distance sensor
  • communication
    • RS232 interface
    • Bluetooth interface (add-on)

[edit] Ruby Examples

[edit] Using the RBC controller

You can get the Ruby-extension for controlling the Robobuilder with a GNU+Linux PC here:

github.com/wedesoft/robobuilder

Here is a small example program which makes the robot get up if it's lying on its back or its front.

#!/usr/bin/env ruby
require 'robobuilder'
require 'matrix'
class Vector
  def norm
    Math.sqrt inner_product( self )
  end
end
robot = Robobuilder.new '/dev/ttyUSB0'
puts "Robobuilder"
puts "Serial number: #{robot.serial_number}"
acceleration = Vector[ *robot.accelerometer ]
if acceleration.inner_product( Vector[ 0, 0, 1 ] ) >
    acceleration.norm * 0.97
  robot.basic
  robot.a
elsif acceleration.inner_product( Vector[ 0, 0, 1 ] ) <
    -acceleration.norm * 0.97
  robot.basic
  robot.b
end
acceleration = Vector[ *robot.accelerometer ]
if acceleration.inner_product( Vector[ 0, 1, 0 ] ) >
    acceleration.norm * 0.97
  robot.run 1
end
robot.close

[edit] Todo

  • Implement various commands of direct mode
  • Implement commands for uploading motion sequences and action sequences
  • Add support for Bluetooth communication
  • Port wired and wireless serial communication to Windows
  • Computer vision feedback using (external) webcam

[edit] External Links

Bookmark and Share

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox