#include <QMessageBox>
RobomonAtlantis::RobomonAtlantis(QWidget *parent)
- : QWidget(parent)
+ : QWidget(parent), motorSimulation(orte)
{
QFont font;
font.setPointSize(7);
obstacleSimulationCheckBox = new QCheckBox(tr("&Obstacle simulation"));
obstacleSimulationCheckBox->setShortcut(tr("o"));
+ obstacleSimulationCheckBox->setToolTip("When enabled, simulates an obstacle,\npublishes simlated hokuyo data and \ndisplays robot's map by using shared memory.");
layout->addWidget(obstacleSimulationCheckBox);
+ motorSimulationCheckBox = new QCheckBox(tr("&Motor simulation"));
+ motorSimulationCheckBox->setShortcut(tr("m"));
+ motorSimulationCheckBox->setToolTip("Subscribes to motion_speed and\nbased on this publishes motion_irc.");
+ layout->addWidget(motorSimulationCheckBox);
+
startPlug = new QCheckBox("&Start plug");
layout->addWidget(startPlug);
playgroundScene, SLOT(showObstacle(int)));
connect(playgroundScene, SIGNAL(obstacleChanged(QPointF)),
this, SLOT(changeObstacle(QPointF)));
+
+ connect(motorSimulationCheckBox, SIGNAL(stateChanged(int)),
+ this, SLOT(setMotorSimulation(int)));
}
void RobomonAtlantis::changeStrategy_1()
printf("RobomonAtlantis: Unable to initialize ORTE\n");
}
- /* publishers */
- robottype_publisher_motion_speed_create(&orte, dummy_publisher_callback, NULL);
-
robottype_publisher_pwr_ctrl_create(&orte, dummy_publisher_callback, NULL);
robottype_publisher_robot_cmd_create(&orte, NULL, &orte);
robottype_publisher_robot_switches_create(&orte, dummy_publisher_callback, &orte);
rcv_fsm_motion_cb, this);
robottype_subscriber_fsm_act_create(&orte,
rcv_fsm_act_cb, this);
-
- /* motors */
- orte.motion_speed.left = 0;
- orte.motion_speed.right = 0;
+ robottype_subscriber_motion_speed_create(&orte, NULL, NULL);
/* power management */
orte.pwr_ctrl.voltage33 = true;
ORTEPublicationSend(orte.publication_robot_switches);
}
+void RobomonAtlantis::setMotorSimulation(int state)
+{
+ if (state) {
+ motorSimulation.start();
+ } else {
+ motorSimulation.stop();
+ }
+}
+
void RobomonAtlantis::resetTrails()
{
trailRefPos->reset();