Skip to content

Operator side program for the SmartArmStack. Runs in Windows and is used to control Phantom-family devices.

License

Notifications You must be signed in to change notification settings

SmartArmStack/smart_arm_master_windows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

SmartArmMaster for Windows

smart_arm_master_gui_snapshot

Note: Research Only (Noncommercial) License

Master program used for the SmartArm and related systems. Currently compatible only with the 3DSystems device family. Reads relevant information from the operator-side computer and sends it to the patient-side computer running sas_operator_side_receiver .

Disclaimer

Use at your own risk, there is no support nor warranty of any kind.

Quick start

  1. Install the device drivers of your 3DSystem device (Vendor Link)
  2. Configure your device with the TouchSmartSetup.exe or similar application. This will name your devices as either {Left,Right}Device for two devices, or Default Device for one device setups.
  3. Install the SmartArmMaster application by downloading the latest installer from the release page in this repository.
  4. Configure the configuration.json file as needed. (More information below)
  5. Run the program SmartArmMaster.exe. If there are no errors, a GUI similar to the one shown at the beginning of the README will appear.

Configuration

Some information for the commonly used fields in configuration.json. Variables not listed here should be considered advanced.

Variable Meaning
left_arm_id The label for your left device. Usually Left Device in bimanual systems.
right_arm_id The label for your right device. Usually Right Device in bimanual systems or Default Device when only one interface is used.
ps_ip_address Patient-side (ps) IP, that is, the IP of the computer running the sas_operator_side_receiver .
ps_port The port used together with the ps_id_address, such as 2222
os_ip_address Operator-side (os) IP, that is, the IP of the computer running this program.
clutch_virtual_key_code The key which will be used to emulate the clutch, as a Windows Virtual-Key Code
additional_virtual_key_codes A list of additional keys that can be used for arbitrary purposes on the receiving end, as Windows Virtual-Key Codes

Protocol V3

Example sender C++-like (pseudo)code.

/**
A slightly upgraded version of packet 2 with two additions:
- Packet version, so that from now on the patient side can also distingish what is being received.
- Data of any number of additional key states added to the configuration.json.
*/
void UDPSender::send_packet_version_3()
{
QByteArray buffer;
QDataStream s(&buffer, QIODevice::WriteOnly);
//Unique information
s << qint32(3);//Packet version -- Hard coded version
s << qint32(0);//Computer index
s << qint32(0);//Cluch state, 0 or 1
s << float(20.0);//Motion scaling, larger than zero but not enforced here.
s << qint32(0);//Number of additional keys, in this case none.
for(auto& additional_key_and_state: additional_virtual_key_codes_and_states_)
{
s << qint32(std::get<1>(additional_key_and_state));//The state of each additional key
}
s << qint32(2);//Number of master manipulators, usually 1 or 2
//For each master manipulator
for(int manipulator_index=0;manipulator_index < 2;manipulator_index++)
{
s << qint32(manipulator_index);
const DQ t = manipulator->get_translation();
const DQ r = manipulator->get_rotation();
const DQ t_dot = manipulator->get_linear_velocity();
const DQ r_dot = manipulator->get_angular_velocity();
s << float(t.q(1))
<< float(t.q(2))
<< float(t.q(3))
<< float(r.q(0))
<< float(r.q(1))
<< float(r.q(2))
<< float(r.q(3))
<< float(t_dot.q(1))
<< float(t_dot.q(2))
<< float(t_dot.q(3))
<< float(r_dot.q(1))
<< float(r_dot.q(2))
<< float(r_dot.q(3))
<< float(manipulator->get_button())//Master button state
<< float(manipulator->get_gripper());//If there is a CONTEC gripper attached
}
}
//Checksum
quint16 crc16 = qChecksum(buffer,uint(buffer.size()));
s << quint16(crc16);
//Send
QHostAddress ip;
//Just an example of target IP
if(ip.setAddress("192.168.0.1"))
{
//Example port
int port = 2222;
qint64 return_value = udp_socket_.writeDatagram(buffer, ip, quint16(port));
if(return_value == -1)
{
std::runtime_error("Error sending packet");
}
}
}

About

Operator side program for the SmartArmStack. Runs in Windows and is used to control Phantom-family devices.

Resources

License

Stars

Watchers

Forks

Languages