Pioneer Robot Learning Notes _1-5 Aria Programming Basics __ Robot

Source: Internet
Author: User
Tags gety int size radar

The ARIA function Development manual can be found in the following path: C or D:\Program files\mobilerobots\aria\aria-reference.html
C or D:\Program files\mobilerobots\aria\arnetworking\arnetworkingreference.html
C or D:\Program files\mobilerobots\arnl\docs\ basearnl-reference.html &

Arnl-reference.html & sonarnl-reference.html


Aria is an object-oriented, object-oriented, application-interface system developed for MobileRobots. The system is based on C + + language and is a simple and convenient motion control and transmission for pioneer series robot.
Sensor operation of the client software. The software has the powerful function and the adaptability, is the ideal choice which the robot high-end software compiles, including Mobilesim, the Vanguard Robot basic software system is based on the aria.


Arrobot-the most basic, and most important, Aria class library.


Enablemotors ()//Start motor disablemotors ()//Disable motor
Disconnect ()//Disconnect
Lock (); unlock ()//Lock robot instance, unlock, usually used to protect the command sent to the robot
Findangleto (const arpose pose); The absolute angle of the robot's current position to the specified position
Finddeltaheadingto (const arpose pose);//Relative angle
Finddistanceto (const arpose pose); Distance
Move (1500); Forward 1.5 meters
Setdeltaheading (90); 90 degrees left, turn right to negative.
Setheading (90)//rotation absolute angle, initial orientation to 0 degrees
Setrotvel (double velocity)/rotational speed
Setvel (50); Getvel (); Set/Get Robot speed
SetVel2 (50,100); Set the left and right wheel speed separately
Getleftvel (); Getrightvel ()//Get two rounds of speed
Getsonarreading (i)//get sonar readings, I for sonar number, counterclockwise
Getpose (); Get the robot's current position
GETTH (); GetX (); GetY (); Detailed information, x,y, th
Checkrangedevicescurrentpolar (10,20)//Check all sensor readings, get 10-20 degree readings, return to a recent distance
MoveTo (Arpose pose,); Moving the robot position to pose is not really moving, it's a coordinate change.
Run (true); Start the robot thread in a single threaded manner
Runasync (TRUE); Start the robot thread, in multithreading, the argument is true, if the robot connection is lost, the thread terminates, false waits for the Stop Command Stop (void) to terminate the thread to determine the state of some of the functions of the robot
IsConnected (void);//whether to connect
Ismovedone ()//whether to complete the move
Isheadingdone ()//whether to complete the rotation

IsRunning ()//is running


Arpose-A class related to robot position


Setpose (double x, double y, double th = 0); Setpose (arpose
Position)//Set the position of the robot
SetX (m); Sety (m); Setth (); Setthrad (1.33);//Set specific action, last
The same action to get position information for setting radians
Getpose ()//Get the position of the robot
GetX (); GetY (); Getth (); Getthrad ()//Get specific information, last return value is radians
Findangleto (arpose position);//To the angle of the specified position
Finddistanceto (arpose position);//Distance
Arsensorreading-Gets a class of sensor data that must be an instance of a sensor object.
GetRange (void);//Get the distance from the obstacle to the robot
IsNew ()//current readings are not updated
Getpose (void);//Get position information of sensor readings (e.g. sonar return position)
Getlocalpose (void);//position in local coordinate system
Getposetaken (void);//Get the position of the robot when reading occurs
Getsensorposition (void);//Get the position information of the sensor on the robot
Getcountertaken (void);/Current is the first few readings
Arrangedevice-Controls all sensors of a class, Sonar class Arsonardevice, LiDAR class
Arsick are derived from this class.
GetName (void);//Get sensor name
Setrobot (Arrobot *robot)//Set sensor connected robot Getrobot (void)
Setcurrentbuffersize (size_t size); Setcumulativebuffersize (size_t size);//Set Buffer
Addreading (double x, double y);//Add a Reading
Currentreadingpolar (double startangle, double endangle);//Get the minimum reading value in the current angle
Currentreadingbox (double x1, double y1, double x2, double y2);//Get the minimum reading value for the current given area
Getcurrentrangebuffer (void);//get buffer for current reading
Clearcurrentreadings (void);/clear All current readings
Getrawreadings (void)//To obtain data from an unhandled sensor
Setmaxrange (unsigned int maxrange); Getmaxrange (void)//setting, obtaining the maximum measurement range of the sensor
Lockdevice (); Unlockdevice ()//Lock device, unlock
setmaxsecondstokeepcurrent (int maxsecondstokeepcurrent);

Getmaxsecondstokeepcurrent ()//Get/Set the time to save the readings


Arsick


Configure (False,true,false,arsick::baud38400,arsick::D egrees180,arsick::increment_half)//Set laser radar parameters, baud rate, scanning angle, Scan interval
Setdeviceconnection (&con);/Set Connection
Runasync ()//Start thread
Blockingconnect ()//Connection Laser Radar
Setsensorposition (Arpose pose)//Set the position of the laser radar on the robot
Getsensorposition ()//Get location

Isusingsim (void)//Whether the simulator is applied


Some other classes for connecting


Arsimpleconnector used to connect to a robot class
Setuprobot (Arrobot *robot); Connectrobot (Arrobot *robot);//Connect with robot
Setuplaser (Arsick *sick); Sick.runasync (); Sick.blockingconnect ();//must run the back two to connect
Connectsecondlaser (Arsick *sick)/with laser connection

Ardeviceconnection A basic connection class that can be connected to robots and simulators, and can also be used to connect LiDAR and other devices.


The following two classes are ardeviceconnection derived classes


Arserialconnection connect the device via serial port
Artcpconnection via TCP/IP connection
Open ();//Turn on connection
Close ();//Turn off connection
Setport ()//Set port
Getport ();//Get Port
Read (const char *data, unsigned int size, unsigned int mswait = 0);
Write (const char *data, unsigned int size);/read/write Data

Opensimple (void);//Connect and judge


Araction-This is a relatively advanced class that encapsulates some of the behavior of the robot, such as a wall barrier, a move, and so on, and we can derive from this class if we want to implement our own operations.


Class Aractionavoidfront//front wall barrier behavior
Class Aractionavoidside//Side wall barrier behavior classes
Class Aractiongoto//Mobile robot to the destination behavior category
Class Aractioncolorfollow//Tracking color behavior
Class Aractionbumpers//handling Collision switch behavior
Class Aractionconstantvelocity//Go straight at a constant rate of behavior


Routines:

#include "Aria.h"
int main (int argc,char **argv)//move 0.5m
{
aria::init ();//Initialize
Arrobot robot;
Arsimpleconnector connector (&ARGC,ARGV);
if (!connector.parseargs () | | argc>1)
{
connector.logoptions ();
Exit (1);
}
if (!connector.connectrobot (&robot))
{
printf ("Cound not connect to robot...exiting\n");
Aria::shutdown ();
return 1;
}
Robot.comint (arcommands::enable,1);
Robot.comint (arcommands::soundtog,0);
Robot.runasync (TRUE); Start robot thread
Robot.move (500),//robot move forward
500mm
do {}while (!robot.ismovedone ()),//Check whether the robot action is complete, Otherwise the loop waits for
Robot.lock ();
Robot.disconnect (); Disconnect the connection
robot.unlock ();
Aria::shutdown (); Exit return
0;


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.