本文整理汇总了C++中ArRobot::getOrigRobotConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ ArRobot::getOrigRobotConfig方法的具体用法?C++ ArRobot::getOrigRobotConfig怎么用?C++ ArRobot::getOrigRobotConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArRobot
的用法示例。
在下文中一共展示了ArRobot::getOrigRobotConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readParameters
/*
* To Read the parameter
*/
void RosAriaNode::readParameters()
{
// Robot Parameters
robot->lock();
ros::NodeHandle n_("~");
if (n_.hasParam("TicksMM"))
{
n_.getParam( "TicksMM", TicksMM);
ROS_INFO("Setting TicksMM from ROS Parameter: %d", TicksMM);
robot->comInt(93, TicksMM);
}
else
{
TicksMM = robot->getOrigRobotConfig()->getTicksMM();
n_.setParam( "TicksMM", TicksMM);
ROS_INFO("Setting TicksMM from robot EEPROM: %d", TicksMM);
}
if (n_.hasParam("DriftFactor"))
{
n_.getParam( "DriftFactor", DriftFactor);
ROS_INFO("Setting DriftFactor from ROS Parameter: %d", DriftFactor);
robot->comInt(89, DriftFactor);
}
else
{
DriftFactor = robot->getOrigRobotConfig()->getDriftFactor();
n_.setParam( "DriftFactor", DriftFactor);
ROS_INFO("Setting DriftFactor from robot EEPROM: %d", DriftFactor);
}
if (n_.hasParam("RevCount"))
{
n_.getParam( "RevCount", RevCount);
ROS_INFO("Setting RevCount from ROS Parameter: %d", RevCount);
robot->comInt(88, RevCount);
}
else
{
RevCount = robot->getOrigRobotConfig()->getRevCount();
n_.setParam( "RevCount", RevCount);
ROS_INFO("Setting RevCount from robot EEPROM: %d", RevCount);
}
robot->unlock();
}
示例2: main
//.........这里部分代码省略.........
modeWander.getActionGroup()->addAction(&actionLostWander, 110);
// This provides a small table of interesting information for the client
// to display to the operator. You can add your own callbacks to show any
// data you want.
ArServerInfoStrings stringInfo(&server);
Aria::getInfoGroup()->addAddStringCallback(stringInfo.getAddStringFunctor());
// Provide a set of informational data (turn on in MobileEyes with
// View->Custom Details)
Aria::getInfoGroup()->addStringInt(
"Motor Packet Count", 10,
new ArConstRetFunctorC<int, ArRobot>(&robot,
&ArRobot::getMotorPacCount));
Aria::getInfoGroup()->addStringDouble(
"Laser Localization Score", 8,
new ArRetFunctorC<double, ArLocalizationTask>(
&locTask, &ArLocalizationTask::getLocalizationScore),
"%.03f");
Aria::getInfoGroup()->addStringInt(
"Laser Loc Num Samples", 8,
new ArRetFunctorC<int, ArLocalizationTask>(
&locTask, &ArLocalizationTask::getCurrentNumSamples),
"%4d");
// Display gyro status if gyro is enabled and is being handled by the firmware (gyro types 2, 3, or 4).
// (If the firmware detects an error communicating with the gyro or IMU it
// returns a flag, and stops using it.)
// (This gyro type parameter, and fault flag, are only in ARCOS, not Seekur firmware)
if(robot.getOrigRobotConfig() && robot.getOrigRobotConfig()->getGyroType() > 1)
{
Aria::getInfoGroup()->addStringString(
"Gyro/IMU Status", 10,
new ArGlobalRetFunctor1<const char*, ArRobot*>(&getGyroStatusString, &robot)
);
}
// Setup the dock if there is a docking system on board.
ArServerModeDock *modeDock = NULL;
modeDock = ArServerModeDock::createDock(&server, &robot, &locTask,
&pathTask);
if (modeDock != NULL)
{
modeDock->checkDock();
modeDock->addAsDefaultMode();
modeDock->addToConfig(Aria::getConfig());
modeDock->addControlCommands(&commands);
}
// Make Stop mode the default (If current mode deactivates without entering
// a new mode, then Stop Mode will be selected)
modeStop.addAsDefaultMode();
// TODO move up near where stop mode is created?
/* Services that allow the client to initiate scanning with the laser to
示例3: main
//.........这里部分代码省略.........
// here to enable them if yours does.
/*
const char *errfmt = "%2.4f m";
Aria::getInfoGroup()->addStringDouble(
"GPS Lat. Err.", 6,
new ArConstRetFunctorC<double, ArGPS>(gps, &ArGPS::getLatitudeError),
errfmt
);
Aria::getInfoGroup()->addStringDouble(
"GPS Lon. Err.", 6,
new ArConstRetFunctorC<double, ArGPS>(gps, &ArGPS::getLongitudeError),
errfmt
);
Aria::getInfoGroup()->addStringDouble(
"GPS Alt. Err.", 6,
new ArConstRetFunctorC<double, ArGPS>(gps, &ArGPS::getAltitudeError),
errfmt
);
*/
Aria::getInfoGroup()->addStringDouble(
"MOGS Localization Score", 8,
new ArRetFunctorC<double, ArGPSLocalizationTask>(
&gpsLocTask, &ArGPSLocalizationTask::getLocalizationScore),
"%.03f"
);
#endif
// Display gyro status if gyro is enabled and is being handled by the firmware (gyro types 2, 3, or 4).
// (If the firmware detects an error communicating with the gyro or IMU it
// returns a flag, and stops using it.)
// (This gyro type parameter, and fault flag, are only in ARCOS, not Seekur firmware)
if(robot.getOrigRobotConfig() && robot.getOrigRobotConfig()->getGyroType() > 1)
{
Aria::getInfoGroup()->addStringString(
"Gyro/IMU Status", 10,
new ArGlobalRetFunctor1<const char*, ArRobot*>(&getGyroStatusString, &robot)
);
}
// Display system CPU and wireless network status
ArSystemStatus::startPeriodicUpdate(1000); // update every 1 second
Aria::getInfoGroup()->addStringDouble("CPU Use", 10, ArSystemStatus::getCPUPercentFunctor(), "% 4.0f%%");
Aria::getInfoGroup()->addStringInt("Wireless Link Quality", 9, ArSystemStatus::getWirelessLinkQualityFunctor(), "%d");
Aria::getInfoGroup()->addStringInt("Wireless Link Noise", 9, ArSystemStatus::getWirelessLinkNoiseFunctor(), "%d");
Aria::getInfoGroup()->addStringInt("Wireless Signal", 9, ArSystemStatus::getWirelessLinkSignalFunctor(), "%d");
// stats on how far its driven since software started
Aria::getInfoGroup()->addStringDouble("Distance Travelled (m)", 20, new ArRetFunctorC<double, ArRobot>(&robot, &ArRobot::getOdometerDistanceMeters), "%.2f");
Aria::getInfoGroup()->addStringDouble("Run time (min)", 20, new
ArRetFunctorC<double, ArRobot>(&robot, &ArRobot::getOdometerTimeMinutes),
"%.2f");
#ifdef ARNL_GPSLOC
// Add some "custom commands" for setting up initial GPS offset and heading.
gpsLocTask.addLocalizationInitCommands(&commands);
// Add some commands for manually creating map objects based on GPS positions:
// ArGPSMapTools gpsMapTools(gps, &robot, &commands, &map);
// Add command to set simulated GPS position manually
if(gpsConnector.getGPSType() == ArGPSConnector::Simulator)
{
示例4: main
//.........这里部分代码省略.........
Aria::setKeyHandler(&keyHandler);
// ArRobot contains an exit action for the Escape key. It also
// stores a pointer to the keyhandler so that other parts of the program can
// use the same keyhandler.
robot.attachKeyHandler(&keyHandler);
printf("You may press escape to exit\n");
// Attach sonarDev to the robot so it gets data from it.
robot.addRangeDevice(&sonarDev);
// Start the robot task loop running in a new background thread. The 'true' argument means if it loses
// connection the task loop stops and the thread exits.
robot.runAsync(true);
// Connect to the laser(s) if lasers were configured in this robot's parameter
// file or on the command line, and run laser processing thread if applicable
// for that laser class. For the purposes of this demo, add all
// possible lasers to ArRobot's list rather than just the ones that were
// connected by this call so when you enter laser mode, you
// can then interactively choose which laser to use from that list of all
// lasers mentioned in robot parameters and on command line. Normally,
// only connected lasers are put in ArRobot's list.
if (!laserConnector.connectLasers(
false, // continue after connection failures
false, // add only connected lasers to ArRobot
true // add all lasers to ArRobot
))
{
printf("Could not connect to lasers... exiting\n");
Aria::exit(2);
}
/* not needed, robot connector will do it by default
if (!sonarConnector.connectSonars(
false, // continue after connection failures
false, // add only connected lasers to ArRobot
true // add all lasers to ArRobot
))
{
printf("Could not connect to sonars... exiting\n");
Aria::exit(2);
}
*/
// Create and connect to the compass if the robot has one.
ArTCM2 *compass = compassConnector.create(&robot);
if(compass && !compass->blockingConnect()) {
compass = NULL;
}
// Sleep for a second so some messages from the initial responses
// from robots and cameras and such can catch up
ArUtil::sleep(1000);
// We need to lock the robot since we'll be setting up these modes
// while the robot task loop thread is already running, and they
// need to access some shared data in ArRobot.
robot.lock();
// now add all the modes for this demo
// these classes are defined in ArModes.cpp in ARIA's source code.
if(robot.getOrigRobotConfig()->getHasGripper())
new ArModeGripper(&robot, "gripper", 'g', 'G');
else
ArLog::log(ArLog::Normal, "Robot does not indicate that it has a gripper.");
ArModeActs actsMode(&robot, "acts", 'a', 'A');
ArModeTCM2 tcm2(&robot, "tcm2", 'm', 'M', compass);
ArModeIO io(&robot, "io", 'i', 'I');
ArModeConfig cfg(&robot, "report robot config", 'o' , 'O');
ArModeCommand command(&robot, "command", 'd', 'D');
ArModeCamera camera(&robot, "camera", 'c', 'C');
ArModePosition position(&robot, "position", 'p', 'P', &gyro);
ArModeSonar sonar(&robot, "sonar", 's', 'S');
ArModeBumps bumps(&robot, "bumps", 'b', 'B');
ArModeLaser laser(&robot, "laser", 'l', 'L');
ArModeWander wander(&robot, "wander", 'w', 'W');
ArModeUnguardedTeleop unguardedTeleop(&robot, "unguarded teleop", 'u', 'U');
ArModeTeleop teleop(&robot, "teleop", 't', 'T');
// activate the default mode
teleop.activate();
// turn on the motors
robot.comInt(ArCommands::ENABLE, 1);
robot.unlock();
// Block execution of the main thread here and wait for the robot's task loop
// thread to exit (e.g. by robot disconnecting, escape key pressed, or OS
// signal)
robot.waitForRunExit();
Aria::exit(0);
return 0;
}
示例5: Setup
//.........这里部分代码省略.........
// I'm setting these upper bounds relitivly arbitrarily, feel free to increase them.
dynConf_max.TicksMM = 200;
dynConf_max.DriftFactor = 200;
dynConf_max.RevCount = 32760;
dynamic_reconfigure_server->setConfigMax(dynConf_max);
dynConf_default.trans_vel_max = robot->getTransVelMax() / 1000.0;
dynConf_default.rot_vel_max = robot->getRotVelMax() *M_PI/180.0;
dynConf_default.trans_accel = robot->getTransAccel() / 1000.0;
dynConf_default.trans_decel = robot->getTransDecel() / 1000.0;
dynConf_default.rot_accel = robot->getRotAccel() * M_PI/180.0;
dynConf_default.rot_decel = robot->getRotDecel() * M_PI/180.0;
/* ROS_ERROR("ON ROBOT NOW\n\
Trans vel max: %f\n\
Rot vel max: %f\n\
\n\
trans accel: %f\n\
trans decel: %f\n\
rot accel: %f\n\
rot decel: %f", robot->getTransVelMax(), robot->getRotVelMax(), robot->getTransAccel(), robot->getTransDecel(), robot->getRotAccel(), robot->getRotDecel());
ROS_ERROR("IN DEFAULT CONFIG\n\
Trans vel max: %f\n\
Rot vel max: %f\n\
\n\
trans accel: %f\n\
trans decel: %f\n\
rot accel: %f\n\
rot decel: %f\n", dynConf_default.trans_vel_max, dynConf_default.rot_vel_max, dynConf_default.trans_accel, dynConf_default.trans_decel, dynConf_default.rot_accel, dynConf_default.rot_decel);*/
TicksMM = robot->getOrigRobotConfig()->getTicksMM();
DriftFactor = robot->getOrigRobotConfig()->getDriftFactor();
RevCount = robot->getOrigRobotConfig()->getRevCount();
dynConf_default.TicksMM = TicksMM;
dynConf_default.DriftFactor = DriftFactor;
dynConf_default.RevCount = RevCount;
dynamic_reconfigure_server->setConfigDefault(dynConf_default);
for(int i = 0; i < 16; i++)
{
sonar_tf_array[i].header.frame_id = frame_id_base_link;
std::stringstream _frame_id;
_frame_id << "sonar" << i;
sonar_tf_array[i].child_frame_id = _frame_id.str();
ArSensorReading* _reading = NULL;
_reading = robot->getSonarReading(i);
sonar_tf_array[i].transform.translation.x = _reading->getSensorX() / 1000.0;
sonar_tf_array[i].transform.translation.y = _reading->getSensorY() / 1000.0;
sonar_tf_array[i].transform.translation.z = 0.19;
sonar_tf_array[i].transform.rotation = tf::createQuaternionMsgFromYaw(_reading->getSensorTh() * M_PI / 180.0);
}
for (int i=0;i<16;i++) {
sensor_msgs::Range r;
ranges.data.push_back(r);
}
int i=0,j=0;
if (sonars__crossed_the_streams) {
i=8;
j=8;