Difference between revisions of "AquaShoko"

From Lofaro Lab Wiki
Jump to: navigation, search
(System Install)
Line 11: Line 11:
 
Download the AquaShoko-Gazebo project
 
Download the AquaShoko-Gazebo project
  
<source>
+
<source lang="bash">
 
$ git clone https://github.com/thedancomplex/AquaShoko-Gazebo
 
$ git clone https://github.com/thedancomplex/AquaShoko-Gazebo
 
</source>
 
</source>
Line 17: Line 17:
 
Switch to the feature/ach branch
 
Switch to the feature/ach branch
  
<source>
+
<source lang="bash">
 
# git checkout feature/ach
 
# git checkout feature/ach
 
</source>
 
</source>
Line 23: Line 23:
 
Build the project using CMake
 
Build the project using CMake
  
<source>
+
<source lang="bash">
 
$ cd AquaShoko-Gazebo
 
$ cd AquaShoko-Gazebo
 
$ mkdir build  
 
$ mkdir build  
Line 41: Line 41:
 
To activate the ROS functionality you must run the ROS controller:
 
To activate the ROS functionality you must run the ROS controller:
  
<code>
+
<source lang="bash">
 
# python roboControl.py
 
# python roboControl.py
</code>
+
</source>
  
 
==Topic==
 
==Topic==

Revision as of 04:31, 5 December 2017

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