24 #include <boost/filesystem.hpp> 28 int main (
int argc,
char* argv[])
43 std::vector <uint8_t> output_data;
46 boost::filesystem::path resources_path;
47 char const* tmp = std::getenv(
"CANOPEN_RESOURCE_PATH");
53 "The environment variable 'CANOPEN_RESOURCE_PATH' could not be read. Using relative path 'resources/'" <<
endl);
54 resources_path = boost::filesystem::path(
"resources");
58 resources_path = boost::filesystem::path(tmp);
61 std::string emcy_emergency_errors_filename = (resources_path / boost::filesystem::path(
"EMCY_schunk.ini")).
string();
80 node->m_nmt.preOperational();
81 node->printPDOMapping();
90 node->printSupportedModesOfOperation();
123 arm_group->initNodes();
128 std::cout << std::endl << std::endl << std::endl << std::endl << std::endl << std::endl;
147 node_8->commutationSearch();
148 std::cout << std::endl << std::endl << std::endl << std::endl << std::endl;
150 node_7->commutationSearch();
152 node_6->commutationSearch();
154 node_5->commutationSearch();
156 node_4->commutationSearch();
158 node_3->commutationSearch();
163 catch (
const std::exception& e)
175 std::cout << std::endl << std::endl << std::endl << std::endl << std::endl << std::endl;
180 double target_position = 0.05;
181 double current_position = 0;
215 while (counter < 5000)
220 catch (
const std::exception& e)
236 arm_group->printStatus();
248 catch (
const std::exception& e)
257 node_8->setTarget(1.57);
262 node_8->setTarget(-1.57);
265 if (counter == 1000 )
267 node_8->setTarget(1.57);
269 if (counter == 2000 )
271 node_8->setTarget(-1.57);
274 if (counter > 5 && counter < 299)
276 double starting_point =
asin(current_position);
277 target_position =
sin(0.01*(counter-6) + starting_point);
280 node->setTarget(target_position);
325 if (counter >= 605 && counter < 800 )
327 double starting_point =
asin(current_position);
328 target_position =
sin(0.01*(counter-605) + starting_point);
330 node->setTarget(target_position);
345 catch (
const std::exception& e)
366 if (counter >= 1005 && counter < 2000)
369 double starting_point =
asin(current_position);
370 target_position =
sin(0.01*(counter-1005) + starting_point);
372 node->setTarget(target_position);
384 double starting_point =
asin(current_position);
385 target_position =
sin(0.01*(counter-2005) + starting_point);
387 node->setTarget(target_position);
479 node_8->disableNode();
bool initialize(int &argc, char *argv[], bool remove_read_arguments)
static void addEmergencyErrorMap(const std::string &filename, const std::string &block_identifier)
Adds new information from an ini file to the emergency error map.
#define LOGGING_INFO(streamname, arg)
#define LOGGING_DEBUG(streamname, arg)
This class gives a device specific interface for Schunk Powerballs, as they need some "special" treat...
The DS402Group class is the base class for canOpen devices implementing the DS402 device protocol (mo...
#define LOGGING_WARNING_C(streamname, classname, arg)
#define LOGGING_ERROR(streamname, arg)
unsigned int sleep(unsigned int seconds)
The CanOpenController class is the main entry point for any calls to the canOpen System.
boost::shared_ptr< NodeT > getNode(const uint8_t node_id)
Returns a shared pointer handle to a node.
ThreadStream & endl(ThreadStream &stream)
INLINE Rall1d< T, V, S > asin(const Rall1d< T, V, S > &x)
boost::shared_ptr< GroupT > getGroup(const std::string &index="default")
Returns a shared pointer to the group with a given index if possible.
void addNode(const uint8_t node_id, const std::string &group_name="default")
Adds a new node to a group. If the group is not found (e.g. it was not created before), nothing will be done.
void addGroup(const std::string &identifier)
Adds a new node group with a given identifier. The group's type is given as template parameter...
int main(int argc, char *argv[])
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
void syncAll()
Downloads all the RPDOs, Sends a Sync and Uploads all the TPDOs.
static const double RAD_TO_STEPS_FACTOR
This factor will be used to convert RAD numbers into encoder ticks.
int usleep(unsigned long useconds)