Bioloid Control

Configuration

This section explains how the main program and robot models can be configured.

General Configuration

The main program reads the configuration settings from a xml file, see global.cpp. During operation most of the parameters below can be changed via console commands.

Example Configuration File:

<?xml version="1.0" ?> <Configuration> <General> <SaveOnExit>false</SaveOnExit> </General> <Hardware> <WriteToRobot>true</WriteToRobot> <Ax12> <CWMargin id="1 2 3 4 5 6 7 8 9 10" >1</CWMargin> <CCWMargin id="1 2 3 4 5 6 7 8 9 10" >1</CCWMargin> <CWSlope id="1 2 3 4 5 6 7 8 9 10" >32</CWSlope> <CCWSlope id="1 2 3 4 5 6 7 8 9 10" >32</CCWSlope> <Punch id="1 2 3 4 5 6 7 8 9 10" >32</Punch> <Status id="1 2 3 4 5 6 7 8 9 10" >4</Status> <Speed id="1 2 3 4 5 6 7 8 9 10" >100</Speed> <Torque id="1 2 3 4 5 6 7 8 9 10" >1023</Torque> </Ax12> <AxS1> </AxS1> <ControlTorque>true</ControlTorque> <ControlSpeed>false</ControlSpeed> <Controller> <Torque id="1 2 3 4 5" time="1" p="10" i="0.5" d="0" offset="100" /> <Speed id="1 2 3 4 5" time="1" p="10" i="0.3" d="0" offset="30" /> </Controller> </Hardware> <Software> <ComPort>/dev/ttyUSB0</ComPort> <ComSpeed>115200</ComSpeed> <ComEnabled>true</ComEnabled> <TcpEnabled>false</TcpEnabled> <TcpPortIn>22615</TcpPortIn> <TcpPortOut>22614</TcpPortOut> <TcpHostname>localhost</TcpHostname> <UseCM5>true</UseCM5> <StopOnCollisionRead>true</StopOnCollisionRead> <StopOnCollisionWrite>true</StopOnCollisionWrite> <AddMotionsWithCollision>false</addMotionsWithCollision> <Debug>true</Debug> <RobotConfigFile>dh_hexapod.xml</RobotConfigFile> <RobotIsPresent>true</RobotIsPresent> <WriteToRobot>false</WriteToRobot> <ReadFromRobot>true</ReadFromRobot> </Software> </Configuration>

Explanation

Robot Configuration

In order to use the program with a custom-built robot you have to create a geometric model, a kinematic model and add inverse kinematics. The geometric and kinematic model are configured in a xml-file (see dh_humanoid.xml or dh_carausiusmorosus.xml for a complete example).

Example Robot Configuration File:

<?xml version="1.0" ?> <Robot> <Name>OWNROBOT</Name> <Frames> <Frame name="l1base" base="" a="0" b="180" g="180" x="0" y="0" z="0" /> </Frames> <KinematicChains len="1"> <Chain name= "l1" base="l1base" len="3"> <Dh rotz="0" transz="0" rotx="90" transx="25" id="10" sgn="1" /> <Dh rotz="0" transz="0" rotx="0" transx="90" id="12" sgn="1" /> <Dh rotz="0" transz="0" rotx="0" transx="90" id="6" sgn="1" /> </Chain> </KinematicChains> <Geometry> <Box name="1" width="40" depth="50" height="40" x="0" y="25" z="10" mass="0"> <Frame base="l1:1" a="0" b="0" g="0" x="0" y="0" z="0" /> <Color r="0.1" g="0.1" b="0.1" /> </Box> <Box name="2" width="40" depth="50" height="40" x="0" y="25" z="10" mass="0"> <Frame base="l1:3" a="0" b="0" g="0" x="0" y="0" z="0" /> <Color r="0.1" g="0.1" b="0.1" /> </Box> </Geometry> <Collisions> <Collision first="1" second="2" /> </Collisions> </Robot>

Explanation

Inverse Kinematics

First, you have to add your robot to the robotlist. Edit the file main/include/robot.h and add the name of your robot (see explanation) to the ROBOT_TYPES enum. Next edit the file main/src/robot.cpp and add the name of your robot to the robotNames vector (at the correct position). Second, the implementation of the inverse kinematics has to be placed in main/src/robot.cpp in CRobot::calcInverseKinematics().