Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with arm manipulation #9

Open
Idoabergel opened this issue Sep 17, 2024 · 0 comments
Open

issue with arm manipulation #9

Idoabergel opened this issue Sep 17, 2024 · 0 comments

Comments

@Idoabergel
Copy link

Hi

im trying to write a simple are manipulation function using the cpp API, i have an issue with moving the arm in/out.

bool SpotRobodog::moveArmInOut(float extensionSpeed)
{
bosdyn::api::RobotCommand robotCommand;

// Create a SynchronizedCommand within the RobotCommand
auto* synchronizedCommand = robotCommand.mutable_synchronized_command();

// Set up the ArmCommand inside the SynchronizedCommand
auto* armCommand = synchronizedCommand->mutable_arm_command();

// Build the cylindrical velocity command
auto* cylindrical_velocity = armCommand->mutable_arm_velocity_command()->mutable_cylindrical_velocity();
cylindrical_velocity->mutable_linear_velocity()->set_r(extensionSpeed);   // Set radial speed (in/out)
cylindrical_velocity->mutable_linear_velocity()->set_theta(0.0);  // No angular movement
cylindrical_velocity->mutable_linear_velocity()->set_z(0.0);      // No vertical movement

// Use chrono for high-precision timing
auto now = std::chrono::system_clock::now();
auto duration = std::chrono::milliseconds(500);  // Duration of 0.5 seconds
auto future_time = now + duration;

auto secs = std::chrono::time_point_cast<std::chrono::seconds>(future_time);
auto nanos = std::chrono::duration_cast<std::chrono::nanoseconds>(future_time - secs).count();

// Set the end_time using google::protobuf::Timestamp
auto* end_time = armCommand->mutable_arm_velocity_command()->mutable_end_time();
end_time->set_seconds(secs.time_since_epoch().count());
end_time->set_nanos(nanos);

// Send the arm command and check the result
auto arm_res = sendArmCommand(robotCommand);
if (!arm_res) {
    return false;
}

return true;

}

the error im getting is:
[component_container_mt-1] [ERROR] [1726597323.348119238] [XTRA]: [SpotRobodog.cpp:609 sendArmCommand()]>> Failed to send arm command: 6(STATUS_TOO_DISTANT): \

the extensionSpeed = 0.1

maybe is the timing?

thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant