task main() { motor[lClaw] = -127; motor[rClaw] = -127; wait1Msec(300); motor[lClaw] = 0; motor[rClaw] = 0; wait1Msec(200); arm(127, 200); arm(0, 350); arm(-127, 100); arm(0, 350); standard(127, 127, 1500); standard(0, 0, 350); motor[lClaw] = 127; motor[rClaw] = 127; wait1Msec(750); motor[lClaw] = 0; motor[rClaw] = 0; wait1Msec(300); standard(-127, -70, 500); standard(0, 0, 200); standard(-127, 127, 345); standard(0, 0, 200); }
void stack::call::confirm(thread *thread, session *s) { assert(thread != NULL); assert(s != NULL); voip::msg_t ack = NULL; time_t now; voip::did_t did = -1; voip::context_t ctx = NULL; Mutex::protect(this); if(target == NULL) { Mutex::release(this); shell::debug(2, "cannot confirm call %08x:%u from session %08x:%u\n", source->sequence, source->cid, s->sequence, s->cid); return; } switch(state) { case ANSWERED: case JOINED: set(JOINED, 'j', "joined"); source->state = target->state = session::OPEN; if(thread->sevent->did > -1) s->did = thread->sevent->did; if(expires) { time(&now); arm((timeout_t)((expires - now) * 1000l)); } else arm((timeout_t)DAY_TIMEOUT); case HOLDING: if(s == source) { ctx = target->context; did = target->did; } else if(s == target) { did = source->did; ctx = source->context; } break; default: Mutex::release(this); shell::debug(2, "cannot confirm unanswered call %08x:%u", source->sequence, source->cid); return; } Mutex::release(this); if(voip::make_ack_message(ctx, did, &ack)) { stack::siplog(ack); voip::send_ack_message(ctx, did, ack); } else { shell::debug(2, "confirm failed to send for call %08x:%u", source->sequence, source->cid); } }
void MatchExpr::bind(NameSema& sema) const { expr()->bind(sema); for (size_t i = 0, e = num_arms(); i != e; ++i) { sema.push_scope(); arm(i)->ptrn()->bind(sema); arm(i)->expr()->bind(sema); sema.pop_scope(); } }
void stack::call::failed(thread *thread, session *s) { assert(thread != NULL); Mutex::protect(this); switch(state) { case FINAL: case TERMINATE: case FAILED: Mutex::release(this); return; default: break; } if(s->state == session::RING) --ringing; else if(s->state == session::BUSY) --ringbusy; else if(s->state == session::REFER) s->state = session::CLOSED; if(s->state != session::CLOSED) s->state = session::OPEN; switch(state) { case RINGING: if(!ringing && ringbusy) set(BUSY, 'b', "busy"); else if(!ringing) { arm(stack::resetTimeout()); set(FAILED, '*', "failed"); } break; case INITIAL: case ANSWERED: set(FAILED, '*', "failed"); arm(stack::resetTimeout()); break; case BUSY: if(!ringbusy) { set(FAILED, '*', "failed"); arm(stack::resetTimeout()); } default: break; } Mutex::release(this); stack::close(s); }
task autonomous() { bool blue = SensorValue[bluePin] ? false : true; int factor = blue ? -1 : 1; drive(0, 0, 127); wait1Msec(2000); nMotorEncoder[FRDrive] = 0; while (abs(nMotorEncoder[FRDrive]) < 1500) { drive(factor * 127, factor *127, 96); } drive(0, 0, 0); wait1Msec(500); arm(blue ? 0 : -127, blue ? -127 : 0); wait1Msec(500); arm(0, 0); }
void stack::call::expired(void) { linked_pointer<segment> sp; switch(state) { case TRANSFER: case HOLDING: // hold-recall timer expired... case RINGING: // re-generate ring event to origination... // also controls call-forward no-answer timing... if(answering == 1 && forwarding) { forwarding = "na"; cancelLocked(); if(stack::forward(this)) { arm(1000); reply_source(SIP_CALL_IS_BEING_FORWARDED); return; } disconnectLocked(); break; } if(answering) --answering; arm(1000); reply_source(SIP_RINGING); return; case REDIRECT: // FIXME: add refer select of next segment if list.... case RINGBACK: case BUSY: // invite expired case JOINED: // active call session expired without re-invite case ANSWERED: case REORDER: case TRYING: case FAILED: disconnectLocked(); break; case FINAL: // session expired that expects to be recycled. case INITIAL: // never used session recycled. // The call record is garbage collected shell::debug(4, "expiring call %08x:%u\n", source->sequence, source->cid); stack::destroy(this); return; default: break; } }
void stack::call::ring(thread *thread, session *s) { assert(thread != NULL); Mutex::protect(this); switch(state) { case TRYING: case INITIAL: case BUSY: // we offset the first ring by 1 second because some servers // send a 180 immediately followed by a 200 because they do // artificial ringback within a connected session (asterisk for // example). Also, we might get a 200 OK accept from another // invited ua, and so we do not want to start a partial ring // followed by a connect... set(RINGING, 'r', "ringin"); arm(1000); case RINGING: if(s && s != source && s->state != session::RING) { ++ringing; s->state = session::RING; } else if(!s) ++ringing; default: break; } Mutex::release(this); }
void JoyPadController::pre_Comm() { js_event event; bool was_event = false; while (!was_event) { js_ok_ &= check_Joystick(); if (!js_ok_) { request.add_State_Req(STOP); request.add_State_Req(BASE_CONTROL); request.add_State_Req(ARM_CONTROL); reconntect_Joystick(); was_event = true; } else if (js.get_event(&event)) { process_JS_Event(event); control(event); if (!admin_mode_) { base(event); arm(event); } else admin(event); if (request.get_State_Req() != 0) was_event = true; } else { boost::this_thread::sleep(boost::posix_time::milliseconds(1)); } } }
int Scene_Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: initTestCase(); break; case 1: init(); break; case 2: cleanup(); break; case 3: initial(); break; case 4: values(); break; case 5: fixtureRemoval(); break; case 6: loadSuccess(); break; case 7: loadWrongType(); break; case 8: loadWrongRoot(); break; case 9: save(); break; case 10: copyFrom(); break; case 11: createCopy(); break; case 12: arm(); break; case 13: armMissingFixture(); break; case 14: armTooManyChannels(); break; case 15: flashUnflash(); break; case 16: writeHTPBusZero(); break; case 17: writeHTPBusOne(); break; case 18: writeLTPHTPBusZero(); break; case 19: writeLTPBusOne(); break; case 20: writeLTPReady(); break; case 21: writeValues(); break; default: ; } _id -= 22; } return _id; }
void AmbulanceC::manageAlarm(void){ resetSrn(); resetAl(); if(AlLevel==_NONE) disarm(); else arm(); }
void MSToggleButtonBase::key(KeySym keysym_,unsigned int,const char *) { if (keysym_==XK_Return) { (armed()==MSFalse)?arm():disarm(); } else if (keysym_==XK_Up) up(); else if (keysym_==XK_Down) down(); else if (keysym_==XK_Left) left(); else if (keysym_==XK_Right) right(); }
int main(int argc, char* argv[]) { arm(); thumb(); printf("arm: %d\n", (ptrdiff_t) &arm); printf("thumb: %d\n", (ptrdiff_t) &thumb); return 0; }
void score_in_basket(int motorspeed, int distance, int buckettime) { arm(up); moveCm(forward, distance, motorspeed); move_bucket(down, buckettime); wait10Msec(25); move_bucket(up, buckettime); }
void robot(){ matrixPush(ModelView); matrixRotate(ModelView, torso_angle, 0, 0, 1); torso(); matrixPush(ModelView); matrixTranslate(ModelView, 0, 10.2, 0); matrixRotate(ModelView, head_angle, 0, 0, 1); head(); matrixPush(ModelView); matrixTranslate(ModelView, .5, 2.5, 0); eye(); matrixPop(ModelView); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, -4.5, 7, 0); matrixRotate(ModelView, -45, 0, 0, 1); arm(left_upper_arm_angle, left_lower_arm_angle, left_wrist_angle); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, 4.5, 7, 0); matrixRotate(ModelView, 45, 0, 0, 1); arm(right_upper_arm_angle, right_lower_arm_angle, right_wrist_angle); matrixPop(ModelView); matrixPush(ModelView); lower_torso(); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, -2, -1.5, 0); matrixRotate(ModelView, -30, 0, 0, 1); leg(left_upper_leg_angle, left_lower_leg_angle, left_foot_angle); matrixPop(ModelView); matrixPush(ModelView); matrixTranslate(ModelView, 2, -1.5, 0); matrixRotate(ModelView, 30, 0, 0, 1); right_leg(right_upper_leg_angle, right_lower_leg_angle, right_foot_angle); matrixPop(ModelView); matrixPop(ModelView); }
task main() { wait10Msec(100); StartTask (update_gyroSensor); wait10Msec(100); arm(up); findIRBasket(50); //moveToRamp(50); }
TimerFD::TimerFD(int timeout_ms, bool one_shot) : FileSource(::timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC), FileEvents::INPUT), m_timeout(timeout_ms), m_one_shot(one_shot) { arm(); }
void resetAll(){ //Stops all motors and resets all sensors drive(0); intake(0,0); arm(0,0); slide(0,0); wait1Msec(400); clearDriveEncoders(); clearSlideEncoder(); SensorValue[in6] = 0; }
TimeBomb( void (*cleanupFunc)() = NULL ) : m_sleep( 0 ), m_numberOfClient( -1 ) { char* sleepEnv = ACE_OS::getenv( "TIMEBOMB" ); if ( sleepEnv != NULL ) { m_sleep.sec( atol( sleepEnv ) ); } m_cleanupCallback = cleanupFunc; arm( );//starting }
void moveToBasket(int motorpower) { rotate(right, motorpower, east); drive(motorpower, 8, yes); moveBucket(down); wait10Msec(100); moveBucket(up); drive(-(motorpower), 8, yes); rotate(left, motorpower, north); arm(down); }
task usercontrol() { bool pressed = false; bool driveEnabled = true; while (true) { if (driveEnabled) { drive(vexRT[Ch3], vexRT[Ch2], vexRT[Ch1]); } else { arm(vexRT[Ch3], vexRT[Ch2]); } if (!pressed && vexRT[Btn8D]) driveEnabled = !driveEnabled; pressed = vexRT[Btn8D] ? true : false; wait1Msec(20); } }
void stack::call::closingLocked(session *s) { assert(s != NULL); if(invited) --invited; if(!invited) { if(!stack::forward(this)) disconnectLocked(); if(state == RINGING) { arm(1000); reply_source(SIP_CALL_IS_BEING_FORWARDED); } } }
bool goToInitConfiguration(ros::NodeHandle& n) { // construct RobotArm object... RobotArm arm(n); // ...init it ROS_INFO("Init of arm action interface..."); if(!arm.init()) return false; // ... use it to go the initial joint configuration ROS_INFO("Going to desired initial configuration..."); if(!arm.gotoDesiredConfiguration()) return false; // no erros occured return true; }
stack::call::call() : LinkedList(), segments() { arm(stack::resetTimeout()); count = 0; forwarding = diverting = NULL; answering = 16; // should set from cfna timer... invited = ringing = ringbusy = unreachable = 0; phone = false; expires = 0l; target = source = NULL; state = INITIAL; enlist(&stack::sip); starting = ending = 0l; reason = joined = NULL; map = NULL; timer = Timer::inf; }
void NetAlarm::checkForRemoteControl() { if (rcSwitch_.available()) { unsigned long code = rcSwitch_.getReceivedValue(); DEBUG_PRINT(String("Received remote 433 MHz code: ") + String(code)); if (code == remoteArmCode_) { arm(); } else if (code == remoteDisarmCode_) { disarm(); } rcSwitch_.resetAvailable(); } }
main() { int a; printf("Enter the no :"); scanf("%d",&a); if(pal(a)) printf("The no is palindrome .\n"); if(fiba(a)) printf("The no is fibanocci .\n"); if(pri(a)) printf("The no is prime .\n"); if(arm(a)) printf("The no is armstrong .\n"); if(per(a)) printf("The no is perfect .\n"); return 0; }
int main() { #ifdef CONFIG_TEST test(); #endif #ifdef CONFIG_ARM arm(); #endif #ifdef CONFIG_X86 x86(); #endif printf("hello %s\n", __func__); return 0; }
//***************************** // Main //***************************** task main() { initializeRobot(); // waitForStart(); // wait for start of tele-op phase while (true) { //retrieves data from the joystick getJoystickSettings(joystick); // drive robot drive(); //use arm // use hand //grab(); arm(); } }
void stack::call::trying(thread *thread) { // if we are in initial state, then send call trying, otherwise // turn-over state and set timer to wait for all invites to become // busy or one or more to start ringing... // if(state == INITIAL) { shell::debug(3, "sip: sending initial ring %d", SIP_RINGING); reply_source(SIP_RINGING); time_t now; time(&now); if(answering) answering -= (unsigned)(now - starting); } Mutex::protect(this); set(TRYING, 't', "trying"); arm(4000); Mutex::release(this); }
void TrackSampleDisk::forward() { if (eof) return; channelIdx++; if (channelIdx == LANTERN_AUDIO_NUM_CHANNELS) { idxFraction += tickSpeed; while (idxFraction >= 1) { idxFraction--; idx += fileStream->getNumChannels(); } if (idx + idxFraction >= length) { eof = true; if (loopBehavior == LANTERN_AUDIO_WAV_LOOP_FOREVER) arm(); } else if (idx >= bufferMiddleBound && bufferRightBound < length) { fillBuffer(); } channelIdx = 0; } }
void create() { seteuid(getuid()); ::create(); set("short", "Frank"); enable_commands(); set("long", @ENDLONG This is Frank. Frank is a 7ft. tall human. Frank is not happy. Frank wants you to try somthing. ENDLONG ); set_name("frank"); set("id", ({ "frank", "Frank", "human", })); set_alignment(-10); arm(WEAPONS(lallai), "dagger"); credit(380 ); set("weapon_name", "dagger"); wear( ARMOR(bshield), "shield"); set("damage", ({10, 15 }) );