Download data/core/components/code/mtsGravityCompensation.cpp from introvoyz045/sawControllers: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/datasets/introvoyz045/sawControllers/resolve/main/data/core/components/code/mtsGravityCompensation.cpp
- Command line
-
hf download hf://datasets/introvoyz045/sawControllers/data/core/components/code/mtsGravityCompensation.cpp
-
curl -L -o mtsGravityCompensation.cpp https://huggingface.co/datasets/introvoyz045/sawControllers/resolve/main/data/core/components/code/mtsGravityCompensation.cpp
1.51 kB
| mtsGravityCompensation::mtsGravityCompensation( const std::string& taskname, | |
| double period, | |
| const std::string& robfilename, | |
| const vctFrame4x4<double>& Rtwb, | |
| osaCPUMask cpumask ) : | |
| mtsController( taskname, period, cpumask ), | |
| GC( NULL ){ | |
| GC = new osaGravityCompensation( robfilename, Rtwb ); | |
| mtsInterfaceRequired* input = AddInterfaceRequired( "Input" ); | |
| mtsInterfaceRequired* output = AddInterfaceRequired( "Output" ); | |
| input->AddFunction( "GetPositionJoint", GetPositions ); | |
| output->AddFunction( "servo_jf", SetTorques ); | |
| } | |
| mtsGravityCompensation::~mtsGravityCompensation(){ | |
| if( GC != NULL ) | |
| { delete GC; } | |
| } | |
| void mtsGravityCompensation::Configure( const std::string& ){} | |
| void mtsGravityCompensation::Startup(){ | |
| } | |
| void mtsGravityCompensation::Run(){ | |
| ProcessQueuedCommands(); | |
| prmPositionJointGet prmq; | |
| GetPositions( prmq ); | |
| vctDynamicVector<double> tau( prmq.Position().size(), 0.0 ); | |
| if( GC != NULL && IsEnabled() ){ | |
| if( GC->Evaluate( prmq.Position(), tau ) != | |
| osaGravityCompensation::ESUCCESS ){ | |
| CMN_LOG_RUN_ERROR << "Faile to evaluate the controller" << std::endl; | |
| } | |
| prmForceTorqueJointSet t; | |
| t.ForceTorque() = tau; | |
| SetTorques( t ); | |
| } | |
| } | |
| void mtsGravityCompensation::Cleanup(){} | |