Commit bcfa8a85 authored by Timothy Stack's avatar Timothy Stack

Tweaks for garcia-pilot:

	* robots/primotion/garcia-pilot.cc: Turn off the fall sensors,
	since they have a tendency to go off for no good reason.

	* robots/primotion/pilotButtonCallback.cc: A short-click on the
	user-button now shuts the garcia down.

	* robots/primotion/pilotClient.cc,
	robots/primotion/wheelManager.hh,
	robots/primotion/wheelManager.cc: Set the wheel speed.
parent 6cce1762
......@@ -247,6 +247,10 @@ int main(int argc, char *argv[])
av.set("meters");
garcia.setNamedValue("distance-units-string", &av);
/* turn off fall sensors */
av.set(0);
garcia.setNamedValue("down-ranger-enable", &av);
memset(&saddr, 0, sizeof(saddr));
#if !defined(linux)
saddr.sin_len = sizeof(saddr);
......
......@@ -30,7 +30,8 @@ pilotButtonCallback::~pilotButtonCallback()
{
}
bool pilotButtonCallback::shortClick(acpGarcia &garcia, unsigned long now)
bool pilotButtonCallback::shortCommandClick(acpGarcia &garcia,
unsigned long now)
{
ledClient *lc;
......@@ -90,7 +91,7 @@ bool pilotButtonCallback::commandMode(acpGarcia &garcia,
return true;
}
bool pilotButtonCallback::shortCommandClick(acpGarcia &garcia,
bool pilotButtonCallback::longCommandClick(acpGarcia &garcia,
unsigned long now)
{
ledClient *lc;
......@@ -108,8 +109,7 @@ bool pilotButtonCallback::shortCommandClick(acpGarcia &garcia,
return false;
}
bool pilotButtonCallback::longCommandClick(acpGarcia &garcia,
unsigned long now)
bool pilotButtonCallback::shortClick(acpGarcia &garcia, unsigned long now)
{
ledClient *lc;
......
......@@ -204,6 +204,7 @@ bool pilotClient::handlePacket(mtp_packet_t *mp, list &notify_list)
}
if ((mcg->position.x != 0.0) || (mcg->position.y != 0.0)) {
acpValue av;
float theta;
if (debug) {
......@@ -213,6 +214,8 @@ bool pilotClient::handlePacket(mtp_packet_t *mp, list &notify_list)
mcg->position.y);
}
this->pc_wheel_manager.setSpeed(mcg->speed);
/* XXX Need to figure out the real theta and send that back. */
theta = atan2f(mcg->position.y, mcg->position.x);
this->pc_wheel_manager.
......
......@@ -171,6 +171,17 @@ wheelManager::~wheelManager()
{
}
void wheelManager::setSpeed(float speed)
{
acpValue av;
if ((speed < 0.1) || (speed > 0.4))
speed = 0.2;
av.set(speed);
this->wm_garcia.setNamedValue("speed", &av);
}
acpObject *wheelManager::createPivot(float angle, wmCallback *callback)
{
acpObject *retval = NULL;
......
......@@ -88,6 +88,8 @@ public:
void setDashboard(dashboard *dashboard)
{ this->wm_dashboard = dashboard; };
void setSpeed(float speed);
/**
* Create a "pivot" behavior that will rotate the robot to the given angle
* in the robot's local coordinate system. The created behavior will only
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment