AquaShoko

From Lofaro Lab Wiki
Jump to: navigation, search

About

This tutorial shows you how to install and run AquaShoko in Gazebo via Ach and Ros

Install

Prerequisites

  • Ach: [1] (remember to install the python bindings)
  • ROS
  • Gazebo 8: [2]

System Install

Download the AquaShoko-Gazebo project

$ git clone https://github.com/thedancomplex/AquaShoko-Gazebo

Switch to the feature/ach branch

# git checkout feature/ach

Build the project using CMake

$ cd AquaShoko-Gazebo
$ mkdir build 
$ cd build 
$ cmake ../ 
$ make

Run

  • Open Gazebo
  • Add the AquaShoko-Gazebo folder to your path via the "insert" tab
  • Insert the model ComplexAquaShokoLongLeg

Control Via ROS

In ROS AquaShoko uses the JointState message type to receive commands. The positions are set via modifying the "position" variable for each joint.

To activate the ROS functionality you must run the ROS controller:

# python roboControl.py

Topic

  • Topic: aquashoko_chatter
  • Type: JointState

Example ROS Controller

Below is an example ROS controller in Python that sets all joints to 5 degrees.

#!/usr/bin/env python
import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import Header
def talker():
 
    val = 5
 
    pub = rospy.Publisher('aquashoko_chatter', JointState, queue_size=10)
    rospy.init_node('aquashoko_talker')
    rate = rospy.Rate(10) # 10hz
    hello_str = JointState()
    hello_str.header = Header()
    hello_str.header.stamp = rospy.Time.now()
    hello_str.name = ['joint00', 'joint01', 'joint02', 'joint10', 'joint11', 'joint12', 'joint20', 'joint21', 'joint22', 'joint30', 'joint31','joint32']
    hello_str.position = [val, val, val, val, val, val, val, val, val, val, val, val]
    hello_str.velocity = []
    hello_str.effort = []
    pub.publish(hello_str)
 
    i = 0
    while not rospy.is_shutdown():
      hello_str.header.stamp = rospy.Time.now()
      pub.publish(hello_str)
      rate.sleep()
      print i
      i = i+1
 
if __name__ == '__main__':
    try:
        talker()
    except rospy.ROSInterruptException:
        pass