
Mid level control code
Dependencies: ros_lib_kinetic
Diff: main.cpp
- Revision:
- 23:61526647cc8a
- Parent:
- 22:82871f00f89d
- Child:
- 24:bc852aa89e7a
--- a/main.cpp Wed Dec 12 08:41:06 2018 +0000 +++ b/main.cpp Fri Dec 14 09:58:24 2018 +0000 @@ -166,10 +166,10 @@ mutPathIn.lock(); // Lock relevant mutex for(short int i=0; i<N_CHANNELS; i++) { // For each LL llcomms.mutChannel[i].lock(); // MUTEX LOCK - llcomms.demandPosition[i] = (int) ((dblDemandPosition_mtrs[i]/MAX_ACTUATOR_LENGTH)*8191); // Convert to a 13-bit number - llcomms.demandPosition[i] = llcomms.demandPosition[i] & 0x1FFF; // Ensure number is 13-bit - llcomms.demandSpeed[i] = (int) ((dblDemandVelocity_mmps[i]/MAX_ACTUATOR_SPEED)*8191);// Convert to a 13-bit number - llcomms.demandSpeed[i] = llcomms.demandSpeed[i] & 0x1FFF; // Ensure number is 13-bit + llcomms.demandPosition[i] = (int) ((dblDemandPosition_mtrs[i]/MAX_ACTUATOR_LENGTH)*511); // Convert to a 9-bit number + llcomms.demandPosition[i] = llcomms.demandPosition[i] & 0x1FF; // Ensure number is 9-bit + llcomms.demandSpeed[i] = (int) ((dblDemandVelocity_mmps[i]/MAX_SPEED_MMPS)*511);// Convert to a 9-bit number + llcomms.demandSpeed[i] = llcomms.demandSpeed[i] & 0x1FF; // Ensure number is 9-bit llcomms.mutChannel[i].unlock(); // MUTEX UNLOCK llcomms.isDataReady[i] = 1; // Signal that data ready } // end for