本文整理汇总了C++中Actuator类的典型用法代码示例。如果您正苦于以下问题:C++ Actuator类的具体用法?C++ Actuator怎么用?C++ Actuator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Actuator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constructColumnLabels
/**
* Construct column labels for the inverse dynamics files.
*/
void InverseDynamics::
constructColumnLabels()
{
Array<string> labels;
labels.append("time");
if(_modelWorkingCopy) {
if( _useModelForceSet ) {
for (int i=0; i < _numCoordinateActuators; i++) {
Actuator* act = dynamic_cast<Actuator*>(&_forceSet->get(i));
if( act )labels.append(act->getName());
}
} else {
auto coordinates = _modelWorkingCopy->getCoordinatesInMultibodyTreeOrder();
for (int i=0; i < _numCoordinateActuators; i++) {
Force& force = _forceSet->get(i);
for(size_t i=0u; i<coordinates.size(); ++i) {
const Coordinate& coord = *coordinates[i];
if(coord.getName()==force.getName()) {
if(coord.getMotionType() == Coordinate::Rotational) {
labels.append(force.getName()+"_moment");
} else if (coord.getMotionType() == Coordinate::Translational) {
labels.append(force.getName()+"_force");
} else {
labels.append(force.getName());
}
}
}
}
}
}
setColumnLabels(labels);
}
示例2: addActuator
void Controller::addActuator(const Actuator& actuator)
{
_actuatorSet.adoptAndAppend(&actuator);
int found = updProperty_actuator_list().findIndex(actuator.getName());
if (found < 0) //add if the actuator isn't already in the list
updProperty_actuator_list().appendValue(actuator.getName());
}
示例3: setActuatorData
void GUIServer::setActuatorData(uint8_t actuatorId, uint8_t dataType,
char* data) {
Actuator* actuator = __aquaduino->getActuator(actuatorId);
//Serial.println("setActuatorData: 2");
if (dataType == 2) {
actuator->setName(data);
}
__aquaduino->writeConfig(actuator);
}
示例4: setActuatorConfig
void GUIServer::setActuatorConfig(uint8_t actuatorId, uint8_t type,
char* value) {
Actuator* actuator = __aquaduino->getActuator(actuatorId);
if (type == 2) {
actuator->setName(value);
}
if (type == 3) {
//sensorUnit����not implemented yet
}
__aquaduino->writeConfig(actuator);
}
示例5: childAdded
void FlowController::childAdded(Component *child)
{
Actuator *actuator;
if ( ( actuator = dynamic_cast<Actuator *>(child) )) {
actuator->setUnit(unit());
actuator->setMin(min());
actuator->setMax(max());
}
FlowMeter::childAdded(child);
}
示例6: addActuator
void Controller::addActuator(const Actuator& actuator)
{
// want to keep a reference not make a clone
// but set interface does not take const pointer
// just const ref that forces a copy
// const_cast only to add to the private set of actuators
Actuator* mutable_act = const_cast<Actuator *>(&actuator);
_actuatorSet.adoptAndAppend(mutable_act);
int found = updProperty_actuator_list().findIndex(actuator.getName());
if (found < 0) //add if the actuator isn't already in the list
updProperty_actuator_list().appendValue(actuator.getName());
}
示例7: run
void Actuator::run()
{
uint8_t i;
Actuator *pObject = NULL;
for ( i = 0; i < objectNum ; i++ )
{
pObject = objectList[i].pObject;
if ( NULL != pObject )
{
pObject->run();
}
}
}
示例8: ActuatorClicked
extern "C" void ActuatorClicked(D4D_OBJECT* pThis)
{
int idx = -1;
if (pThis==&scrDeviceTest_actuator1)
idx = 0;
else if (pThis==&scrDeviceTest_actuator2)
idx = 1;
if (pThis==&scrDeviceTest_actuator3)
idx = 2;
if (idx>=0) {
Actuator* actuator = mgr.actuator(idx);
bool active = !actuator->isActive();
actuator->setActive(active);
SetActuatorButtonState(pThis, active, idx);
}
}
示例9: getActuatorData
void GUIServer::getActuatorData(uint8_t actuatorId) {
Serial.println("getActuatorData");
Actuator* actuator = __aquaduino->getActuator(actuatorId);
//errorcode 0
m_UdpServer.write((uint8_t) 0);
//actuatorID:int
m_UdpServer.write(actuatorId);
//value:int
m_UdpServer.write(actuator->isOn());
//operatingHours:int
m_UdpServer.write((uint8_t) 0);
//lastOperatingHoursReset:dateTime
m_UdpServer.write((uint32_t) 1395867979);
//lastCalibration:dateTime
m_UdpServer.write((uint32_t) 1395867979);
}
示例10: stop
void Actuator::stop()
{
uint8_t i;
Actuator *pObject = NULL;
for ( i = 0; i < objectNum ; i++ )
{
//todo, add balance
pObject = objectList[i].pObject;
if ( NULL != pObject )
{
pObject->stop();
}
}
}
示例11: ScreenDeviceTest_OnMain
void ScreenDeviceTest_OnMain()
{
for (unsigned i=0; i<arraySize(actuator_views); i++) {
const D4D_OBJECT* obj = actuator_views[i];
Actuator* actuator = actuatorForView(obj);
SetActuatorButtonState(obj, actuator->isActive(), i);
}
static uint32_t last = 0;
static uint32_t updateTime = 0;
uint32_t now = millis();
// make sure updating is only taking 25% of CPU time
if (now-last>=4*updateTime) {
last = now;
mgr.update();
updateTime = millis()-now;
}
}
示例12: getAssignedActuators
/**
* \brief Identifies the actuators assigned to a specific controller.
*
* This method iterates over all actuators and checks which actuators
* are assigned to the controller specified by controller. The resulting
* objects are stored in the passed array of actuator pointers with size max.
*
* returns the number of assigned actuators.
*/
int8_t Aquaduino::getAssignedActuators(Controller* controller,
Actuator** actuators, int8_t max) {
int8_t actuatorIdx = -1;
int8_t nrOfAssignedActuators = 0;
Actuator* currentActuator;
int8_t controllerIdx = m_Controllers.findElement(controller);
for (actuatorIdx = 0; actuatorIdx < MAX_ACTUATORS; actuatorIdx++) {
currentActuator = m_Actuators.get(actuatorIdx);
if (currentActuator
&& currentActuator->getController() == controllerIdx) {
if (nrOfAssignedActuators < max)
actuators[nrOfAssignedActuators] = currentActuator;
nrOfAssignedActuators++;
}
}
return nrOfAssignedActuators;
}
示例13: computeAcceleration
//=============================================================================
// ANALYSIS
//=============================================================================
//
void InverseDynamics::
computeAcceleration(SimTK::State& s, double *aF,double *rAccel) const
{
for(int i=0,j=0; i<_forceSet->getSize(); i++) {
Actuator* act = dynamic_cast<Actuator*>(&_forceSet->get(i));
if( act ) {
act->setOverrideForce(s,aF[j++]);
}
}
// NEED TO APPLY OTHER FORCES (e.g. Prescribed) FROM ORIGINAL MODEL
_modelWorkingCopy->getMultibodySystem().realize(s,SimTK::Stage::Acceleration);
SimTK::Vector udot = _modelWorkingCopy->getMatterSubsystem().getUDot(s);
for(int i=0; i<_accelerationIndices.getSize(); i++)
rAccel[i] = udot[_accelerationIndices[i]];
}
示例14: while
void GUIServer::getAllActuators() {
//errorcode 0
m_UdpServer.write((uint8_t) 0);
//num of actuators
m_UdpServer.write((uint8_t) __aquaduino->getNrOfActuators());
Serial.print("num of Actuators: ");
Serial.println(__aquaduino->getNrOfActuators());
//sensor information
Actuator* actuator;
__aquaduino->resetActuatorIterator();
while (__aquaduino->getNextActuator(&actuator) != -1) {
m_UdpServer.write(__aquaduino->getActuatorID(actuator));
m_UdpServer.write(strlen(actuator->getName()));
m_UdpServer.write(actuator->getName());
//influencesStream:bool
m_UdpServer.write((uint8_t) 0);
//influencesHeat:bool
m_UdpServer.write((uint8_t) 0);
//ControllerSemanticValue:int
m_UdpServer.write((uint8_t) 0);
//calibrationInterval(days):int
m_UdpServer.write((uint8_t) 0);
}
}
示例15: CylindricalPart
AdeptOneSim::AdeptOneSim()
{
name="SCARA Adept One Sim";
/***
Codo derecho -> elbow = 1;
Codo izquierdo -> elbow = -1;
***/
//Configuracion inicial
//Configuracion inicial = ELBOW_RIGHT
//Base =links[0]
vector<Vector2D> list;
Actuator* actuator;
ComposedEntity *link=new ComposedEntity;
link->setName("Base");
PrismaticPart *auxPrism=new PrismaticPart;
list.push_back(Vector2D(0.225,-0.225));
list.push_back(Vector2D(0.225,0.225));
list.push_back(Vector2D(-0.475,0.225));
list.push_back(Vector2D(-0.475,-0.225));
auxPrism->setPolygonalBase(list);
list.clear();
auxPrism->setHeight(0.04);
auxPrism->setColor(0.445,0.601,0.352);
(*link)+=auxPrism;
CylindricalPart *auxCyl=new CylindricalPart(0.22,0.20);
auxCyl->setColor(0.445,0.601,0.352);
auxCyl->setRelativePosition(Vector3D(0,0,0.04));
(*link)+=auxCyl;
auxCyl=new CylindricalPart(0.05,0.16);
auxCyl->setColor(0.445,0.601,0.352);
auxCyl->setRelativePosition(Vector3D(0,0,0.22+0.04));
(*link)+=auxCyl;
auxCyl=new CylindricalPart(0.02,0.1);
auxCyl->setColor(0.5,0.5,0.5);
auxCyl->setRelativePosition(Vector3D(0,0,0.05+0.22+0.04));
(*link)+=auxCyl;
auxPrism=new PrismaticPart;
list.push_back(Vector2D(0,-0.085));
list.push_back(Vector2D(0,0.085));
list.push_back(Vector2D(-0.07,0.085));
list.push_back(Vector2D(-0.07,-0.085));
auxPrism->setPolygonalBase(list);
list.clear();
auxPrism->setHeight(0.22);
auxPrism->setColor(0.445,0.601,0.352);
auxPrism->setRelativePosition(Vector3D(-0.17,0,0.04));
(*link)+=auxPrism;
auxPrism=new PrismaticPart;
list.push_back(Vector2D(0,0.20));
list.push_back(Vector2D(-0.135,0.20));
list.push_back(Vector2D(-0.235,0.10));
list.push_back(Vector2D(-0.235,-0.10));
list.push_back(Vector2D(-0.135,-0.20));
list.push_back(Vector2D(0,-0.20));
auxPrism->setPolygonalBase(list);
list.clear();
auxPrism->setHeight(0.22);
auxPrism->setColor(0.445,0.601,0.352);
auxPrism->setRelativePosition(Vector3D(-0.24,0,0.04));
(*link)+=auxPrism;
(*this)+=link;
links.push_back(link);
//Joint 0
SimpleJoint *auxJoint=new SimpleJoint(5*PI/6,-5*PI/6,true,0,Z_AXIS,false);
auxJoint->setRelativePosition(Vector3D(0,0,0.99));
auxJoint->LinkTo(links[0]);
actuator=new Actuator();
actuator->linkTo(auxJoint);
actuators.push_back(actuator);
joints.push_back(auxJoint);
//Arm 1
link=new ComposedEntity;
link->setName("Link 1");
auxCyl=new CylindricalPart(0.03,0.12);
auxCyl->setColor(1,1,1);
auxCyl->setRelativePosition(Vector3D(0,0,-0.66));
(*link)+=auxCyl;
auxCyl=new CylindricalPart(0.47,0.08);
auxCyl->setColor(1,1,1);
auxCyl->setRelativePosition(Vector3D(0,0,-0.63));
(*link)+=auxCyl;
auxCyl=new CylindricalPart(0.10,0.10);
//.........这里部分代码省略.........