@@ -364,7 +364,7 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
364364 std::stringstream ss;
365365 ss << " Force mode gain scaling factor cannot be set on a CB3 robot." ;
366366 URCL_LOG_ERROR (ss.str ().c_str ());
367- throw std::invalid_argument (ss.str (). c_str () );
367+ throw IncompatibleRobotVersion (ss.str (), 5 , robot_version_. major );
368368 }
369369 // Test that the type is either 1, 2 or 3.
370370 switch (type)
@@ -379,7 +379,7 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
379379 std::stringstream ss;
380380 ss << " The type should be 1, 2 or 3. The type is " << type;
381381 URCL_LOG_ERROR (ss.str ().c_str ());
382- throw std::invalid_argument (ss.str ().c_str ());
382+ throw InvalidRange (ss.str ().c_str ());
383383 }
384384 for (unsigned int i = 0 ; i < selection_vector.size (); ++i)
385385 {
@@ -388,7 +388,7 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
388388 std::stringstream ss;
389389 ss << " The selection vector should only consist of 0's and 1's" ;
390390 URCL_LOG_ERROR (ss.str ().c_str ());
391- throw std::invalid_argument (ss.str ().c_str ());
391+ throw InvalidRange (ss.str ().c_str ());
392392 }
393393 }
394394
@@ -397,15 +397,15 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
397397 std::stringstream ss;
398398 ss << " The force mode damping factor should be between 0 and 1, both inclusive." ;
399399 URCL_LOG_ERROR (ss.str ().c_str ());
400- throw std::invalid_argument (ss.str ().c_str ());
400+ throw InvalidRange (ss.str ().c_str ());
401401 }
402402
403403 if (gain_scaling_factor > 2 || gain_scaling_factor < 0 )
404404 {
405405 std::stringstream ss;
406406 ss << " The force mode gain scaling factor should be between 0 and 2, both inclusive." ;
407407 URCL_LOG_ERROR (ss.str ().c_str ());
408- throw std::invalid_argument (ss.str ().c_str ());
408+ throw InvalidRange (ss.str ().c_str ());
409409 }
410410
411411 if (script_command_interface_->clientConnected ())
@@ -430,7 +430,7 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
430430 std::stringstream ss;
431431 ss << " You should also specify a force mode gain scaling factor to activate force mode on an e-series robot." ;
432432 URCL_LOG_ERROR (ss.str ().c_str ());
433- throw std::invalid_argument (ss.str (). c_str () );
433+ throw IncompatibleRobotVersion (ss.str (), 3 , robot_version_. major );
434434 }
435435 // Test that the type is either 1, 2 or 3.
436436 switch (type)
@@ -445,7 +445,7 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
445445 std::stringstream ss;
446446 ss << " The type should be 1, 2 or 3. The type is " << type;
447447 URCL_LOG_ERROR (ss.str ().c_str ());
448- throw std::invalid_argument (ss.str ().c_str ());
448+ throw InvalidRange (ss.str ().c_str ());
449449 }
450450 for (unsigned int i = 0 ; i < selection_vector.size (); ++i)
451451 {
@@ -454,7 +454,7 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
454454 std::stringstream ss;
455455 ss << " The selection vector should only consist of 0's and 1's" ;
456456 URCL_LOG_ERROR (ss.str ().c_str ());
457- throw std::invalid_argument (ss.str ().c_str ());
457+ throw InvalidRange (ss.str ().c_str ());
458458 }
459459 }
460460
@@ -463,7 +463,7 @@ bool UrDriver::startForceMode(const vector6d_t& task_frame, const vector6uint32_
463463 std::stringstream ss;
464464 ss << " The force mode damping factor should be between 0 and 1, both inclusive." ;
465465 URCL_LOG_ERROR (ss.str ().c_str ());
466- throw std::invalid_argument (ss.str ().c_str ());
466+ throw InvalidRange (ss.str ().c_str ());
467467 }
468468
469469 if (script_command_interface_->clientConnected ())
0 commit comments