Difference between revisions of "AquaShoko"

From Lofaro Lab Wiki
Jump to: navigation, search
(System Install)
(Videos)
 
(4 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
* Ach: [https://github.com/golems/ach] (remember to install the python bindings)
 
* Ach: [https://github.com/golems/ach] (remember to install the python bindings)
 
* ROS
 
* ROS
 +
* Gazebo 8: [http://gazebosim.org/]
  
 
==System Install==
 
==System Install==
 
Download the AquaShoko-Gazebo project
 
Download the AquaShoko-Gazebo project
  
<code>
+
<source lang="bash">
 
$ git clone https://github.com/thedancomplex/AquaShoko-Gazebo
 
$ git clone https://github.com/thedancomplex/AquaShoko-Gazebo
</code>
+
</source>
 +
 
 +
Switch to the feature/ach branch
 +
 
 +
<source lang="bash">
 +
# git checkout feature/ach
 +
</source>
  
 
Build the project using CMake
 
Build the project using CMake
  
<code>
+
<source lang="bash">
$ cd AquaShoko-Gazebo <br>
+
$ cd AquaShoko-Gazebo
$ mkdir build <br>
+
$ mkdir build  
$ cd build <br>
+
$ cd build  
$ cmake ../ <br>
+
$ cmake ../  
 
$ make
 
$ make
</code>
+
</source>
 +
 
 +
=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:
 +
 
 +
<source lang="bash">
 +
# python roboControl.py
 +
</source>
 +
 
 +
==Topic==
 +
* Topic: aquashoko_chatter
 +
* Type: JointState
 +
 
 +
==Example ROS Controller==
 +
Below is an example ROS controller in Python that sets all joints to 5 degrees.
 +
 
 +
<source lang="python">
 +
#!/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
 +
</source>
 +
 
 +
 
 +
=Videos=
 +
<html>
 +
<iframe width="560" height="315" src="https://www.youtube.com/embed/EUILEZ3xEvw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
 +
</html>
 +
 
 +
<html>
 +
<iframe width="560" height="315" src="https://www.youtube.com/embed/9-PPJArQ-WY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
 +
</html>

Latest revision as of 10:00, 12 April 2019

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


Videos